about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-26 00:39:12 -0700
committerGitHub <noreply@github.com>2020-06-26 00:39:12 -0700
commit1755e3b05cd5d8d8771bb72f8e42b632b4c8fbc3 (patch)
treea390e089339ad7287ee353af84341915e45f3802 /src/test/ui
parent3d7521d31d3391f92efbe0cc53befd9634b34a71 (diff)
parentecb8b9f9f768a3245e8ae723005d5c408bf2067a (diff)
downloadrust-1755e3b05cd5d8d8771bb72f8e42b632b4c8fbc3.tar.gz
rust-1755e3b05cd5d8d8771bb72f8e42b632b4c8fbc3.zip
Rollup merge of #73681 - jackh726:chalk-0.14, r=nikomatsakis
Update Chalk to 0.14

Not a ton here. Notable changes:
- Update to `0.14.0`
  - New dependency on `tracing`, in `librustc_traits` only
  - `FnAbi` from Chalk is `rustc_target::spec::abi::Abi`
  - `Dynamic` actually lowers region
  - Actually lower closures, with some tests. This doesn't 100% work, but can't confirm that's *only* because of closure lowering.
- Use `FxIndexSet` instead of `FxHashSet` in `chalk_fulfill`, which seems to have fixed the non-deterministic test error ordering. Guess we'll see on CI
- Actually implement `opaque_ty_data`, though I don't think this is sufficient for tests for them (I haven't added any)
- Uncomment some of the chalk tests that now work

r? @nikomatsakis
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/chalkify/closure.rs39
-rw-r--r--src/test/ui/chalkify/closure.stderr18
-rw-r--r--src/test/ui/chalkify/impl_wf.rs7
-rw-r--r--src/test/ui/chalkify/impl_wf.stderr15
-rw-r--r--src/test/ui/chalkify/inherent_impl.rs17
-rw-r--r--src/test/ui/chalkify/recursive_where_clause_on_type.rs11
-rw-r--r--src/test/ui/chalkify/recursive_where_clause_on_type.stderr16
7 files changed, 85 insertions, 38 deletions
diff --git a/src/test/ui/chalkify/closure.rs b/src/test/ui/chalkify/closure.rs
new file mode 100644
index 00000000000..81114d491d7
--- /dev/null
+++ b/src/test/ui/chalkify/closure.rs
@@ -0,0 +1,39 @@
+// check-fail
+// compile-flags: -Z chalk
+
+fn main() -> () {
+    let t = || {};
+    t();
+
+    let mut a = 0;
+    let mut b = move || {
+        a = 1;
+    };
+    b();
+
+    let mut c = b;
+
+    c();
+    b();
+
+    let mut a = 0;
+    let mut b = || {
+        a = 1;
+    };
+    b();
+
+    let mut c = b;
+
+    c();
+    b(); //~ ERROR
+
+    // FIXME(chalk): this doesn't quite work
+    /*
+    let b = |c| {
+        c
+    };
+
+    let a = &32;
+    b(a);
+    */
+}
diff --git a/src/test/ui/chalkify/closure.stderr b/src/test/ui/chalkify/closure.stderr
new file mode 100644
index 00000000000..d5a48a7dc6f
--- /dev/null
+++ b/src/test/ui/chalkify/closure.stderr
@@ -0,0 +1,18 @@
+error[E0382]: borrow of moved value: `b`
+  --> $DIR/closure.rs:28:5
+   |
+LL |     let mut c = b;
+   |                 - value moved here
+...
+LL |     b();
+   |     ^ value borrowed here after move
+   |
+note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
+  --> $DIR/closure.rs:21:9
+   |
+LL |         a = 1;
+   |         ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/chalkify/impl_wf.rs b/src/test/ui/chalkify/impl_wf.rs
index fdc94f69bf2..465eb10241e 100644
--- a/src/test/ui/chalkify/impl_wf.rs
+++ b/src/test/ui/chalkify/impl_wf.rs
@@ -23,15 +23,10 @@ impl<T> Bar for Option<T> {
     type Item = Option<T>;
 }
 
-// FIXME(chalk): the ordering of these two errors differs between CI and local
-// We need to figure out why its non-deterministic
-/*
 impl Bar for f32 {
-//^ ERROR the trait bound `f32: Foo` is not satisfied
     type Item = f32;
-    //^ ERROR the trait bound `f32: Foo` is not satisfied
+    //~^ ERROR the trait bound `f32: Foo` is not satisfied
 }
-*/
 
 trait Baz<U: ?Sized> where U: Foo { }
 
diff --git a/src/test/ui/chalkify/impl_wf.stderr b/src/test/ui/chalkify/impl_wf.stderr
index 5293bbaecd3..e5d7615e43e 100644
--- a/src/test/ui/chalkify/impl_wf.stderr
+++ b/src/test/ui/chalkify/impl_wf.stderr
@@ -11,7 +11,18 @@ LL | impl Foo for str { }
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
 
 error[E0277]: the trait bound `f32: Foo` is not satisfied
-  --> $DIR/impl_wf.rs:40:6
+  --> $DIR/impl_wf.rs:27:17
+   |
+LL | trait Bar {
+   |       --- required by a bound in this
+LL |     type Item: Foo;
+   |                --- required by this bound in `Bar`
+...
+LL |     type Item = f32;
+   |                 ^^^ the trait `Foo` is not implemented for `f32`
+
+error[E0277]: the trait bound `f32: Foo` is not satisfied
+  --> $DIR/impl_wf.rs:35:6
    |
 LL | trait Baz<U: ?Sized> where U: Foo { }
    |                               --- required by this bound in `Baz`
@@ -19,6 +30,6 @@ LL | trait Baz<U: ?Sized> where U: Foo { }
 LL | impl Baz<f32> for f32 { }
    |      ^^^^^^^^ the trait `Foo` is not implemented for `f32`
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/chalkify/inherent_impl.rs b/src/test/ui/chalkify/inherent_impl.rs
index 9dd9eb320dd..a2730219fbe 100644
--- a/src/test/ui/chalkify/inherent_impl.rs
+++ b/src/test/ui/chalkify/inherent_impl.rs
@@ -1,7 +1,5 @@
 // run-pass
 // compile-flags: -Z chalk
-// FIXME(chalk): remove when uncommented
-#![allow(dead_code, unused_variables)]
 
 trait Foo { }
 
@@ -11,8 +9,6 @@ struct S<T: Foo> {
     x: T,
 }
 
-// FIXME(chalk): need late-bound regions on FnDefs
-/*
 fn only_foo<T: Foo>(_x: &T) { }
 
 impl<T> S<T> {
@@ -21,7 +17,6 @@ impl<T> S<T> {
         only_foo(&self.x)
     }
 }
-*/
 
 trait Bar { }
 impl Bar for u32 { }
@@ -31,16 +26,10 @@ fn only_bar<T: Bar>() { }
 impl<T> S<T> {
     // Test that the environment of `dummy_bar` adds up with the environment
     // of the inherent impl.
-    // FIXME(chalk): need late-bound regions on FnDefs
-    /*
     fn dummy_bar<U: Bar>(&self) {
         only_foo(&self.x);
         only_bar::<U>();
     }
-    */
-    fn dummy_bar<U: Bar>() {
-        only_bar::<U>();
-    }
 }
 
 fn main() {
@@ -48,10 +37,6 @@ fn main() {
         x: 5,
     };
 
-    // FIXME(chalk): need late-bound regions on FnDefs
-    /*
-    s.dummy_foo();
     s.dummy_bar::<u32>();
-    */
-    S::<i32>::dummy_bar::<u32>();
+    s.dummy_foo();
 }
diff --git a/src/test/ui/chalkify/recursive_where_clause_on_type.rs b/src/test/ui/chalkify/recursive_where_clause_on_type.rs
index 6ee13f5e7a1..87324a5f79b 100644
--- a/src/test/ui/chalkify/recursive_where_clause_on_type.rs
+++ b/src/test/ui/chalkify/recursive_where_clause_on_type.rs
@@ -1,5 +1,5 @@
 // FIXME(chalk): should fail, see comments
-// check-pass
+// check-fail
 // compile-flags: -Z chalk
 
 #![feature(trivial_bounds)]
@@ -10,7 +10,6 @@ trait Bar {
 trait Foo: Bar { }
 
 struct S where S: Foo;
-//~^ WARN Trait bound S: Foo does not depend on any type or lifetime parameters
 
 impl Foo for S {
 }
@@ -26,10 +25,6 @@ fn foo<T: Foo>() {
 fn main() {
     // For some reason, the error is duplicated...
 
-    // FIXME(chalk): this order of this duplicate error seems non-determistic
-    // and causes test to fail
-    /*
-    foo::<S>() // ERROR the type `S` is not well-formed (chalk)
-    //^ ERROR the type `S` is not well-formed (chalk)
-    */
+    foo::<S>() //~ ERROR the type `S` is not well-formed (chalk)
+    //~^ ERROR the type `S` is not well-formed (chalk)
 }
diff --git a/src/test/ui/chalkify/recursive_where_clause_on_type.stderr b/src/test/ui/chalkify/recursive_where_clause_on_type.stderr
index a5b7ef7fdb2..fddd5895927 100644
--- a/src/test/ui/chalkify/recursive_where_clause_on_type.stderr
+++ b/src/test/ui/chalkify/recursive_where_clause_on_type.stderr
@@ -1,10 +1,14 @@
-warning: Trait bound S: Foo does not depend on any type or lifetime parameters
-  --> $DIR/recursive_where_clause_on_type.rs:12:19
+error: the type `S` is not well-formed (chalk)
+  --> $DIR/recursive_where_clause_on_type.rs:28:11
    |
-LL | struct S where S: Foo;
-   |                   ^^^
+LL |     foo::<S>()
+   |           ^
+
+error: the type `S` is not well-formed (chalk)
+  --> $DIR/recursive_where_clause_on_type.rs:28:5
    |
-   = note: `#[warn(trivial_bounds)]` on by default
+LL |     foo::<S>()
+   |     ^^^^^^^^
 
-warning: 1 warning emitted
+error: aborting due to 2 previous errors