Implement fn_def_datum
This commit is contained in:
parent
7c09ad0627
commit
a42e5a14c4
12 changed files with 93 additions and 61 deletions
|
|
@ -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<T> Foo for Option<T> { }
|
||||
|
|
|
|||
|
|
@ -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 <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:43:6
|
||||
--> $DIR/impl_wf.rs:40:6
|
||||
|
|
||||
LL | trait Baz<U: ?Sized> where U: Foo { }
|
||||
| --- required by this bound in `Baz`
|
||||
|
|
@ -7,6 +19,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 previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<T: Foo>(_x: T) { }
|
||||
| --- required by this bound in `only_foo`
|
||||
|
|
@ -7,6 +7,15 @@ LL | fn only_foo<T: 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<T: 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`.
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
};
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
12
src/test/ui/chalkify/type_wf.stderr
Normal file
12
src/test/ui/chalkify/type_wf.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0277]: the trait bound `f64: Foo` is not satisfied
|
||||
--> $DIR/type_wf.rs:18:13
|
||||
|
|
||||
LL | struct S<T: Foo> {
|
||||
| ---------------- 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue