diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 918146605fd..3d4d8e65f69 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -442,9 +442,8 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { tcx.predicates_of(def_id); }, hir::ItemTraitAlias(..) => { - tcx.generics_of(def_id); - tcx.trait_def(def_id); - tcx.predicates_of(def_id); + span_err!(tcx.sess, it.span, E0645, + "trait aliases are not yet implemented (see issue #41517)"); }, hir::ItemStruct(ref struct_def, _) | hir::ItemUnion(ref struct_def, _) => { diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 328b7f9fdef..770d0cd4f1f 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4721,4 +4721,5 @@ register_diagnostics! { E0632, // cannot provide explicit type parameters when `impl Trait` is used in // argument position. E0641, // cannot cast to/from a pointer with an unknown kind + E0645, // trait aliases not finished } diff --git a/src/test/compile-fail/trait-alias.rs b/src/test/compile-fail/trait-alias.rs index de87fe39395..5d4112e4a5e 100644 --- a/src/test/compile-fail/trait-alias.rs +++ b/src/test/compile-fail/trait-alias.rs @@ -9,9 +9,11 @@ // except according to those terms. trait Alias1 = Default where T: Clone; // ok + //~^ERROR trait aliases are not yet implemented trait Alias2 = Default; //~^ERROR type parameters on the left side of a trait alias cannot be bounded //~^^ERROR type parameters on the left side of a trait alias cannot have defaults + //~^^^ERROR trait aliases are not yet implemented impl Alias1 { //~ERROR expected type, found trait alias fn foo() {} diff --git a/src/test/run-pass/trait-alias.rs b/src/test/ui/trait-alias.rs similarity index 76% rename from src/test/run-pass/trait-alias.rs rename to src/test/ui/trait-alias.rs index 529765320a2..b794bab8470 100644 --- a/src/test/run-pass/trait-alias.rs +++ b/src/test/ui/trait-alias.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait SimpleAlias = Default; -trait GenericAlias = Iterator; -trait Partial = IntoIterator; +trait SimpleAlias = Default; //~ERROR E0645 +trait GenericAlias = Iterator; //~ERROR E0645 +trait Partial = IntoIterator; //~ERROR E0645 trait Things {} trait Romeo {} @@ -19,10 +19,10 @@ struct Fore(T); impl Things for The {} impl Romeo for Fore {} -trait WithWhere = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; -trait BareWhere = where The: Things; +trait WithWhere = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645 +trait BareWhere = where The: Things; //~ERROR E0645 -trait CD = Clone + Default; +trait CD = Clone + Default; //~ERROR E0645 fn foo() -> (T, T) { let one = T::default(); diff --git a/src/test/ui/trait-alias.stderr b/src/test/ui/trait-alias.stderr new file mode 100644 index 00000000000..4a8de37a393 --- /dev/null +++ b/src/test/ui/trait-alias.stderr @@ -0,0 +1,38 @@ +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:11:1 + | +11 | trait SimpleAlias = Default; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:12:1 + | +12 | trait GenericAlias = Iterator; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:13:1 + | +13 | trait Partial = IntoIterator; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:22:1 + | +22 | trait WithWhere = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:23:1 + | +23 | trait BareWhere = where The: Things; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:25:1 + | +25 | trait CD = Clone + Default; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors +