Update Chalk

This commit is contained in:
Jack Huey 2020-05-27 01:05:09 -04:00
parent 0c04344d86
commit ecb8b9f9f7
15 changed files with 311 additions and 107 deletions

View file

@ -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);
*/
}

View file

@ -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`.

View file

@ -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 { }

View file

@ -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`.

View file

@ -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();
}

View file

@ -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)
}

View file

@ -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