]> git.lizzy.rs Git - rust.git/commitdiff
Be more permissive with required bounds on existential types
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 25 Jan 2019 15:14:59 +0000 (16:14 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 1 Feb 2019 15:38:46 +0000 (16:38 +0100)
src/librustc_typeck/check/mod.rs
src/test/ui/existential_types/generic_duplicate_param_use.rs
src/test/ui/existential_types/unused_generic_param.rs

index 48475b3dcb802b0af0786dacd1a09d8f06df87e2..5390382ee2d76871d2b90c698d611b92709daa31 100644 (file)
@@ -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);
         }
index 380fbdeb8c27ca8d18a6eb3204783a1e54188d6a..14d63ecc6bb5dd7d8977660ab75eec702255dbdf 100644 (file)
@@ -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
index bd7b343b402f50357cd3ee3f33a1373c9802ceb6..7af6508788129e868c5c8d6c2370762e252c53da 100644 (file)
@@ -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