Skip to content

Only 'static is permitted within type bounds (causes ICE: Cannot relate bound region) #5121

Closed
@nikomatsakis

Description

@nikomatsakis

Once we can declare lifetime parameters, there is no reason not to permit them in type bounds. Also, I am not entirely sure if the way we are handling them is correct/sound. I've tagged places where such bounds appear with FIXMEs so that I can look into them later.


Example:

trait Iterable<'a> {
    fn my_iter(&'a self);
}

fn foo<'a, C: Iterable<'a>>(c: C) {
    c.my_iter();
}

fn main() { }
5121.rs:6:5: 6:6 error: internal compiler error: Cannot relate bound region: ReLateBound(12, BrNamed(syntax::ast::DefId{crate: 0u32, node: 21u32}, a)) <= ReInfer(1)
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
5121.rs:6     c.my_iter();
              ^
task 'rustc' failed at 'explicit failure', /home/huon/rust/src/libsyntax/diagnostic.rs:41
task '<main>' failed at 'explicit failure', /home/huon/rust/src/librustc/lib.rs:440

pnkfelix: I am adding a checklist to the bottom of this bug, where the unchecked issues represent problems that still remain unfixed (and the entire list of issues were closed as duplicates of this ticket).

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions