forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#87606 - JohnTitor:tait-tests, r=oli-obk
Add some TAIT-related regression tests Closes rust-lang#74280, closes rust-lang#77179. r? ``@oli-obk``
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Regression test for #74280. | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
type Test = impl Copy; | ||
|
||
fn test() -> Test { | ||
let y = || -> Test { () }; | ||
//~^ ERROR: concrete type differs from previous defining opaque type use | ||
7 | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: concrete type differs from previous defining opaque type use | ||
--> $DIR/issue-74280.rs:8:13 | ||
| | ||
LL | let y = || -> Test { () }; | ||
| ^^^^^^^^^^^^^^^^^ expected `i32`, got `()` | ||
| | ||
note: previous use here | ||
--> $DIR/issue-74280.rs:7:1 | ||
| | ||
LL | fn test() -> Test { | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Regression test for #77179. | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
type Pointer<T> = impl std::ops::Deref<Target=T>; | ||
|
||
fn test() -> Pointer<_> { | ||
//~^ ERROR: the type placeholder `_` is not allowed within types | ||
Box::new(1) | ||
} | ||
|
||
fn main() { | ||
test(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types | ||
--> $DIR/issue-77179.rs:7:22 | ||
| | ||
LL | fn test() -> Pointer<_> { | ||
| --------^- | ||
| | | | ||
| | not allowed in type signatures | ||
| help: replace with the correct return type: `Box<i32>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0121`. |