Closed
Description
This rust code fails in compilation without error message:
trait Trait {}
fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }
fn main() {
let t : &Trait = &get_function()();
}
When compiling with cargo build --verbose
I get:
Compiling errroom v0.1.0 (file:///home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom)
Running `rustc --crate-name errroom main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=23eb45247c97d4cd -C extra-filename=-23eb45247c97d4cd --out-dir /home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps -L dependency=/home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps`
warning: unused variable: `t`, #[warn(unused_variables)] on by default
--> main.rs:6:6
|
6 | let t : &Trait = &get_function()();
| ^
error: Could not compile `errroom`.
Caused by:
process didn't exit successfully: `rustc --crate-name errroom main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=23eb45247c97d4cd -C extra-filename=-23eb45247c97d4cd --out-dir /home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps -L dependency=/home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps` (exit code: 1)
rustc --version --verbose
:
rustc 1.16.0 (30cf806ef 2017-03-10)
binary: rustc
commit-hash: 30cf806ef8881c41821fbd43e5cf3699c5290c16
commit-date: 2017-03-10
host: x86_64-unknown-linux-gnu
release: 1.16.0
LLVM version: 3.9
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generationIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Relevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.