Skip to content

Commit 097b9d7

Browse files
authored
Rollup merge of rust-lang#149350 - Jarcho:derive_recv_ctxt, r=jackh726
Mark method receivers in builtin derives as being from the derive. Another small annoyance while working on clippy. This was clearly using the root context on purpose, but it also has no reason to do so. All the uses of the receiver are generated by the macros so they can just use the marked context rather than the root.
2 parents e98dac3 + 076064f commit 097b9d7

File tree

2 files changed

+2
-2
lines changed
  • compiler
    • rustc_builtin_macros/src/deriving/generic
    • rustc_expand/src

2 files changed

+2
-2
lines changed

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ impl<'a> MethodDef<'a> {
10521052

10531053
let args = {
10541054
let self_arg = explicit_self.map(|explicit_self| {
1055-
let ident = Ident::with_dummy_span(kw::SelfLower).with_span_pos(span);
1055+
let ident = Ident::new(kw::SelfLower, span);
10561056
ast::Param::from_self(ast::AttrVec::default(), explicit_self, ident)
10571057
});
10581058
let nonself_args =

compiler/rustc_expand/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'a> ExtCtxt<'a> {
315315
self.expr_path(self.path_ident(span, id))
316316
}
317317
pub fn expr_self(&self, span: Span) -> Box<ast::Expr> {
318-
self.expr_ident(span, Ident::with_dummy_span(kw::SelfLower))
318+
self.expr_ident(span, Ident::new(kw::SelfLower, span))
319319
}
320320

321321
pub fn expr_macro_call(&self, span: Span, call: Box<ast::MacCall>) -> Box<ast::Expr> {

0 commit comments

Comments
 (0)