From a42e5a14c46dd57493fe38cc2fa51909edb70848 Mon Sep 17 00:00:00 2001 From: Jack Huey Date: Wed, 27 May 2020 01:05:09 -0400 Subject: Implement fn_def_datum --- src/test/ui/chalkify/impl_wf.rs | 7 ++----- src/test/ui/chalkify/impl_wf.stderr | 16 ++++++++++++++-- src/test/ui/chalkify/type_inference.rs | 4 +--- src/test/ui/chalkify/type_inference.stderr | 13 +++++++++++-- src/test/ui/chalkify/type_wf.rs | 11 ++--------- src/test/ui/chalkify/type_wf.stderr | 12 ++++++++++++ 6 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 src/test/ui/chalkify/type_wf.stderr (limited to 'src/test') diff --git a/src/test/ui/chalkify/impl_wf.rs b/src/test/ui/chalkify/impl_wf.rs index 8aa87642292..fdc94f69bf2 100644 --- a/src/test/ui/chalkify/impl_wf.rs +++ b/src/test/ui/chalkify/impl_wf.rs @@ -8,12 +8,9 @@ trait Bar { impl Foo for i32 { } -// FIXME(chalk): blocked on better handling of builtin traits for non-struct -// application types (or a workaround) -/* impl Foo for str { } -//^ ERROR the size for values of type `str` cannot be known at compilation time -*/ +//~^ ERROR the size for values of type `str` cannot be known at compilation time + // Implicit `T: Sized` bound. impl Foo for Option { } diff --git a/src/test/ui/chalkify/impl_wf.stderr b/src/test/ui/chalkify/impl_wf.stderr index befd688741c..5293bbaecd3 100644 --- a/src/test/ui/chalkify/impl_wf.stderr +++ b/src/test/ui/chalkify/impl_wf.stderr @@ -1,5 +1,17 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/impl_wf.rs:11:6 + | +LL | trait Foo: Sized { } + | ----- required by this bound in `Foo` +... +LL | impl Foo for str { } + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit + error[E0277]: the trait bound `f32: Foo` is not satisfied - --> $DIR/impl_wf.rs:43:6 + --> $DIR/impl_wf.rs:40:6 | LL | trait Baz where U: Foo { } | --- required by this bound in `Baz` @@ -7,6 +19,6 @@ LL | trait Baz where U: Foo { } LL | impl Baz for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/chalkify/type_inference.rs b/src/test/ui/chalkify/type_inference.rs index 5175c5d062a..171969afc7f 100644 --- a/src/test/ui/chalkify/type_inference.rs +++ b/src/test/ui/chalkify/type_inference.rs @@ -18,11 +18,9 @@ fn main() { // is expecting a variable of type `i32`. This behavior differs from the // old-style trait solver. I guess this will change, that's why I'm // adding that test. - // FIXME(chalk): partially blocked on float/int special casing only_foo(x); //~ ERROR the trait bound `f64: Foo` is not satisfied // Here we have two solutions so we get back the behavior of the old-style // trait solver. - // FIXME(chalk): blocked on float/int special casing - //only_bar(x); // ERROR the trait bound `{float}: Bar` is not satisfied + only_bar(x); //~ ERROR the trait bound `f64: Bar` is not satisfied } diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr index ee9e67c6c78..47675929264 100644 --- a/src/test/ui/chalkify/type_inference.stderr +++ b/src/test/ui/chalkify/type_inference.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `f64: Foo` is not satisfied - --> $DIR/type_inference.rs:22:5 + --> $DIR/type_inference.rs:21:5 | LL | fn only_foo(_x: T) { } | --- required by this bound in `only_foo` @@ -7,6 +7,15 @@ LL | fn only_foo(_x: T) { } LL | only_foo(x); | ^^^^^^^^ the trait `Foo` is not implemented for `f64` -error: aborting due to previous error +error[E0277]: the trait bound `f64: Bar` is not satisfied + --> $DIR/type_inference.rs:25:5 + | +LL | fn only_bar(_x: T) { } + | --- required by this bound in `only_bar` +... +LL | only_bar(x); + | ^^^^^^^^ the trait `Bar` is not implemented for `f64` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/chalkify/type_wf.rs b/src/test/ui/chalkify/type_wf.rs index 396baf814a0..7c469d99c57 100644 --- a/src/test/ui/chalkify/type_wf.rs +++ b/src/test/ui/chalkify/type_wf.rs @@ -1,5 +1,4 @@ -// FIXME(chalk): should have an error, see below -// check-pass +// check-fail // compile-flags: -Z chalk trait Foo { } @@ -16,17 +15,11 @@ fn main() { x: 5, }; - // FIXME(chalk): blocked on float/int special handling. Needs to know that {float}: !i32 - /* - let s = S { // ERROR the trait bound `{float}: Foo` is not satisfied + let s = S { //~ ERROR the trait bound `f64: Foo` is not satisfied x: 5.0, }; - */ - // FIXME(chalk): blocked on float/int special handling. Needs to know that {float}: Sized - /* let s = S { x: Some(5.0), }; - */ } diff --git a/src/test/ui/chalkify/type_wf.stderr b/src/test/ui/chalkify/type_wf.stderr new file mode 100644 index 00000000000..ab585a6ed21 --- /dev/null +++ b/src/test/ui/chalkify/type_wf.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `f64: Foo` is not satisfied + --> $DIR/type_wf.rs:18:13 + | +LL | struct S { + | ---------------- required by `S` +... +LL | let s = S { + | ^ the trait `Foo` is not implemented for `f64` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. -- cgit 1.4.1-3-g733a5