Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dc95649

Browse files
committedJun 26, 2025·
Add const effect syntax to the parser for all function headers
1 parent 18f4cb1 commit dc95649

File tree

231 files changed

+1387
-1300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+1387
-1300
lines changed
 

‎compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl ParenthesizedArgs {
323323

324324
pub use crate::node_id::{CRATE_NODE_ID, DUMMY_NODE_ID, NodeId};
325325

326-
/// Modifiers on a trait bound like `~const`, `?` and `!`.
326+
/// Modifiers on a trait bound like `[const]`, `?` and `!`.
327327
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
328328
pub struct TraitBoundModifiers {
329329
pub constness: BoundConstness,
@@ -3111,7 +3111,7 @@ pub enum BoundConstness {
31113111
Never,
31123112
/// `Type: const Trait`
31133113
Always(Span),
3114-
/// `Type: ~const Trait`
3114+
/// `Type: [const] Trait`
31153115
Maybe(Span),
31163116
}
31173117

@@ -3120,7 +3120,7 @@ impl BoundConstness {
31203120
match self {
31213121
Self::Never => "",
31223122
Self::Always(_) => "const",
3123-
Self::Maybe(_) => "~const",
3123+
Self::Maybe(_) => "[const]",
31243124
}
31253125
}
31263126
}

‎compiler/rustc_ast_passes/messages.ftl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,17 @@ ast_passes_static_without_body =
232232
free static item without body
233233
.suggestion = provide a definition for the static
234234
235-
ast_passes_tilde_const_disallowed = `~const` is not allowed here
236-
.closure = closures cannot have `~const` trait bounds
237-
.function = this function is not `const`, so it cannot have `~const` trait bounds
238-
.trait = this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
239-
.trait_impl = this impl is not `const`, so it cannot have `~const` trait bounds
240-
.impl = inherent impls cannot have `~const` trait bounds
241-
.trait_assoc_ty = associated types in non-`#[const_trait]` traits cannot have `~const` trait bounds
242-
.trait_impl_assoc_ty = associated types in non-const impls cannot have `~const` trait bounds
243-
.inherent_assoc_ty = inherent associated types cannot have `~const` trait bounds
244-
.object = trait objects cannot have `~const` trait bounds
245-
.item = this item cannot have `~const` trait bounds
235+
ast_passes_tilde_const_disallowed = `[const]` is not allowed here
236+
.closure = closures cannot have `[const]` trait bounds
237+
.function = this function is not `const`, so it cannot have `[const]` trait bounds
238+
.trait = this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
239+
.trait_impl = this impl is not `const`, so it cannot have `[const]` trait bounds
240+
.impl = inherent impls cannot have `[const]` trait bounds
241+
.trait_assoc_ty = associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds
242+
.trait_impl_assoc_ty = associated types in non-const impls cannot have `[const]` trait bounds
243+
.inherent_assoc_ty = inherent associated types cannot have `[const]` trait bounds
244+
.object = trait objects cannot have `[const]` trait bounds
245+
.item = this item cannot have `[const]` trait bounds
246246
247247
ast_passes_trait_fn_const =
248248
functions in {$in_impl ->

0 commit comments

Comments
 (0)
Please sign in to comment.