mirror of https://github.com/rust-lang/rust.git
Make lower_generic_bound_predicate receive AST bounds instead of HIR bounds
This commit is contained in:
parent
5c23a2e5a6
commit
b14c9571fa
|
@ -1350,12 +1350,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||||
|
|
||||||
let mut predicates: SmallVec<[hir::WherePredicate<'hir>; 4]> = SmallVec::new();
|
let mut predicates: SmallVec<[hir::WherePredicate<'hir>; 4]> = SmallVec::new();
|
||||||
predicates.extend(generics.params.iter().filter_map(|param| {
|
predicates.extend(generics.params.iter().filter_map(|param| {
|
||||||
let bounds = self.lower_param_bounds(¶m.bounds, itctx);
|
|
||||||
self.lower_generic_bound_predicate(
|
self.lower_generic_bound_predicate(
|
||||||
param.ident,
|
param.ident,
|
||||||
param.id,
|
param.id,
|
||||||
¶m.kind,
|
¶m.kind,
|
||||||
bounds,
|
¶m.bounds,
|
||||||
|
itctx,
|
||||||
PredicateOrigin::GenericParam,
|
PredicateOrigin::GenericParam,
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
|
@ -1403,13 +1403,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
kind: &GenericParamKind,
|
kind: &GenericParamKind,
|
||||||
bounds: &'hir [hir::GenericBound<'hir>],
|
bounds: &[GenericBound],
|
||||||
|
itctx: ImplTraitContext,
|
||||||
origin: PredicateOrigin,
|
origin: PredicateOrigin,
|
||||||
) -> Option<hir::WherePredicate<'hir>> {
|
) -> Option<hir::WherePredicate<'hir>> {
|
||||||
// Do not create a clause if we do not have anything inside it.
|
// Do not create a clause if we do not have anything inside it.
|
||||||
if bounds.is_empty() {
|
if bounds.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bounds = self.lower_param_bounds(bounds, itctx);
|
||||||
|
|
||||||
let ident = self.lower_ident(ident);
|
let ident = self.lower_ident(ident);
|
||||||
let param_span = ident.span;
|
let param_span = ident.span;
|
||||||
let span = bounds
|
let span = bounds
|
||||||
|
|
|
@ -2013,7 +2013,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
// Add a definition for the in-band `Param`.
|
// Add a definition for the in-band `Param`.
|
||||||
let def_id = self.local_def_id(node_id);
|
let def_id = self.local_def_id(node_id);
|
||||||
|
|
||||||
let hir_bounds = self.lower_param_bounds(bounds, ImplTraitContext::Universal);
|
|
||||||
// Set the name to `impl Bound1 + Bound2`.
|
// Set the name to `impl Bound1 + Bound2`.
|
||||||
let param = hir::GenericParam {
|
let param = hir::GenericParam {
|
||||||
hir_id: self.lower_node_id(node_id),
|
hir_id: self.lower_node_id(node_id),
|
||||||
|
@ -2028,7 +2027,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
ident,
|
ident,
|
||||||
node_id,
|
node_id,
|
||||||
&GenericParamKind::Type { default: None },
|
&GenericParamKind::Type { default: None },
|
||||||
hir_bounds,
|
bounds,
|
||||||
|
ImplTraitContext::Universal,
|
||||||
hir::PredicateOrigin::ImplTrait,
|
hir::PredicateOrigin::ImplTrait,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue