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.
This commit is contained in:
parent
000d90b11f
commit
a32aec021e
1 changed files with 2 additions and 2 deletions
|
@ -192,7 +192,7 @@ use syntax::util::map_in_place::MapInPlace;
|
|||
use syntax::ptr::P;
|
||||
use syntax::symbol::{Symbol, kw, sym};
|
||||
use syntax::parse::ParseSess;
|
||||
use syntax_pos::{DUMMY_SP, Span};
|
||||
use syntax_pos::{Span};
|
||||
|
||||
use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ impl<'a> MethodDef<'a> {
|
|||
// [fields of next Self arg], [etc]>
|
||||
let mut patterns = Vec::new();
|
||||
for i in 0..self_args.len() {
|
||||
let struct_path = cx.path(DUMMY_SP, vec![type_ident]);
|
||||
let struct_path = cx.path(trait_.span, vec![type_ident]);
|
||||
let (pat, ident_expr) = trait_.create_struct_pattern(cx,
|
||||
struct_path,
|
||||
struct_def,
|
||||
|
|
Loading…
Reference in a new issue