Skip to content

internal compiler error: coherence failed to report ambiguity #24037

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
dugusword opened this issue Apr 4, 2015 · 2 comments · Fixed by #24056
Closed

internal compiler error: coherence failed to report ambiguity #24037

dugusword opened this issue Apr 4, 2015 · 2 comments · Fixed by #24056
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dugusword
Copy link

I encountered this error while building "router" crate.

/Users/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/router-0.0.9/src/router.rs:158:1: 158:45 error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait core::marker::MarkerTrait for the type iron::middleware::Handler
/Users/biye/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/router-0.0.9/src/router.rs:158 impl Key for Router { type Value = Params; }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:130

stack backtrace:
1: 0x1090eddf7 - sys::backtrace::write::hcdd8cf990b8f0f0e1LC
2: 0x10911bccd - panicking::on_panic::hbbf8c269bccad920HAI
3: 0x10904015e - rt::unwind::begin_unwind_inner::h2f66a36e4dcc3e43iiI
4: 0x1088174ee - rt::unwind::begin_unwind::h4366604798127356786
5: 0x10881749b - diagnostic::SpanHandler::span_bug::h0e21e2a54cd366dbjnB
6: 0x1062d2666 - middle::traits::error_reporting::report_fulfillment_error::h24e2f9dcf11073a7hTN
7: 0x10613ede1 - middle::traits::error_reporting::report_fulfillment_errors::he23632a94223023axSN
8: 0x10567f7c2 - check::vtable::select_all_fcx_obligations_or_error::hded438f3b654ae6bX1b
9: 0x10570b76e - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_item_well_formed::h50d40da11e7554f3mWk
10: 0x105714261 - visit::walk_item::h17483634980229280695
11: 0x105814569 - check_crate::closure.36302
12: 0x10580ea37 - check_crate::hf2047274e19fe4f4bwC
13: 0x10552c2d5 - driver::phase_3_run_analysis_passes::h7ac32f1d1ca0be7dgGa
14: 0x105510a05 - driver::compile_input::haed712778d66caf6Qba
15: 0x1055ce985 - run_compiler::h2df8296b9f7c362fV4b
16: 0x1055cc152 - boxed::F.FnBox::call_box::h8968837061369711197
17: 0x1055cb647 - rt::unwind::try::try_fn::h5695919628988619761
18: 0x1091a5d28 - rust_try_inner
19: 0x1091a5d15 - rust_try
20: 0x1055cb93a - boxed::F.FnBox::call_box::h17367168855684310088
21: 0x1091051fd - sys::thread::create::thread_start::he0d7c708bf73803bihH
22: 0x7fff8c0a2267 - _pthread_body
23: 0x7fff8c0a21e4 - _pthread_start

@gsingh93
Copy link
Contributor

gsingh93 commented Apr 4, 2015

Possible duplicate: #23853

@paulosuzart
Copy link

+1

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Apr 6, 2015
`Trait`, prefer the object. Also give a nice error for attempts to
manually `impl Trait for Trait`, since they will be ineffectual.

Fixes rust-lang#24015.

Fixes rust-lang#24051.
Fixes rust-lang#24037.
Fixes rust-lang#23853.
Fixes rust-lang#21942.
cc rust-lang#21756.
bors added a commit that referenced this issue Apr 6, 2015
If we find a blanket impl for `Trait` but we're matching on an object `Trait`, prefer the object (I think we could perhaps go either way, but this seems safer). Also give a nice error for attempts to manually `impl Trait for Trait`, since they will be ineffectual.

This fixes the problems around ambiguity ICEs relating to `Any` and `MarkerTrait` that were cropping up all over the place. There may still be similar ICEs reported in #21756 that this PR does not address.

Fixes #24015.

Fixes #24051.
Fixes #24037.
Fixes #23853.
Fixes #21942.
cc #21756.

cc @alexcrichton (this fixes crates.io)
r? @aturon
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants