-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(type_alias_impl_trait)]
pub type Foo = impl std::fmt::Debug;
pub const FOO: Foo = 5usize;
I expected to see this happen: successful compilation
Instead, this happened:
error[E0308]: mismatched types
--> src/lib.rs:4:22
|
3 | pub type Foo = impl std::fmt::Debug;
| -------------------- the expected opaque type
4 | pub const FOO: Foo = 5usize;
| ^^^^^^ expected opaque type, found `usize`
|
= note: expected opaque type `impl Debug`
found type `usize`
error: could not find defining uses
--> src/lib.rs:3:16
|
3 | pub type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
Meta
1.49.0-nightly (2020-10-12 8dae8cdcc8fa879cea6a)
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Type
Projects
Status
Done