about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-07-30 05:43:26 +0000
committerMichael Goulet <michael@errs.io>2022-11-05 18:05:44 +0000
commit29dccfe9e498f41169c120e515494cdd9b5b3e11 (patch)
treef30c84754a7b98d138fac7be6af369df8e8a5bde
parent2257ba92db333277c957b3934cdebc2a0a2c2604 (diff)
downloadrust-29dccfe9e498f41169c120e515494cdd9b5b3e11.tar.gz
rust-29dccfe9e498f41169c120e515494cdd9b5b3e11.zip
Bless chalk tests
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs3
-rw-r--r--src/test/ui/chalkify/closure.rs5
-rw-r--r--src/test/ui/chalkify/closure.stderr18
-rw-r--r--src/test/ui/chalkify/trait-objects.rs3
-rw-r--r--src/test/ui/chalkify/trait-objects.stderr28
5 files changed, 44 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 46c03757e60..54281f91205 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -867,7 +867,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                             );
                         }
 
-                        let is_fn_trait = ty::ClosureKind::from_def_id(tcx, trait_ref.def_id()).is_some();
+                        let is_fn_trait =
+                            ty::ClosureKind::from_def_id(tcx, trait_ref.def_id()).is_some();
                         let is_target_feature_fn = if let ty::FnDef(def_id, _) =
                             *trait_ref.skip_binder().self_ty().kind()
                         {
diff --git a/src/test/ui/chalkify/closure.rs b/src/test/ui/chalkify/closure.rs
index 81114d491d7..408e8802d86 100644
--- a/src/test/ui/chalkify/closure.rs
+++ b/src/test/ui/chalkify/closure.rs
@@ -1,4 +1,5 @@
-// check-fail
+// known-bug: unknown
+// FIXME(chalk): Chalk needs support for the Tuple trait
 // compile-flags: -Z chalk
 
 fn main() -> () {
@@ -25,7 +26,7 @@ fn main() -> () {
     let mut c = b;
 
     c();
-    b(); //~ ERROR
+    b(); // FIXME: reenable when this is fixed ~ ERROR
 
     // FIXME(chalk): this doesn't quite work
     /*
diff --git a/src/test/ui/chalkify/closure.stderr b/src/test/ui/chalkify/closure.stderr
index ca62ad834bc..bcee0cab96a 100644
--- a/src/test/ui/chalkify/closure.stderr
+++ b/src/test/ui/chalkify/closure.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:6:5
+  --> $DIR/closure.rs:7:5
    |
 LL |     t();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -10,7 +10,7 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:12:5
+  --> $DIR/closure.rs:13:5
    |
 LL |     b();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -21,7 +21,7 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:16:5
+  --> $DIR/closure.rs:17:5
    |
 LL |     c();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -32,7 +32,7 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:17:5
+  --> $DIR/closure.rs:18:5
    |
 LL |     b();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -43,7 +43,7 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:23:5
+  --> $DIR/closure.rs:24:5
    |
 LL |     b();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -54,7 +54,7 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:27:5
+  --> $DIR/closure.rs:28:5
    |
 LL |     c();
    |     ^^^ the trait `Tuple` is not implemented for `()`
@@ -65,10 +65,10 @@ LL | fn main() -> () where (): Tuple {
    |                 +++++++++++++++
 
 error[E0277]: `()` is not a tuple
-  --> $DIR/closure.rs:28:5
+  --> $DIR/closure.rs:29:5
    |
-LL |     b();
-   |     ^^^ `()` is not a tuple
+LL |     b(); // FIXME: reenable when this is fixed ~ ERROR
+   |     ^^^ the trait `Tuple` is not implemented for `()`
    |
 help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
    |
diff --git a/src/test/ui/chalkify/trait-objects.rs b/src/test/ui/chalkify/trait-objects.rs
index d56abc42bf5..30929e943bd 100644
--- a/src/test/ui/chalkify/trait-objects.rs
+++ b/src/test/ui/chalkify/trait-objects.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: unknown
+// FIXME(chalk): Chalk needs support for the Tuple trait
 // compile-flags: -Z chalk
 
 use std::fmt::Display;
diff --git a/src/test/ui/chalkify/trait-objects.stderr b/src/test/ui/chalkify/trait-objects.stderr
new file mode 100644
index 00000000000..098bd2d3226
--- /dev/null
+++ b/src/test/ui/chalkify/trait-objects.stderr
@@ -0,0 +1,28 @@
+error: the type `&dyn Fn(i32) -> _` is not well-formed (chalk)
+  --> $DIR/trait-objects.rs:11:12
+   |
+LL |     let f: &dyn Fn(i32) -> _ = &|x| x + x;
+   |            ^^^^^^^^^^^^^^^^^
+
+error[E0277]: `(i32,)` is not a tuple
+  --> $DIR/trait-objects.rs:12:5
+   |
+LL |     f(2);
+   |     ^^^^ the trait `Tuple` is not implemented for `(i32,)`
+   |
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+   |
+LL | fn main() where (i32,): Tuple {
+   |           +++++++++++++++++++
+
+error[E0277]: expected a `Fn<(i32,)>` closure, found `dyn Fn(i32) -> i32`
+  --> $DIR/trait-objects.rs:12:5
+   |
+LL |     f(2);
+   |     ^^^^ expected an `Fn<(i32,)>` closure, found `dyn Fn(i32) -> i32`
+   |
+   = help: the trait `Fn<(i32,)>` is not implemented for `dyn Fn(i32) -> i32`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.