Skip to content

Commit 6982fd2

Browse files
committed
Be more permissive with required bounds on existential types
1 parent 381c541 commit 6982fd2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,10 +1385,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite
13851385
}
13861386
hir::ItemKind::Existential(..) => {
13871387
let def_id = tcx.hir().local_def_id(it.id);
1388-
let pty_ty = tcx.type_of(def_id);
1389-
let generics = tcx.generics_of(def_id);
13901388

1391-
check_bounds_are_used(tcx, &generics, pty_ty);
13921389
let substs = Substs::identity_for_item(tcx, def_id);
13931390
check_opaque(tcx, def_id, substs, it.span);
13941391
}

src/test/ui/existential_types/generic_duplicate_param_use.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
// compile-pass
12
#![feature(existential_type)]
23

34
fn main() {}
45

5-
existential type Two<T, U>: 'static; //~ ERROR type parameter `U` is unused
6+
// test that unused generic parameters are ok
7+
existential type Two<T, U>: 'static;
68

79
fn one<T: 'static>(t: T) -> Two<T, T> {
810
t

src/test/ui/existential_types/unused_generic_param.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
// compile-pass
12
#![feature(existential_type)]
23

34
fn main() {
45
}
56

6-
existential type PartiallyDefined<T>: 'static; //~ `T` is unused
7+
// test that unused generic parameters are ok
8+
existential type PartiallyDefined<T>: 'static;
79

810
fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
911
4u32
1012
}
1113

12-
existential type PartiallyDefined2<T>: 'static; //~ `T` is unused
14+
// test that unused generic parameters are ok
15+
existential type PartiallyDefined2<T>: 'static;
1316

1417
fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
1518
4u32

0 commit comments

Comments
 (0)