Skip to content

Compilation fails without error message #41139

Closed
@memoryleak47

Description

@memoryleak47

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

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions