Bless chalk tests
This commit is contained in:
parent
2257ba92db
commit
29dccfe9e4
5 changed files with 72 additions and 41 deletions
|
@ -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, _) =
|
let is_target_feature_fn = if let ty::FnDef(def_id, _) =
|
||||||
*trait_ref.skip_binder().self_ty().kind()
|
*trait_ref.skip_binder().self_ty().kind()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// check-fail
|
// known-bug: unknown
|
||||||
|
// FIXME(chalk): Chalk needs support for the Tuple trait
|
||||||
// compile-flags: -Z chalk
|
// compile-flags: -Z chalk
|
||||||
|
|
||||||
fn main() -> () {
|
fn main() -> () {
|
||||||
|
@ -25,7 +26,7 @@ fn main() -> () {
|
||||||
let mut c = b;
|
let mut c = b;
|
||||||
|
|
||||||
c();
|
c();
|
||||||
b(); //~ ERROR
|
b(); // FIXME: reenable when this is fixed ~ ERROR
|
||||||
|
|
||||||
// FIXME(chalk): this doesn't quite work
|
// FIXME(chalk): this doesn't quite work
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0277]: `()` is not a tuple
|
error[E0277]: `()` is not a tuple
|
||||||
--> $DIR/closure.rs:6:5
|
--> $DIR/closure.rs:7:5
|
||||||
|
|
|
|
||||||
LL | t();
|
LL | t();
|
||||||
| ^^^ the trait `Tuple` is not implemented for `()`
|
| ^^^ the trait `Tuple` is not implemented for `()`
|
||||||
|
@ -10,7 +10,7 @@ LL | fn main() -> () where (): Tuple {
|
||||||
| +++++++++++++++
|
| +++++++++++++++
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
error[E0277]: `()` is not a tuple
|
||||||
--> $DIR/closure.rs:12:5
|
--> $DIR/closure.rs:13:5
|
||||||
|
|
|
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^ the trait `Tuple` is not implemented for `()`
|
| ^^^ the trait `Tuple` is not implemented for `()`
|
||||||
|
@ -20,42 +20,9 @@ help: consider introducing a `where` clause, but there might be an alternative b
|
||||||
LL | fn main() -> () where (): Tuple {
|
LL | fn main() -> () where (): Tuple {
|
||||||
| +++++++++++++++
|
| +++++++++++++++
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
|
||||||
--> $DIR/closure.rs:16:5
|
|
||||||
|
|
|
||||||
LL | c();
|
|
||||||
| ^^^ 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
|
|
||||||
|
|
|
||||||
LL | fn main() -> () where (): Tuple {
|
|
||||||
| +++++++++++++++
|
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
error[E0277]: `()` is not a tuple
|
||||||
--> $DIR/closure.rs:17:5
|
--> $DIR/closure.rs:17:5
|
||||||
|
|
|
|
||||||
LL | b();
|
|
||||||
| ^^^ 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
|
|
||||||
|
|
|
||||||
LL | fn main() -> () where (): Tuple {
|
|
||||||
| +++++++++++++++
|
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
|
||||||
--> $DIR/closure.rs:23:5
|
|
||||||
|
|
|
||||||
LL | b();
|
|
||||||
| ^^^ 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
|
|
||||||
|
|
|
||||||
LL | fn main() -> () where (): Tuple {
|
|
||||||
| +++++++++++++++
|
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
|
||||||
--> $DIR/closure.rs:27:5
|
|
||||||
|
|
|
||||||
LL | c();
|
LL | c();
|
||||||
| ^^^ the trait `Tuple` is not implemented for `()`
|
| ^^^ the trait `Tuple` is not implemented for `()`
|
||||||
|
|
|
|
||||||
|
@ -64,11 +31,44 @@ help: consider introducing a `where` clause, but there might be an alternative b
|
||||||
LL | fn main() -> () where (): Tuple {
|
LL | fn main() -> () where (): Tuple {
|
||||||
| +++++++++++++++
|
| +++++++++++++++
|
||||||
|
|
||||||
|
error[E0277]: `()` is not a tuple
|
||||||
|
--> $DIR/closure.rs:18:5
|
||||||
|
|
|
||||||
|
LL | b();
|
||||||
|
| ^^^ 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
|
||||||
|
|
|
||||||
|
LL | fn main() -> () where (): Tuple {
|
||||||
|
| +++++++++++++++
|
||||||
|
|
||||||
|
error[E0277]: `()` is not a tuple
|
||||||
|
--> $DIR/closure.rs:24:5
|
||||||
|
|
|
||||||
|
LL | b();
|
||||||
|
| ^^^ 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
|
||||||
|
|
|
||||||
|
LL | fn main() -> () where (): Tuple {
|
||||||
|
| +++++++++++++++
|
||||||
|
|
||||||
error[E0277]: `()` is not a tuple
|
error[E0277]: `()` is not a tuple
|
||||||
--> $DIR/closure.rs:28:5
|
--> $DIR/closure.rs:28:5
|
||||||
|
|
|
|
||||||
LL | b();
|
LL | c();
|
||||||
| ^^^ `()` is not a tuple
|
| ^^^ 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
|
||||||
|
|
|
||||||
|
LL | fn main() -> () where (): Tuple {
|
||||||
|
| +++++++++++++++
|
||||||
|
|
||||||
|
error[E0277]: `()` is not a tuple
|
||||||
|
--> $DIR/closure.rs:29:5
|
||||||
|
|
|
||||||
|
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
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// check-pass
|
// known-bug: unknown
|
||||||
|
// FIXME(chalk): Chalk needs support for the Tuple trait
|
||||||
// compile-flags: -Z chalk
|
// compile-flags: -Z chalk
|
||||||
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
28
src/test/ui/chalkify/trait-objects.stderr
Normal file
28
src/test/ui/chalkify/trait-objects.stderr
Normal file
|
@ -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`.
|
Loading…
Add table
Add a link
Reference in a new issue