Skip to content

Commit

Permalink
Add additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 18, 2023
1 parent 7db5f81 commit 6875589
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
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}");
}
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

0 comments on commit 6875589

Please sign in to comment.