about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-05-09 13:18:19 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-05-10 08:58:47 +1000
commit5ebcbfc1e132ad0d3584c23e5cf526698f0a44b3 (patch)
tree0985e454777cb3705b354548afe1dab3907239bd /compiler/rustc_builtin_macros/src
parentd22461c9b7ce9417a0ba8d8d4d415ed6f853cda8 (diff)
downloadrust-5ebcbfc1e132ad0d3584c23e5cf526698f0a44b3.tar.gz
rust-5ebcbfc1e132ad0d3584c23e5cf526698f0a44b3.zip
Remove `AstDeref`.
It's a "utility trait to reduce boilerplate" implemented for `P` and
`AstNodeWrapper`, but removing it gives a net reduction of twenty lines
of code. It's also simpler to just implement
`HasNodeId`/`HasAttrs`/`HasTokens` directly on types instead of via
`AstDeref`.

(I decided to make this change when doing some related refactoring and
the error messages involving `AstDeref` and `HasAttrs` were hard to
understand; removing it helped a lot.)
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
-rw-r--r--compiler/rustc_builtin_macros/src/env.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs
index 0913dc91a53..f3ac932e1b7 100644
--- a/compiler/rustc_builtin_macros/src/env.rs
+++ b/compiler/rustc_builtin_macros/src/env.rs
@@ -8,7 +8,7 @@ use std::env::VarError;
 
 use rustc_ast::token::{self, LitKind};
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::{AstDeref, ExprKind, GenericArg, Mutability};
+use rustc_ast::{ExprKind, GenericArg, Mutability};
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
 use rustc_span::{Ident, Span, Symbol, kw, sym};
 use thin_vec::thin_vec;
@@ -148,13 +148,13 @@ pub(crate) fn expand_env<'cx>(
                         cx.dcx().emit_err(errors::EnvNotDefined::CargoEnvVar {
                             span,
                             var: *symbol,
-                            var_expr: var_expr.ast_deref(),
+                            var_expr: &var_expr,
                         })
                     } else {
                         cx.dcx().emit_err(errors::EnvNotDefined::CustomEnvVar {
                             span,
                             var: *symbol,
-                            var_expr: var_expr.ast_deref(),
+                            var_expr: &var_expr,
                         })
                     }
                 }