address review comments + better tests

This commit is contained in:
Lukas Markeffsky
2022-12-25 22:16:04 +01:00
parent 83e653920d
commit 1eba6c404f
6 changed files with 415 additions and 108 deletions

View File

@@ -2247,6 +2247,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
) -> (hir::GenericParam<'hir>, Option<hir::WherePredicate<'hir>>, hir::TyKind<'hir>) {
// Add a definition for the in-band `Param`.
let def_id = self.local_def_id(node_id);
let span = self.lower_span(span);
// Set the name to `impl Bound1 + Bound2`.
let param = hir::GenericParam {
@@ -2254,7 +2255,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
def_id,
name: ParamName::Plain(self.lower_ident(ident)),
pure_wrt_drop: false,
span: self.lower_span(span),
span,
kind: hir::GenericParamKind::Type { default: None, synthetic: true },
colon_span: None,
};
@@ -2264,6 +2265,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
node_id,
&GenericParamKind::Type { default: None },
bounds,
/* colon_span */ None,
span,
&ImplTraitContext::Universal,
hir::PredicateOrigin::ImplTrait,
);
@@ -2273,7 +2276,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let ty = hir::TyKind::Path(hir::QPath::Resolved(
None,
self.arena.alloc(hir::Path {
span: self.lower_span(span),
span,
res,
segments:
arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)],