-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7db5f81
commit 6875589
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
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,21 @@ | ||
// issue: 113314 | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
type Op = impl std::fmt::Display; | ||
fn foo() -> Op { &"hello world" } | ||
|
||
fn transform<S>() -> impl std::fmt::Display { | ||
&0usize | ||
} | ||
fn bad() -> Op { | ||
transform::<Op>() | ||
//~^ ERROR concrete type differs from previous defining opaque type use | ||
} | ||
|
||
fn main() { | ||
let mut x = foo(); | ||
println!("{x}"); | ||
x = bad(); | ||
println!("{x}"); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
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/recursive-tait-conflicting-defn-2.rs:12:5 | ||
| | ||
LL | transform::<Op>() | ||
| ^^^^^^^^^^^^^^^^^ expected `&'static &'static str`, got `impl std::fmt::Display` | ||
| | ||
note: previous use here | ||
--> $DIR/recursive-tait-conflicting-defn-2.rs:6:18 | ||
| | ||
LL | fn foo() -> Op { &"hello world" } | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|