未验证 提交 cb95e365 编写于 作者: M Manish Goregaokar 提交者: GitHub

Rollup merge of #88346 - spastorino:revert-type-of-a-let2, r=jackh726

Revert "Add type of a let tait test impl trait straight in let"

This reverts commit dbadab54.
This is not part of TAITs, so, if tested should probably be done
elsewhere.

r? ````@oli-obk````

This is similar to what I was commenting here https://github.com/rust-lang/rust/pull/88332#discussion_r695939901
These is not part of TAITs so should not live in type-alias-impl-trait test directory.
I'm going to avoid adding this kind of tests in `type-alias-impl-trait` test directory and avoid thinking about them in this pass.
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
// FIXME This should be under a feature flag
use std::fmt::Debug;
fn foo1() -> u32 {
let x: impl Debug = 22_u32;
//~^ ERROR: `impl Trait` not allowed outside of function and method return types [E0562]
x // ERROR: we only know x: Debug, we don't know x = u32
}
fn foo2() -> u32 {
let x: impl Debug = 22_u32;
//~^ ERROR: `impl Trait` not allowed outside of function and method return types [E0562]
let y: impl Debug = x;
//~^ ERROR: `impl Trait` not allowed outside of function and method return types [E0562]
same_type((x, y)); // ERROR
x
}
fn same_type<T>(x: (T, T)) {}
fn main() {}
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/type_of_a_let2.rs:9:12
|
LL | let x: impl Debug = 22_u32;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/type_of_a_let2.rs:15:12
|
LL | let x: impl Debug = 22_u32;
| ^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and method return types
--> $DIR/type_of_a_let2.rs:17:12
|
LL | let y: impl Debug = x;
| ^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0562`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册