Skip to content

Commit 45f5b4e

Browse files
authored
Rollup merge of rust-lang#88349 - spastorino:const-static-types-tait-test, r=oli-obk
Add const and static TAIT tests r? `````@oli-obk````` Related to rust-lang#86727
2 parents 3830827 + 4fcae2c commit 45f5b4e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(type_alias_impl_trait)]
2+
#![allow(dead_code)]
3+
4+
// FIXME: This should compile, but it currently doesn't
5+
6+
use std::fmt::Debug;
7+
8+
type Foo = impl Debug;
9+
//~^ ERROR: could not find defining uses
10+
11+
static FOO1: Foo = 22_u32;
12+
//~^ ERROR: mismatched types [E0308]
13+
const FOO2: Foo = 22_u32;
14+
//~^ ERROR: mismatched types [E0308]
15+
16+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/static-const-types.rs:11:20
3+
|
4+
LL | type Foo = impl Debug;
5+
| ---------- the expected opaque type
6+
...
7+
LL | static FOO1: Foo = 22_u32;
8+
| ^^^^^^ expected opaque type, found `u32`
9+
|
10+
= note: expected opaque type `impl Debug`
11+
found type `u32`
12+
13+
error[E0308]: mismatched types
14+
--> $DIR/static-const-types.rs:13:19
15+
|
16+
LL | type Foo = impl Debug;
17+
| ---------- the expected opaque type
18+
...
19+
LL | const FOO2: Foo = 22_u32;
20+
| ^^^^^^ expected opaque type, found `u32`
21+
|
22+
= note: expected opaque type `impl Debug`
23+
found type `u32`
24+
25+
error: could not find defining uses
26+
--> $DIR/static-const-types.rs:8:12
27+
|
28+
LL | type Foo = impl Debug;
29+
| ^^^^^^^^^^
30+
31+
error: aborting due to 3 previous errors
32+
33+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)