Skip to content

Commit a32aec0

Browse files
committed
deriving: avoid dummy Span on an artificial type_ident path
The dummy Span pointed to the beginning of the source file instead to where the `#[derive]` is located. Later, it tripped the `in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`, causing a span-less deprecation warning to be emitted. Fixes #56195, #55417.
1 parent 000d90b commit a32aec0

File tree

1 file changed

+2
-2
lines changed
  • src/libsyntax_ext/deriving/generic

1 file changed

+2
-2
lines changed

src/libsyntax_ext/deriving/generic/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ use syntax::util::map_in_place::MapInPlace;
192192
use syntax::ptr::P;
193193
use syntax::symbol::{Symbol, kw, sym};
194194
use syntax::parse::ParseSess;
195-
use syntax_pos::{DUMMY_SP, Span};
195+
use syntax_pos::{Span};
196196

197197
use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
198198

@@ -1022,7 +1022,7 @@ impl<'a> MethodDef<'a> {
10221022
// [fields of next Self arg], [etc]>
10231023
let mut patterns = Vec::new();
10241024
for i in 0..self_args.len() {
1025-
let struct_path = cx.path(DUMMY_SP, vec![type_ident]);
1025+
let struct_path = cx.path(trait_.span, vec![type_ident]);
10261026
let (pat, ident_expr) = trait_.create_struct_pattern(cx,
10271027
struct_path,
10281028
struct_def,

0 commit comments

Comments
 (0)