Skip to content

Commit

Permalink
add revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Feb 8, 2024
1 parent 31954b0 commit 9af8dff
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: can't compare `i32` with `Foo`
--> $DIR/self-referential-2.rs:6:13
--> $DIR/self-referential-2.rs:9:13
|
LL | fn bar() -> Bar {
| ^^^ no implementation for `i32 == Foo`
Expand Down
5 changes: 4 additions & 1 deletion tests/ui/type-alias-impl-trait/self-referential-2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// revisions: current next
//[next] compile-flags: -Znext-solver
//[next] check-pass
#![feature(type_alias_impl_trait)]

type Foo = impl std::fmt::Debug;
type Bar = impl PartialEq<Foo>;

fn bar() -> Bar {
42_i32 //~^ ERROR can't compare `i32` with `Foo`
42_i32 //[current]~^ ERROR can't compare `i32` with `Foo`
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0284]: type annotations needed: cannot satisfy `Foo == _`
--> $DIR/type-alias-impl-trait-tuple.rs:21:24
|
LL | Blah { my_foo: make_foo(), my_u8: 12 }
| ^^^^^^^^^^ cannot satisfy `Foo == _`

error[E0282]: type annotations needed
--> $DIR/type-alias-impl-trait-tuple.rs:24:28
|
LL | fn into_inner(self) -> (Foo, u8, Foo) {
| ^^^^^^^^^^^^^^ cannot infer type for tuple `(Foo, u8, Foo)`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0282, E0284.
For more information about an error, try `rustc --explain E0282`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// revisions: current next
//[next] compile-flags: -Znext-solver
//[current] check-pass

#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
Expand All @@ -17,8 +19,10 @@ struct Blah {
impl Blah {
fn new() -> Blah {
Blah { my_foo: make_foo(), my_u8: 12 }
//[next]~^ ERROR type annotations needed: cannot satisfy `Foo == _`
}
fn into_inner(self) -> (Foo, u8, Foo) {
//[next]~^ ERROR type annotations needed
(self.my_foo, self.my_u8, make_foo())
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `x`
--> $DIR/type_of_a_let.rs:16:16
--> $DIR/type_of_a_let.rs:20:16
|
LL | let x: Foo = 22_u32;
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
Expand All @@ -9,7 +9,7 @@ LL | same_type((x, y));
| ^ value used here after move

error[E0382]: use of moved value: `y`
--> $DIR/type_of_a_let.rs:17:6
--> $DIR/type_of_a_let.rs:21:6
|
LL | let y: Foo = x;
| - move occurs because `y` has type `Foo`, which does not implement the `Copy` trait
Expand Down
8 changes: 6 additions & 2 deletions tests/ui/type-alias-impl-trait/type_of_a_let.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// revisions: current next
//[next] compile-flags: -Znext-solver
//[next] check-pass

#![feature(type_alias_impl_trait)]
#![allow(dead_code)]

Expand All @@ -13,8 +17,8 @@ fn foo1() -> (u32, Foo) {
fn foo2() -> (u32, Foo) {
let x: Foo = 22_u32;
let y: Foo = x;
same_type((x, y)); //~ ERROR use of moved value
(y, todo!()) //~ ERROR use of moved value
same_type((x, y)); //[current]~ ERROR use of moved value
(y, todo!()) //[current]~ ERROR use of moved value
}

fn same_type<T>(x: (T, T)) {}
Expand Down

0 comments on commit 9af8dff

Please sign in to comment.