Repository navigation
Open
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
The current alias liveness code find the parameters that must be considered live given all the bounds. For cases where there are multiple bounds but not set of parameters that outlive all, I incorrectly thought that "nothing can be captured". This is (now very obviously) wrong.
Code
use std::fmt::Debug;
trait Tr {
type Assoc: Debug;
fn get(self) -> Self::Assoc;
}
impl<'q> Tr for &'q u8 {
type Assoc = &'q u8;
fn get(self) -> &'q u8 {
self
}
}
fn make<'a, 'b, T: Tr>(t: T) -> impl Debug + 'a + 'b
where
T::Assoc: 'a + 'b,
{
t.get()
}
fn show<T: Debug>(t: T, r: &Vec<u8>) {
println!("escaped = {t:?}, reused = {r:?}");
}
fn main() {
let escaped;
{
let v: Vec<u8> = vec![42];
escaped = make(&v[0]);
//~^ ERROR `v` does not live long enough
}
let reused: Vec<u8> = vec![7];
show(escaped, &reused);
}Version with regression
Regression from #156027, with both NLL and Polonius Alpha. It has made it to stable 1.99.
Reacted by Max and teor
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Projects
- StatusShow more project fieldsopen/unblocked
Activity
jackh726 commentedon Oct 6, 2026
Disclosure: An LLM found this test
rustbot commentedon Oct 6, 2026
Assigning P-high (discussion on Zulip).
cuviper commentedon Oct 12, 2026
@jackh726 Does this warrant a revert for stable, since there's no fix yet?
(edit: a direct naive revert has lots of conflicts though)
I am currently gathering 1.99.1, but I'm not sure what (if anything) to do for this issue.
Rollup merge of rust-lang#164168 - jackh726:alias-liveness-unsoundnes…
Rollup merge of rust-lang#164168 - jackh726:alias-liveness-unsoundnes…
Rollup merge of rust-lang#164168 - jackh726:alias-liveness-unsoundnes…
Don't test a type argument for alias liveness
Rollup merge of rust-lang#164168 - jackh726:alias-liveness-unsoundnes…
Unrolled build for #164168 in rollup 165023
Rollup merge of #164168 - jackh726:alias-liveness-unsoundness-tests, …