about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/next-solver/normalize-region-obligations.rs22
-rw-r--r--tests/ui/traits/next-solver/specialization-transmute.rs1
-rw-r--r--tests/ui/traits/next-solver/specialization-transmute.stderr8
-rw-r--r--tests/ui/traits/next-solver/unsound-region-obligation.rs13
-rw-r--r--tests/ui/traits/next-solver/unsound-region-obligation.stderr7
5 files changed, 48 insertions, 3 deletions
diff --git a/tests/ui/traits/next-solver/normalize-region-obligations.rs b/tests/ui/traits/next-solver/normalize-region-obligations.rs
new file mode 100644
index 00000000000..13c86b630f6
--- /dev/null
+++ b/tests/ui/traits/next-solver/normalize-region-obligations.rs
@@ -0,0 +1,22 @@
+// revisions: normalize_param_env normalize_obligation
+// check-pass
+// compile-flags: -Znext-solver
+
+trait Foo {
+    #[cfg(normalize_param_env)]
+    type Gat<'a> where <Self as Mirror>::Assoc: 'a;
+    #[cfg(normalize_obligation)]
+    type Gat<'a> where Self: 'a;
+}
+
+trait Mirror { type Assoc: ?Sized; }
+impl<T: ?Sized> Mirror for T { type Assoc = T; }
+
+impl<T> Foo for T {
+    #[cfg(normalize_param_env)]
+    type Gat<'a> = i32 where T: 'a;
+    #[cfg(normalize_obligation)]
+    type Gat<'a> = i32 where <T as Mirror>::Assoc: 'a;
+}
+
+fn main() {}
diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs
index ff25656a7ff..e7de564877d 100644
--- a/tests/ui/traits/next-solver/specialization-transmute.rs
+++ b/tests/ui/traits/next-solver/specialization-transmute.rs
@@ -1,4 +1,5 @@
 // compile-flags: -Znext-solver
+//~^ ERROR cannot normalize `<T as Default>::Id`
 
 #![feature(specialization)]
 //~^ WARN the feature `specialization` is incomplete
diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr
index a5459165587..a1cf5b761e3 100644
--- a/tests/ui/traits/next-solver/specialization-transmute.stderr
+++ b/tests/ui/traits/next-solver/specialization-transmute.stderr
@@ -1,5 +1,5 @@
 warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
-  --> $DIR/specialization-transmute.rs:3:12
+  --> $DIR/specialization-transmute.rs:4:12
    |
 LL | #![feature(specialization)]
    |            ^^^^^^^^^^^^^^
@@ -8,12 +8,14 @@ LL | #![feature(specialization)]
    = help: consider using `min_specialization` instead, which is more stable and complete
    = note: `#[warn(incomplete_features)]` on by default
 
+error: cannot normalize `<T as Default>::Id`
+
 error[E0282]: type annotations needed
-  --> $DIR/specialization-transmute.rs:13:23
+  --> $DIR/specialization-transmute.rs:14:23
    |
 LL |     default type Id = T;
    |                       ^ cannot infer type for associated type `<T as Default>::Id`
 
-error: aborting due to 1 previous error; 1 warning emitted
+error: aborting due to 2 previous errors; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.rs b/tests/ui/traits/next-solver/unsound-region-obligation.rs
new file mode 100644
index 00000000000..b8bfa035388
--- /dev/null
+++ b/tests/ui/traits/next-solver/unsound-region-obligation.rs
@@ -0,0 +1,13 @@
+//~ ERROR the type `<() as StaticTy>::Item<'a>` does not fulfill the required lifetime
+// compile-flags: -Znext-solver
+// Regression test for rust-lang/trait-system-refactor-initiative#59
+
+trait StaticTy {
+    type Item<'a>: 'static;
+}
+
+impl StaticTy for () {
+    type Item<'a> = &'a ();
+}
+
+fn main() {}
diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.stderr b/tests/ui/traits/next-solver/unsound-region-obligation.stderr
new file mode 100644
index 00000000000..518de7ea3e0
--- /dev/null
+++ b/tests/ui/traits/next-solver/unsound-region-obligation.stderr
@@ -0,0 +1,7 @@
+error[E0477]: the type `<() as StaticTy>::Item<'a>` does not fulfill the required lifetime
+   |
+   = note: type must satisfy the static lifetime
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0477`.