Be more permissive with required bounds on existential types
This commit is contained in:
parent
381c541685
commit
6982fd21d1
@ -1385,10 +1385,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite
|
||||
}
|
||||
hir::ItemKind::Existential(..) => {
|
||||
let def_id = tcx.hir().local_def_id(it.id);
|
||||
let pty_ty = tcx.type_of(def_id);
|
||||
let generics = tcx.generics_of(def_id);
|
||||
|
||||
check_bounds_are_used(tcx, &generics, pty_ty);
|
||||
let substs = Substs::identity_for_item(tcx, def_id);
|
||||
check_opaque(tcx, def_id, substs, it.span);
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
// compile-pass
|
||||
#![feature(existential_type)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
existential type Two<T, U>: 'static; //~ ERROR type parameter `U` is unused
|
||||
// test that unused generic parameters are ok
|
||||
existential type Two<T, U>: 'static;
|
||||
|
||||
fn one<T: 'static>(t: T) -> Two<T, T> {
|
||||
t
|
||||
|
@ -1,15 +1,18 @@
|
||||
// compile-pass
|
||||
#![feature(existential_type)]
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
||||
existential type PartiallyDefined<T>: 'static; //~ `T` is unused
|
||||
// test that unused generic parameters are ok
|
||||
existential type PartiallyDefined<T>: 'static;
|
||||
|
||||
fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
|
||||
4u32
|
||||
}
|
||||
|
||||
existential type PartiallyDefined2<T>: 'static; //~ `T` is unused
|
||||
// test that unused generic parameters are ok
|
||||
existential type PartiallyDefined2<T>: 'static;
|
||||
|
||||
fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
|
||||
4u32
|
||||
|
Loading…
Reference in New Issue
Block a user