-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutC-bugCategory: This is a bug.Category: This is a bug.F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.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(trait_alias)]
trait Foo {
type Assoc;
}
trait Alias = Foo<Assoc = fn(&())>;
type Dyn = dyn Alias<Assoc = fn(&())>;
I expected to see this happen: It compiles, just as it would if fn(&())
were replaced with i32
Instead, this happened:
error: conflicting associated type bounds for `Assoc` when expanding trait alias
--> src/lib.rs:9:12
|
7 | trait Alias = Foo<Assoc = fn(&())>;
| --------------- `Assoc` is specified to be `for<'a> fn(&'a ())` here
8 |
9 | type Dyn = dyn Alias<Assoc = fn(&())>;
| ^^^^^^^^^^---------------^
| |
| `Assoc` is specified to be `for<'a> fn(&'a ())` here
AIUI this is a consequence of #136458?
@rustbot label T-types F-trait_alias A-dyn-trait A-associated-items requires-nightly
Meta
rustc --version --verbose
:
rustc 1.91.0-nightly (02c7b1a7a 2025-09-13)
binary: rustc
commit-hash: 02c7b1a7ac1d739663878030510508372e46f254
commit-date: 2025-09-13
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.1
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutC-bugCategory: This is a bug.Category: This is a bug.F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.