Closed
Description
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).
- ICE using trait lifetime in a method definition #10391
- Internal compiler error passing an iterator as a parameter. #10467
- Cannot relate bound region: ReInfer(53) <= ReLateBound(284, ... #10841
- ICE:
Cannot relate bound region
#10868 - ICE: Cannot relate bound region #11016
- ICE: Cannot relate bound region #11446
- ICE when trying to parameterize on ebml::writer::Encoder #11881
- ICE when compiling function w/ Iterator with lifetime constraint #12008
- ICE using struct MyStruct<'a, 'b> { x: &'a MyTrait<'b>,} #12851
- type parameter bounds can't use already defined lifetimes #5715
- Owned trait objects are erroneously permitted to contain references #11971
- ICE on trait method with type parameter bounded by trait with lifetime parameter #12856
- lifetime variables in type bounds not properly enforced #12857