Skip to content

Commit a92a99e

Browse files
committed
Auto merge of #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 fff9e44 + 5394268 commit a92a99e

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

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> {

tests/ui/associated-types/issue-38821.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ LL | impl<T: NotNull> IntoNullable for T {
272272
| ------- ^^^^^^^^^^^^ ^
273273
| |
274274
| unsatisfied trait bound introduced here
275+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
275276

276277
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
277278
--> $DIR/issue-38821.rs:23:23
@@ -301,6 +302,7 @@ LL | impl<T: NotNull> IntoNullable for T {
301302
| ------- ^^^^^^^^^^^^ ^
302303
| |
303304
| unsatisfied trait bound introduced here
305+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
304306

305307
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
306308
--> $DIR/issue-38821.rs:23:10

0 commit comments

Comments
 (0)