Closed
Description
Maybe the same as #16596 and #16747.
Source code:
trait T<A> {
fn g(&self) -> A;
}
fn f<'a, I>(i: &I) where I: T<&'a mut int> {
let m = i.g();
*m = 0;
}
fn main() {
}
The error was:
1.rs:7:5: 7:7 error: internal compiler error: cannot relate bound region: ReScope(39) <= ReLateBound(14, BrNamed(syntax::ast::DefId{krate: 0u32, node: 22u32}, 'a))
1.rs:7 *m = 0;
^~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/ast_util.rs:776
stack backtrace:
1: 0x110066445 - rt::backtrace::imp::write::h366f6266fdf568bdyGr
2: 0x110069613 - failure::on_fail::h88fe37ace38bcbfdrXr
3: 0x110337595 - unwind::begin_unwind_inner::hc299369ecba80250ufe
4: 0x10f77a1f2 - unwind::begin_unwind::h17187401900268386611
5: 0x10f77a185 - diagnostic::SpanHandler::span_bug::hc4d5b52f1c967bf6ivF
6: 0x10cc5f725 - driver::session::Session::span_bug::h6c43c41cfb84008e7wB
7: 0x10d132356 - middle::typeck::infer::region_inference::RegionVarBindings<'a>::make_subregion::hbae6a5613e0d55e7EF6
8: 0x10d007e5b - middle::typeck::infer::mk_subr::h9854397fb7f02758w9d
9: 0x10d026a81 - middle::typeck::check::regionck::mk_subregion_due_to_dereference::hdf6f4bab0d472a51DTP
10: 0x10d0221e0 - middle::typeck::check::regionck::visit_expr::hce1244a40687f286B7O
11: 0x10d02125f - middle::typeck::check::regionck::visit_expr::hce1244a40687f286B7O
12: 0x10d022a72 - visit::walk_block::h6598311206806335563
13: 0x10d0674d1 - middle::typeck::check::check_bare_fn::h7d7d7a86e1f5fb72bKT
14: 0x10d06081b - middle::typeck::check::check_item::hd6ce68bf432b2469jjU
15: 0x10d06721d - middle::typeck::check::check_item_types::hfd2f317b573de5d4sJT
16: 0x10ca89756 - util::common::time::h4891267822068557826
17: 0x10d26600c - middle::typeck::check_crate::h427d4b7c37231ac1Knl
18: 0x10d332120 - driver::driver::phase_3_run_analysis_passes::h698aabf657364e2bRYz
19: 0x10d32d113 - driver::driver::compile_input::h5705b3057d4cce45XKz
20: 0x10d3d5d82 - driver::run_compiler::h2e65061b94ee7affRiD
21: 0x10d3d4466 - driver::main_args::closure.137815
22: 0x10d3e65bb - task::TaskBuilder<S>::try_future::closure.138935
23: 0x10d3e64c5 - task::TaskBuilder<S>::spawn_internal::closure.138912
24: 0x10f68e77c - task::spawn_opts::closure.8437
25: 0x11039e1ec - rust_try_inner
26: 0x11039e1d6 - rust_try
27: 0x11033496b - unwind::try::h0f8db981bd8a4067K3d
28: 0x11033470b - task::Task::run::h138ea3fe382973ecBad
29: 0x10f68e5da - task::spawn_opts::closure.8382
30: 0x110336526 - thread::thread_start::hdebd29a0977e0f01nzd
31: 0x7fff93089899 - _pthread_body
32: 0x7fff9308972a - _pthread_struct_init
Whereas the equivalent (?) program:
trait T<A> {
fn g(&self) -> A;
}
fn f<'a, I: T<&'a mut int>>(i: &I) {
let m = i.g();
*m = 0;
}
fn main() {
}
compiled successfully.
$ rustc -v
rustc 0.12.0-pre-nightly (711d71027 2014-08-22 00:56:00 +0000)