Skip to content

ICE when compiling function w/ Iterator with lifetime constraint #12008

Closed
@yuriks

Description

@yuriks

The code:

fn f<'a, T: Iterator<&'a int>>(arg_iter: &'a mut T) {
    arg_iter.next().unwrap().clone();
}

Produces an ICE when compiled (using rustc from master at time of writing):

yuriks@reinforce ~/rust-ice % rustc --lib main.rs
main.rs:2:5: 2:30 error: internal compiler error: Cannot relate bound region: ReScope(23) <= ReLateBound(3, BrNamed(syntax::ast::DefId{crate: 0u32, node: 17u32}, a))
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
main.rs:2     arg_iter.next().unwrap().clone();
              ^~~~~~~~~~~~~~~~~~~~~~~~~
101 yuriks@reinforce ~/rust-ice %

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions