about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-11-25 18:42:10 +0100
committerBoxy <rust@boxyuwu.dev>2024-11-28 12:22:02 +0000
commit94131bd0a8e125d6d32034aadf010d9250f83867 (patch)
tree6d537150f9efd46e7acb7601487192fb8fab6460 /compiler/rustc_ast
parent467e200cd5c032489b9bc87284f2a8fbfb922fc3 (diff)
downloadrust-94131bd0a8e125d6d32034aadf010d9250f83867.tar.gz
rust-94131bd0a8e125d6d32034aadf010d9250f83867.zip
always create `DefId`s when lowering anon-consts
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/ast.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index ecb6ef5a2a6..56b20e0ad89 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -1184,14 +1184,15 @@ pub struct Expr {
 }
 
 impl Expr {
-    /// Is this expr either `N`, or `{ N }`.
+    /// Could this expr be either `N`, or `{ N }`, where `N` is a const parameter.
     ///
     /// If this is not the case, name resolution does not resolve `N` when using
     /// `min_const_generics` as more complex expressions are not supported.
     ///
     /// Does not ensure that the path resolves to a const param, the caller should check this.
-    pub fn is_potential_trivial_const_arg(&self, strip_identity_block: bool) -> bool {
-        let this = if strip_identity_block { self.maybe_unwrap_block() } else { self };
+    /// This also does not consider macros, so it's only correct after macro-expansion.
+    pub fn is_potential_trivial_const_arg(&self) -> bool {
+        let this = self.maybe_unwrap_block();
 
         if let ExprKind::Path(None, path) = &this.kind
             && path.is_potential_trivial_const_arg()