Skip to content

Regression: Option<~str> in static struct => internal compiler error #8578

Closed
@stepancheg

Description

@stepancheg
pub struct UninterpretedOption_NamePart {
    name_part: Option<~str>,
}

impl<'self> UninterpretedOption_NamePart {
    pub fn default_instance() -> &'static UninterpretedOption_NamePart {
        static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart {
            name_part: None,
        };
        &'static instance
    }
}

fn main() {}

Compiler from master crashes with:

task <unnamed> failed at 'No enclosing scope for id 20', /Users/yozh/devel/rust-ide/rust/src/librustc/middle/region.rs:122
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /Users/yozh/devel/rust-ide/rust/src/librustc/rustc.rs:371

It is regression, code works in 0.7.

P. S. Compiler knows id of AST node, it could also report file and line number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions