未验证 提交 3e1a15bb 编写于 作者: G Guillaume Gomez 提交者: GitHub

Rollup merge of #88349 - spastorino:const-static-types-tait-test, r=oli-obk

Add const and static TAIT tests

r? ``@oli-obk``

Related to #86727
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
// FIXME: This should compile, but it currently doesn't
use std::fmt::Debug;
type Foo = impl Debug;
//~^ ERROR: could not find defining uses
static FOO1: Foo = 22_u32;
//~^ ERROR: mismatched types [E0308]
const FOO2: Foo = 22_u32;
//~^ ERROR: mismatched types [E0308]
fn main() {}
error[E0308]: mismatched types
--> $DIR/static-const-types.rs:11:20
|
LL | type Foo = impl Debug;
| ---------- the expected opaque type
...
LL | static FOO1: Foo = 22_u32;
| ^^^^^^ expected opaque type, found `u32`
|
= note: expected opaque type `impl Debug`
found type `u32`
error[E0308]: mismatched types
--> $DIR/static-const-types.rs:13:19
|
LL | type Foo = impl Debug;
| ---------- the expected opaque type
...
LL | const FOO2: Foo = 22_u32;
| ^^^^^^ expected opaque type, found `u32`
|
= note: expected opaque type `impl Debug`
found type `u32`
error: could not find defining uses
--> $DIR/static-const-types.rs:8:12
|
LL | type Foo = impl Debug;
| ^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册