-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Inherent associated types where the self type isn't an ADT (e.g. a trait object type or a primitive type like bool
or i32
) are currently not resolved successfully.
On Trait Object Types
I expected to see the following code compile successfully:
#![feature(inherent_associated_types)]
trait Tr {}
impl dyn Tr {
type Pr = ();
}
const _: <dyn Tr>::Pr = ();
Instead, the following error was emitted:
error[E0223]: ambiguous associated type
--> src/lib.rs:10:10
|
10 | const _: <dyn Tr>::Pr = ();
| ^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn Tr + 'static) as Trait>::Pr`
For comparison, the analogous code involving inherent associated constants works flawlessly.
On Primitive Types
I expected to see the following code compile successfully (#![no_core]
is representative for the core
crate)
#![feature(inherent_associated_types, no_core)]
#![allow(incomplete_features)]
#![no_core]
impl bool {
type Pr = ();
}
const _: bool::Pr = ();
Instead, the following error was emitted:
error[E0223]: ambiguous associated type
--> src/lib.rs:9:10
|
9 | const _: bool::Pr = ();
| ^^^^^^^^ help: use fully-qualified syntax: `<bool as Trait>::Pr`
I'd like to see #105961 merged first. Thus I consider this issue blocked for now.
@rustbot label T-compiler F-inherent_associated_types requires-nightly S-blocked
@rustbot claim
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Type
Projects
Status
Can Do