Skip to content
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

Compiler ICE when compiling iron/router; coherence failed to report ambiguity #24051

Closed
mihneadb opened this issue Apr 4, 2015 · 1 comment · Fixed by #24056
Closed

Compiler ICE when compiling iron/router; coherence failed to report ambiguity #24051

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

Comments

@mihneadb
Copy link
Contributor

mihneadb commented Apr 4, 2015

Trying to compile the code of iron/router with a suggested change to make it build against latest nightly causes an ICE.

I tried this code:

Cloned the iron/router repo and changed this line to extern crate route_recognizer as recognizer; because the compiler was complaining about "route-recognizer".

I expected to see this happen: lib compiling.

Instead, this happened:

   Compiling router v0.0.9 (file:///home/mihnea/localCode/rust/router)
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`
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<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:130

Meta

rustc --version --verbose:

rustc 1.0.0-nightly (d17d6e7f1 2015-04-02) (built 2015-04-03)
binary: rustc
commit-hash: d17d6e7f1f05fbdd4d9d246400ffebf768878c7a
commit-date: 2015-04-02
build-date: 2015-04-03
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

Backtrace:

9:25:28 mihnea@Dsktp router master ? RUST_BACKTRACE=1 cargo build                                                                   101 ↵
   Compiling router v0.0.9 (file:///home/mihnea/localCode/rust/router)
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`
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<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:130

stack backtrace:
   1:     0x7f44255df3b8 - sys::backtrace::write::he4dda5a986f8dfc9IJC
   2:     0x7f442560a760 - panicking::on_panic::h5b2db6d96c6af729sXI
   3:     0x7f4425542493 - rt::unwind::begin_unwind_inner::h312dab2a9cc03afbACI
   4:     0x7f44228e705d - rt::unwind::begin_unwind::h8552855983279226119
   5:     0x7f44228e7003 - diagnostic::SpanHandler::span_bug::h047bbb0d01e0a28bjnB
   6:     0x7f44234aecad - middle::traits::error_reporting::report_fulfillment_error::h6f5315d3a072ec31hTN
   7:     0x7f442332c781 - middle::traits::error_reporting::report_fulfillment_errors::hd6f038665085589bxSN
   8:     0x7f442422566c - check::vtable::select_all_fcx_obligations_or_error::h503b6970fbb9a23eX1b
   9:     0x7f44242af449 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_item_well_formed::h7fc6515377d7730bmWk
  10:     0x7f44242b7d32 - visit::walk_item::h11327894352272839766
  11:     0x7f44243b29d9 - check_crate::closure.36300
  12:     0x7f44243ace13 - check_crate::ha6e679122aa8dfb5bwC
  13:     0x7f4425c5f5cd - driver::phase_3_run_analysis_passes::h001143095bbfc525gGa
  14:     0x7f4425c43425 - driver::compile_input::h982ca27ddfea1322Qba
  15:     0x7f4425cfa9d5 - run_compiler::h46e3b1adb4d7a56fV4b
  16:     0x7f4425cf82ed - boxed::F.FnBox<A>::call_box::h10231365352816203841
  17:     0x7f4425cf7829 - rt::unwind::try::try_fn::h6438714248533661505
  18:     0x7f4425686c58 - rust_try_inner
  19:     0x7f4425686c45 - rust_try
  20:     0x7f4425cf7afb - boxed::F.FnBox<A>::call_box::h8924274584753923957
  21:     0x7f44255f5771 - sys::thread::create::thread_start::h1fdda6dc8c80280aExH
  22:     0x7f441f3c50a4 - start_thread
  23:     0x7f44251a5cfc - __clone
  24:                0x0 - <unknown>

Could not compile `router`.

To learn more, run the command again with --verbose.
@mihneadb
Copy link
Contributor Author

mihneadb commented Apr 4, 2015

Probably dupe of #24037 (and the chain of issues that follow) - please close if so.

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 4, 2015
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.

2 participants