Skip to content

Commit 41fbafa

Browse files
authored
Rollup merge of rust-lang#88332 - spastorino:argument-types-tait-test, r=oli-obk
Add argument types tait tests r? `@oli-obk` Related to rust-lang#86727
2 parents b6c5f72 + 4924e34 commit 41fbafa

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#![feature(type_alias_impl_trait)]
2+
#![allow(dead_code)]
3+
4+
use std::fmt::Debug;
5+
6+
type Foo = impl Debug;
7+
8+
// FIXME: This should compile, but it currently doesn't
9+
fn foo1(mut x: Foo) {
10+
x = 22_u32;
11+
//~^ ERROR: mismatched types [E0308]
12+
}
13+
14+
fn foo2(mut x: Foo) {
15+
// no constraint on x
16+
}
17+
18+
fn foo3(x: Foo) {
19+
println!("{:?}", x);
20+
}
21+
22+
fn foo_value() -> Foo {
23+
11_u32
24+
}
25+
26+
fn main() {
27+
foo3(foo_value());
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/argument-types.rs:10:9
3+
|
4+
LL | type Foo = impl Debug;
5+
| ---------- the expected opaque type
6+
...
7+
LL | x = 22_u32;
8+
| ^^^^^^ expected opaque type, found `u32`
9+
|
10+
= note: expected opaque type `impl Debug`
11+
found type `u32`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)