Closed
Description
I was trying to figure out how to implement PartialEq
by using referential equality (still not sure how that goes). The code I wrote looks like this:
impl<'a> PartialEq for StatusBar<'a> {
fn eq(&self, other: &StatusBar<'a>) -> bool {
let p1: *const Self = self;
let p2: *const i32 = &other;
true
}
}
The code in the context of the project can be found here (trying to do a cargo build at that commit should yield the same results as I got).
I'm not sure what I expected to happen. I didn't necessarily expect it to work; I was just trying stuff out to see what the compiler said. I was attempting to follow the example here to get a pointer from a value.
Meta
rustc --version --verbose
:
rustc 1.0.0-beta.4 (850151a75 2015-04-30) (built 2015-04-30)
binary: rustc
commit-hash: 850151a75709f146addd30bbbf1f23d384f0b381
commit-date: 2015-04-30
build-date: 2015-04-30
host: x86_64-apple-darwin
release: 1.0.0-beta.4
Backtrace:
Fresh libc v0.1.6
Fresh rope v0.0.0 (https://github.com/SSheldon/rust-rope#112f9cae)
Fresh ncurses v5.73.0 (https://github.com/jeaye/ncurses-rs#6604cfc0)
Compiling ebitor v0.1.0 (file:///Users/benekastah/dev/ebitor)
Running `rustc src/main.rs --crate-name ebitor --crate-type bin -g --out-dir /Users/benekastah/dev/ebitor/target/debug --emit=dep-info,link -L dependency=/Users/benekastah/dev/ebitor/target/debug -L dependency=/Users/benekastah/dev/ebitor/target/debug/deps --extern ncurses=/Users/benekastah/dev/ebitor/target/debug/deps/libncurses-8e30185888061fc5.rlib --extern rope=/Users/benekastah/dev/ebitor/target/debug/deps/librope-94235f124fc5c080.rlib`
src/editor.rs:109:31: 109:35 error: internal compiler error: cannot relate bound region: ReEarlyBound(562, TypeSpace, 0, 'a) <= ReFree(DestructionScopeData { node_id: 546 }, BrNamed(DefId { krate: 0, node: 562 }, 'a))
src/editor.rs:109 let p1: *const Self = self;
^~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:149
stack backtrace:
1: 0x10705233f - sys::backtrace::write::h0f2fc53eb11eb814gWr
2: 0x10705a942 - panicking::on_panic::hd617a4042e8486fciUv
3: 0x107017375 - rt::unwind::begin_unwind_inner::hd84dfec22ac3667d1Bv
4: 0x1067f141e - rt::unwind::begin_unwind::h17402473262222227889
5: 0x1067f13aa - diagnostic::SpanHandler::span_bug::hcc4fbb6ab7b33620EqB
6: 0x1046b600b - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h63ab9a4a128f69c5tiv
7: 0x10466d1eb - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::regions::h56c888da7b43944dAux
8: 0x10466cfd1 - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::relate_with_variance::h14341298437393653231
9: 0x10466c54b - middle::ty_relate::relate_substs::h10478772626253278636
10: 0x10466bb3a - middle::ty_relate::relate_item_substs::h1962531610498164770
11: 0x1046cc924 - middle::ty_relate::super_relate_tys::h10118851298262005972
12: 0x1046643f2 - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::tys::h6eaac9ae44640379dqx
13: 0x10466481d - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::relate_with_variance::h13282577528495974067
14: 0x1046cce1f - middle::ty_relate::super_relate_tys::h10118851298262005972
15: 0x1046643f2 - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::tys::h6eaac9ae44640379dqx
16: 0x1046d1427 - middle::infer::InferCtxt<'a, 'tcx>::sub_types::h0b7ff7685f1805acXjz
17: 0x103cea7c4 - check::coercion::mk_assignty::hc434da205a5f1e38Ztf
18: 0x103ceed3d - check::demand::coerce::h5a966068774373e0mDf
19: 0x103d89d5e - check::check_expr_with_unifier::h12150491147357226885
20: 0x103db0d4b - check::check_decl_local::h92d1785d18142c27wJr
21: 0x103d5976a - check::check_block_with_expected::h844cc24296d38cbfCPr
22: 0x103d3ae98 - check::check_fn::he488d72de82de5609Bn
23: 0x103d54f55 - check::check_bare_fn::h1cab56f07a2fa15bIrn
24: 0x103d5de17 - check::check_method_body::ha9665720af994cefd3n
25: 0x103d52e9b - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::hbb0d2bb98771484fLon
26: 0x103d5320e - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::hbb0d2bb98771484fLon
27: 0x103e1ca5a - check_crate::closure.37936
28: 0x103e17e67 - check_crate::h4d03e35b8fa9ef5dc8B
29: 0x103b7e144 - driver::phase_3_run_analysis_passes::hd5d4ea6bf0a2e998nGa
30: 0x103b5ff1c - driver::compile_input::hd958766b5aa38359Qba
31: 0x103c27923 - run_compiler::h9bcb9536763d6c28z4b
32: 0x103c2544a - boxed::F.FnBox<A>::call_box::h2309050189455115330
33: 0x103c248e7 - rt::unwind::try::try_fn::h4927022999322665723
34: 0x1070db7c8 - rust_try_inner
35: 0x1070db7b5 - rust_try
36: 0x103c24bc0 - boxed::F.FnBox<A>::call_box::h5709674458622256774
37: 0x10705948d - sys::thread::create::thread_start::h499b3be451a7bbb8AZu
38: 0x7fff89997267 - _pthread_body
39: 0x7fff899971e4 - _pthread_start
Could not compile `ebitor`.
Caused by:
Process didn't exit successfully: `rustc src/main.rs --crate-name ebitor --crate-type bin -g --out-dir /Users/benekastah/dev/ebitor/target/debug --emit=dep-info,link -L dependency=/Users/benekastah/dev/ebitor/target/debug -L dependency=/Users/benekastah/dev/ebitor/target/debug/deps --extern ncurses=/Users/benekastah/dev/ebitor/target/debug/deps/libncurses-8e30185888061fc5.rlib --extern rope=/Users/benekastah/dev/ebitor/target/debug/deps/librope-94235f124fc5c080.rlib` (exit code: 101)