Keep spans for generics in #[derive(_)]
desugaring
Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
This commit is contained in:
parent
e5038e2099
commit
e70105f971
10 changed files with 312 additions and 53 deletions
|
@ -211,14 +211,6 @@ fn mk_ty_param(
|
|||
cx.typaram(span, Ident::new(name, span), attrs.to_owned(), bounds, None)
|
||||
}
|
||||
|
||||
fn mk_generics(params: Vec<ast::GenericParam>, span: Span) -> Generics {
|
||||
Generics {
|
||||
params,
|
||||
where_clause: ast::WhereClause { has_where_token: false, predicates: Vec::new(), span },
|
||||
span,
|
||||
}
|
||||
}
|
||||
|
||||
/// Bounds on type parameters.
|
||||
#[derive(Clone)]
|
||||
pub struct Bounds {
|
||||
|
@ -236,7 +228,7 @@ impl Bounds {
|
|||
self_ty: Ident,
|
||||
self_generics: &Generics,
|
||||
) -> Generics {
|
||||
let generic_params = self
|
||||
let params = self
|
||||
.bounds
|
||||
.iter()
|
||||
.map(|t| {
|
||||
|
@ -245,7 +237,11 @@ impl Bounds {
|
|||
})
|
||||
.collect();
|
||||
|
||||
mk_generics(generic_params, span)
|
||||
Generics {
|
||||
params,
|
||||
where_clause: ast::WhereClause { has_where_token: false, predicates: Vec::new(), span },
|
||||
span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue