Skip to content

local_crate ICE #2804

Closed
Closed
@jesse99

Description

@jesse99

When trying to compile the code below I get the following with a rust from June 30:

bugs: rustc ice.rs
rust: task failed at 'Assertion did.crate != ast::local_crate failed', /Users/jessejones/Source/Third_Party/rust/src/rustc/middle/ty.rs:2736
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=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/jessejones/Source/Third_Party/rust/src/rustc/driver/rustc.rs:258
rust: domain main @0x7fb5d2000010 root task failed
rust: task failed at 'killed', /Users/jessejones/Source/Third_Party/rust/src/libcore/task.rs:461

Here is the code:


// rustc ice.rs
use std;
import io;
import io::writer_util;
import std::map::hashmap;

enum object
{
    bool_value(bool),
    int_value(i64),
}

fn lookup(table: std::map::hashmap<str, std::json::json>, key: str, default: str) -> str
{
    alt table.find(key)
    {
        option::some(std::json::string(s))
        {
            *s
        }
        option::some(value)
        {
            #error["%s was expected to be a string but is a %?", key, value];
            default
        }
        option::none
        {
            default
        }
    }
}

fn add_interface(store: int, managed_ip: str, data: std::json::json) -> (str, object)
{
    alt data
    {
        std::json::dict(interface)
        {
            let name = lookup(interface, "ifDescr", "");
            let label = #fmt["%s-%s", managed_ip, name];

            (label, bool_value(false))
        }
        _
        {
            #error["Expected dict for %s interfaces but found %?", managed_ip, data];
            ("gnos:missing-interface", bool_value(true))
        }
    }
}

fn add_interfaces(store: int, managed_ip: str, device: std::map::hashmap<str, std::json::json>) -> [(str, object)]/~
{
    alt device["interfaces"]
    {
        std::json::list(interfaces)
        {
            vec::map(*interfaces)
            {|interface|
                add_interface(store, managed_ip, interface)
            }
        }
        _
        {
            #error["Expected list for %s interfaces but found %?", managed_ip, device["interfaces"]];
            []/~
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions