-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-explicit_tail_calls`#![feature(explicit_tail_calls)]``#![feature(explicit_tail_calls)]`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-lowLow priorityLow priorityrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(explicit_tail_calls)]
fn link(x: &str) -> &'static str {
become passthrough(x);
}
fn passthrough<T>(t: T) -> T { t }
fn main() {
let x = String::from("hello, world");
let s = link(&x);
drop(x);
println!("{s}");
}
I expected to see a borrowck error.
Instead, it compiles which is unsound and causes a segfault.
rustc --version --verbose
: nightly 2025-08-04
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-explicit_tail_calls`#![feature(explicit_tail_calls)]``#![feature(explicit_tail_calls)]`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-lowLow priorityLow priorityrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.