-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationI-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 priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In a.rs
#![crate_type = "lib"]
pub struct X(pub u8);
impl Drop for X {
fn drop(&mut self) {
println!("{}", self.0);
}
}
pub fn f(x: &mut X, g: fn()) {
x.0 = 1;
g();
x.0 = 0;
}
In b.rs
extern crate a;
fn main() {
a::f(&mut a::X(0), g);
}
fn g() {
panic!();
}
$ rustc -O a.rs && rustc -L . b.rs && ./b
thread '<main>' panicked at 'explicit panic', b.rs:8
0
$ rustc a.rs && rustc -L . b.rs && ./b
thread '<main>' panicked at 'explicit panic', b.rs:8
1
$ rustc -V
rustc 1.6.0-nightly (2e07996a9 2015-10-29)
NB: Some pre-1.0 nightlies already behaved this way.
schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationI-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 priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.