diff options
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 5a95e5b084a..cf97b270ed8 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -11,6 +11,7 @@ use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID}; +use rustc_hir::PredicateOrigin; use rustc_index::vec::{Idx, IndexVec}; use rustc_session::utils::NtToTokenstream; use rustc_session::Session; @@ -1346,7 +1347,13 @@ impl<'hir> LoweringContext<'_, 'hir> { let mut predicates = SmallVec::new(); predicates.extend(generics.params.iter().filter_map(|param| { let bounds = self.lower_param_bounds(¶m.bounds, itctx.reborrow()); - self.lower_generic_bound_predicate(param.ident, param.id, ¶m.kind, bounds) + self.lower_generic_bound_predicate( + param.ident, + param.id, + ¶m.kind, + bounds, + PredicateOrigin::GenericParam, + ) })); predicates.extend( generics @@ -1380,6 +1387,7 @@ impl<'hir> LoweringContext<'_, 'hir> { id: NodeId, kind: &GenericParamKind, bounds: &'hir [hir::GenericBound<'hir>], + origin: PredicateOrigin, ) -> Option<hir::WherePredicate<'hir>> { // Do not create a clause if we do not have anything inside it. if bounds.is_empty() { @@ -1419,7 +1427,7 @@ impl<'hir> LoweringContext<'_, 'hir> { bounds, span, bound_generic_params: &[], - in_where_clause: false, + origin, })) } GenericParamKind::Lifetime => { @@ -1458,7 +1466,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ) })), span: self.lower_span(span), - in_where_clause: true, + origin: PredicateOrigin::WhereClause, }), WherePredicate::RegionPredicate(WhereRegionPredicate { ref lifetime, diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index c70ef501361..91d37fa1612 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1298,6 +1298,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { def_node_id, &GenericParamKind::Type { default: None }, hir_bounds, + hir::PredicateOrigin::ImplTrait, ) { in_band_ty_bounds.push(preds) } |
