Skip to content

ICE when trying to access shared-access-boxed vector in iface impl #2926

Description

@iamtakingiteasy

For the following code:

import io::*;
import to_str::*;

impl <T : to_str copy> of to_str for @[mut T] {
    fn to_str() -> str {
        let tmp = copy self;
        tmp.map(|x| { x.to_str() }).to_str()
    }
}

fn main() {
    println((@[mut 1, 2, 3]).to_str());
}

rustc-0.3 produces an ICE:

example.rs:7:8: 7:11 error: internal compiler error: aliased ptr with a non-none lp
example.rs:7         tmp.map(|x| { x.to_str() }).to_str()
                     ^~~

This is not happens with unique boxes (~[mut 1,2,3]/for ~[mut T])

Also tested on git snapshot (rustc 0.3 (6081eb7 2012-07-15 05:41:24 -0700)) -- same thing, except i had to change str to ~str to make it not fail with error: bare 'str' is not a type

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regionsI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions