Skip to content

'static bound not enforced in borrowed trait coercion #10751

Closed
@mitsuhiko

Description

@mitsuhiko

Current bug report

I would not expect this program to compile:

trait A {}                 
impl<T: 'static> A for T {}

fn main() {                
    let a = 3;             
    let b = &a;            
    let c = &b as &A;      
}                          

Original Bug Report

fn main() {
    let x = 42;
    let ref_x = &x;

    let any_x : &Any = &ref_x as &Any;
    println!("{:?}", any_x);
}

Results in

error: internal compiler error: non-static region found when hashing a type
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
task 'rustc' failed at 'explicit failure', /Users/mitsuhiko/Development/rust/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /Users/mitsuhiko/Development/rust/src/librustc/lib.rs:396

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions