`const Destruct` check ignores lifetimes
Open
Nobody has claimed this yet.
A-destructors
A-lifetimes
C-bug
F-const_trait_impl
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
#![feature(const_trait_impl, const_destruct)]
use std::marker::Destruct;
pub trait Trait {
type Assoc<'a>;
}
pub const fn foo<'a, 'b, T: Trait<Assoc<'a>: [const] Destruct>>(_x: T::Assoc<'b>) {}
The above code compiles without errors. However, I think it shouldn't compile. We've only specified that T::Assoc<'a> can have its destructor ran in const. We didn't specify the same for T::Assoc<'b>.
Meta
Reproducible on the playground with version 1.97.0-nightly (2026-05-17 507271bc119683008ec7)
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 with the provided Rust reproducer on the Rust Playground using nightly 1.97.0 (2026-05-17). Trace the const Destruct bound handling for the differing 'a and 'b lifetimes; done means the example is rejected because the bound only covers T::Assoc<'a>.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100