Skip to content

Bad error message when using a type that wasn't imported #876

Closed
@catamorphism

Description

@catamorphism

Compiling this program:

use std;
import std::vec::*;

 fn main() {
    let y;
    let x : char = last(y);
 }

yields a compiler internal error: 'get_id_ident: can't find item in ext_map'. The error arises when trying to print out a unification error (char doesn't unify with option::t<T>). However, because the program doesn't explicitly import option::t, and only the def_id for t (not the ident) is in the type in the crate metadata, the def_id for option_t doesn't map to anything in the ext_map.

The program works as expected (fails in typestate instead) if you replace char with option::t<char> (and add an import for std::option::*).

I'm not really sure what the solution is to this, other than changing the metadata format to include both the ident and the def_id for a ty_tag thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions