Hang on TAIT with diverging projection in its ParamEnv
Open
Nobody has claimed this yet.
A-trait-system
C-bug
F-type_alias_impl_trait
fixed-by-next-solver
I-compilemem
I-hang
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
rustc file.rs
#![feature(type_alias_impl_trait)]
trait Id {
type Assoc;
}
impl<T> *const u8 {
type Assoc = T;
}
type Ty
where
Ty: Id<Assoc = Ty>,
= impl Sized;
fn define() -> Ty {}
fn main() {}
This file causes rustc to hang and is derived from mutant #109387. #109387 can terminate successfully.
Meta
rustc --version --verbose:
rustc 1.84.0-nightly (b91a3a056 2024-11-07)
binary: rustc
commit-hash: b91a3a05609a46f73d23e0995ae7ebb4a4f429a5
commit-date: 2024-11-07
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3
Compiler Output (before the hang)
error[E0658]: inherent associated types are unstable
--> file.rs:6:5
|
6 | type Assoc = T;
| ^^^^^^^^^^^^^^^
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
= note: this compiler was built on 2024-11-04; consider upgrading it if it is out of date
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
--> file.rs:5:6
|
5 | impl<T> *const u8 {
| ^ unconstrained type parameter
error[E0277]: the trait bound `Ty: Id` is not satisfied
--> file.rs:8:1
|
8 | type Ty
| ^^^^^^^ the trait `Id` is not implemented for `Ty`
|
help: this trait has no implementations, consider adding one
--> file.rs:2:1
|
2 | trait Id {
| ^^^^^^^^
note: required by a bound on the type alias `Ty`
--> file.rs:10:9
|
10 | Ty: Id<Assoc = Ty>,
| ^^^^^^^^^^^^^^ required by this bound
error[E0277]: the trait bound `Ty: Id` is not satisfied
--> file.rs:10:5
|
10 | Ty: Id<Assoc = Ty>,
| ^^^^^^^^^^^^^^^^^^ the trait `Id` is not implemented for `Ty`
|
help: this trait has no implementations, consider adding one
--> file.rs:2:1
|
2 | trait Id {
| ^^^^^^^^
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
2 + #![feature(trivial_bounds)]
|
error[E0277]: the trait bound `Ty: Id` is not satisfied
--> file.rs:11:3
|
11 | = impl Sized;
| ^^^^^^^^^^ the trait `Id` is not implemented for `Ty`
|
help: this trait has no implementations, consider adding one
--> file.rs:2:1
|
2 | trait Id {
| ^^^^^^^^
note: required by a bound on the type alias `Ty`
--> file.rs:10:9
|
10 | Ty: Id<Assoc = Ty>,
| ^^^^^^^^^^^^^^ required by this bound
error[E0277]: the trait bound `Ty: Id` is not satisfied
--> file.rs:12:16
|
12 | fn define() -> Ty {}
| ^^ the trait `Id` is not implemented for `Ty`
|
help: this trait has no implementations, consider adding one
--> file.rs:2:1
|
2 | trait Id {
| ^^^^^^^^
note: required by a bound on the type alias `Ty`
--> file.rs:10:9
|
10 | Ty: Id<Assoc = Ty>,
| ^^^^^^^^^^^^^^ required by this bound
error[E0277]: the trait bound `Ty: Id` is not satisfied
--> file.rs:12:19
|
12 | fn define() -> Ty {}
| ^^ the trait `Id` is not implemented for `Ty`
|
help: this trait has no implementations, consider adding one
--> file.rs:2:1
|
2 | trait Id {
| ^^^^^^^^
note: required by a bound on the type alias `Ty`
--> file.rs:10:9
|
10 | Ty: Id<Assoc = Ty>,
| ^^^^^^^^^^^^^^ required by this bound
error[E0390]: cannot define inherent `impl` for primitive types
--> file.rs:5:1
|
5 | impl<T> *const u8 {
| ^^^^^^^^^^^^^^^^^
|
= help: consider using an extension trait instead
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 supplied file.rs with the reported rustc nightly and confirm that the compiler hangs after the shown diagnostics. Compare the behavior with mutant #109387; done means this reproducer terminates instead of hanging, with the relevant compiler behavior covered by a regression test.
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
- 28/100