Open
Description
Given the following code:
#![feature(type_alias_impl_trait)]
type Pointer<T> = impl std::ops::Deref<Target=T>;
fn test() -> Pointer<_> {
//~^ ERROR: the placeholder `_` is not allowed within types
Box::new(1)
}
fn main() {
test();
}
The current output is:
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> src/main.rs:5:22
|
5 | fn test() -> Pointer<_> {
| --------^-
| | |
| | not allowed in type signatures
| help: replace with the correct return type: `Pointer<i32>`
For more information about this error, try `rustc --explain E0121`.
Applying this gives us
#![feature(type_alias_impl_trait)]
type Pointer<T> = impl std::ops::Deref<Target=T>;
fn test() -> Pointer<i32> {
//~^ ERROR: the placeholder `_` is not allowed within types
Box::new(1)
}
fn main() {
test();
}
Which has a even more vague description and no error index to look up details :/
error: non-defining opaque type use in defining scope
--> src/main.rs:7:5
|
7 | Box::new(1)
| ^^^^^^^^^^^
|
note: used non-generic type `i32` for generic parameter
--> src/main.rs:3:14
|
3 | type Pointer<T> = impl std::ops::Deref<Target=T>;
| ^
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Can do after stabilization