Skip to content

Commit 6875589

Browse files
Add additional test
1 parent 7db5f81 commit 6875589

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// issue: 113314
2+
3+
#![feature(type_alias_impl_trait)]
4+
5+
type Op = impl std::fmt::Display;
6+
fn foo() -> Op { &"hello world" }
7+
8+
fn transform<S>() -> impl std::fmt::Display {
9+
&0usize
10+
}
11+
fn bad() -> Op {
12+
transform::<Op>()
13+
//~^ ERROR concrete type differs from previous defining opaque type use
14+
}
15+
16+
fn main() {
17+
let mut x = foo();
18+
println!("{x}");
19+
x = bad();
20+
println!("{x}");
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: concrete type differs from previous defining opaque type use
2+
--> $DIR/recursive-tait-conflicting-defn-2.rs:12:5
3+
|
4+
LL | transform::<Op>()
5+
| ^^^^^^^^^^^^^^^^^ expected `&'static &'static str`, got `impl std::fmt::Display`
6+
|
7+
note: previous use here
8+
--> $DIR/recursive-tait-conflicting-defn-2.rs:6:18
9+
|
10+
LL | fn foo() -> Op { &"hello world" }
11+
| ^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)