query cycle: specialisation `cycle detected when building specialization graph of trait`
Open
Nobody has claimed this yet.
A-diagnostics
F-specialization
I-cycle
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#![feature(specialization)]
trait Trait<T> {
type Assoc;
}
impl<T> Trait<T> for Vec<T> {}
impl Trait<u8> for Vec<u32> {
type Assoc = u8;
}
impl<T> Trait<T> for String {
type Assoc = ();
}
impl Trait<<Vec<u8> as Trait<u8>>::Assoc> for String {}
fn main() {}
Current output
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> 43273EB829A15349E16F5931020795BF70C210EEDA25D591DFCCF621A1677EA0.rs:1:12
|
1 | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
error[E0391]: cycle detected when building specialization graph of trait `Trait`
--> 43273EB829A15349E16F5931020795BF70C210EEDA25D591DFCCF621A1677EA0.rs:3:1
|
3 | trait Trait<T> {
| ^^^^^^^^^^^^^^
|
= note: ...which immediately requires building specialization graph of trait `Trait` again
note: cycle used when coherence checking all impls of trait `Trait`
--> 43273EB829A15349E16F5931020795BF70C210EEDA25D591DFCCF621A1677EA0.rs:3:1
|
3 | trait Trait<T> {
| ^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0391`.
Desired output
We should have a proper diagnostic here pointing out where the cyclic problem is
Rationale and extra context
cc https://github.com/rust-lang/rust/issues/119321
Other cases
No response
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the Rust reproducer with specialization enabled and compare the current E0391 output with the requested diagnostic. Review the related issue #119321 for context; done means the cycle is reported with a proper explanation of where the cyclic problem occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100