Skip to content

ICE with using a trait as a type alias #4016

Closed
@erickt

Description

@erickt

@graydon's workcache.rs file was trying to use a trait to make a type alias, which triggers an ICE:

extern mod std;

use send_map::linear;
use std::json;
use std::serialization::{Deserializable, deserialize};

trait JD : Deserializable<json::Deserializer> { }
//type JD = Deserializable<json::Deserializer>;

fn exec<T: JD>() {
    let doc = result::unwrap(json::from_str(""));
    let _v: T = deserialize(&json::Deserializer(move doc));
    fail
}

fn main() {}

It errors with:

error: internal compiler error: substitution a had opt_region &static and b had opt_region none with variance Some(rv_invariant)

If you use a proper type type alias, it compiles fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions