Do not discard ?Sized
type params and suggest their removal
This commit is contained in:
parent
5fb3394cbd
commit
15a40c7ee8
32 changed files with 615 additions and 19 deletions
|
@ -943,7 +943,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
false,
|
||||
);
|
||||
}
|
||||
hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => {}
|
||||
hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe)
|
||||
| hir::GenericBound::Unsized(_) => {}
|
||||
hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => self
|
||||
.instantiate_lang_item_trait_ref(
|
||||
lang_item, span, hir_id, args, param_ty, bounds,
|
||||
|
|
|
@ -2230,7 +2230,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
|
|||
let constness = match modifier {
|
||||
hir::TraitBoundModifier::MaybeConst => hir::Constness::NotConst,
|
||||
hir::TraitBoundModifier::None => constness,
|
||||
hir::TraitBoundModifier::Maybe => bug!("this wasn't handled"),
|
||||
// We ignore `where T: ?Sized`, it is already part of
|
||||
// type parameter `T`.
|
||||
hir::TraitBoundModifier::Maybe => continue,
|
||||
};
|
||||
|
||||
let mut bounds = Bounds::default();
|
||||
|
@ -2260,6 +2262,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
|
|||
predicates.extend(bounds.predicates(tcx, ty));
|
||||
}
|
||||
|
||||
hir::GenericBound::Unsized(_) => {}
|
||||
|
||||
hir::GenericBound::Outlives(lifetime) => {
|
||||
let region =
|
||||
<dyn AstConv<'_>>::ast_region_to_region(&icx, lifetime, None);
|
||||
|
@ -2521,6 +2525,7 @@ fn predicates_from_bound<'tcx>(
|
|||
);
|
||||
bounds.predicates(astconv.tcx(), param_ty)
|
||||
}
|
||||
hir::GenericBound::Unsized(_) => vec![],
|
||||
hir::GenericBound::Outlives(ref lifetime) => {
|
||||
let region = astconv.ast_region_to_region(lifetime, None);
|
||||
let pred = ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(param_ty, region))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue