Add additional test

This commit is contained in:
Michael Goulet 2023-07-13 16:24:04 +00:00
parent 7db5f81853
commit 6875589924
2 changed files with 35 additions and 0 deletions

View File

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

View File

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