Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rust panics at typecheck ICE stable 1.34.1 and nightly 1.35.0 #60283

Closed
RustyYato opened this issue Apr 25, 2019 · 1 comment · Fixed by #60644
Closed

Rust panics at typecheck ICE stable 1.34.1 and nightly 1.35.0 #60283

RustyYato opened this issue Apr 25, 2019 · 1 comment · Fixed by #60644
Assignees
Labels
A-type-system Area: Type system C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RustyYato
Copy link
Contributor

possibly related to #60070, #52812, and #29997

pub trait Trait<'a> {
    type Item;
}

impl<'a> Trait<'a> for () {
    type Item= ();
}

pub fn foo<T, F>(_: T, _: F)
where T: for<'a> Trait<'a>,
      F: for<'a> FnMut(<T as Trait<'a>>::Item) {}

fn main() {
    foo((), drop)
}

stack trace

error: internal compiler error: src\librustc\traits\project.rs:1457: Failed to unify obligation `Obligation(predicate=ProjectionTy { substs: [fn(_) {std::mem::drop::<_>}, (<() as Trait<'a>>::Item,)], item_def_id: DefId(2/0:1000 ~ core[d10a]::ops[0]::function[0]::FnOnce[0]::Output[0]) },depth=0)` with poly_projection `Binder(ProjectionPredicate(ProjectionTy { substs: [fn(_) {std::mem::drop::<_>}, ((),)], item_def_id:DefId(2/0:1000 ~ core[d10a]::ops[0]::function[0]::FnOnce[0]::Output[0]) }, ()))`: Sorts(ExpectedFound { expected: (), found: <() as Trait<'a>>::Item })
  --> src\main.rs:14:5
   |
14 |     foo((), drop)
   |     ^^^

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:570:9
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: rustc::ty::structural_impls::<impl rustc::ty::context::Lift for rustc::ty::adjustment::AutoBorrow>::lift_to_tcx
   4: std::panicking::rust_panic_with_hook
   5: <rustc::ty::CrateInherentImpls as core::fmt::Debug>::fmt
   6: rustc::ty::structural_impls::<impl rustc::ty::context::Lift for rustc::mir::interpret::GlobalId>::lift_to_tcx
   7: rustc::util::bug::bug_fmt
   8: rustc::ty::trait_def::TraitDef::ancestors
   9: rustc::ty::trait_def::TraitDef::ancestors
  10: rustc::ty::trait_def::TraitDef::ancestors
  11: rustc::util::bug::bug_fmt
  12: rustc::util::bug::bug_fmt
  13: rustc::traits::project::normalize_projection_type
  14: rustc::traits::project::normalize_projection_type
  15: rustc::traits::project::normalize_projection_type
  16: rustc::traits::project::poly_project_and_unify_type
  17: rustc::infer::InferCtxt::commit_from
  18: rustc::ty::structural_impls::<impl rustc::ty::context::Lift for rustc::mir::interpret::GlobalId>::lift_to_tcx
  19: <rustc::traits::fulfill::FulfillmentContext as rustc::traits::engine::TraitEngine>::select_where_possible
  20: rustc_typeck::check::FnCtxt::field_ty
  21: rustc_typeck::check::FnCtxt::self_type_matches_expected_vid
  22: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  23: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  24: rustc_typeck::check::FnCtxt::check_struct_path
  25: rustc_typeck::check::FnCtxt::check_struct_path
  26: rustc_typeck::check::FnCtxt::check_block_no_value
  27: rustc_typeck::check::FnCtxt::check_struct_path
  28: rustc_typeck::check::FnCtxt::check_struct_path
  29: rustc_typeck::check::FnCtxt::impl_self_ty
  30: <rustc_typeck::check::GatherLocalsVisitor as rustc::hir::intravisit::Visitor>::visit_pat
  31: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  32: <rustc_typeck::check::CheckItemTypesVisitor as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item
  33: <rustc_typeck::variance::constraints::ConstraintContext as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  34: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  35: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  36: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  37: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  38: <rustc_typeck::check::CheckItemTypesVisitor as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item
  39: <rustc_typeck::variance::constraints::ConstraintContext as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  40: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  41: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  42: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  43: rustc_typeck::check_crate
  44: rustc_interface::passes::BoxedResolver::to_expansion_result
  45: rustc_driver::set_sigpipe_handler
  46: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  47: <env_logger::fmt::WriteStyle as core::default::Default>::default
  48: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  49: rustc_driver::set_sigpipe_handler
  50: rustc_driver::set_sigpipe_handler
  51: rustc_interface::interface::Compiler::output_file
  52: rustc_driver::set_sigpipe_handler
  53: <env_logger::fmt::WriteStyle as core::default::Default>::default
  54: rustc_driver::set_sigpipe_handler
  55: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  56: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  57: rustc_driver::set_sigpipe_handler
  58: _rust_maybe_catch_panic
  59: rustc_driver::set_sigpipe_handler
  60: <std::error::<impl core::convert::From<alloc::string::String> for alloc::boxed::Box<dyn +std::error::Error+core::marker::Send+core::marker::Sync>>::from::StringError as core::fmt::Display>::fmt
  61: std::sys::windows::thread::Thread::new
  62: BaseThreadInitThunk
  63: RtlUserThreadStart
query stack during panic:
#0 [typeck_tables_of] processing `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error


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: rustc 1.35.0-nightly (70f130954 2019-04-16) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-type-system Area: Type system labels Apr 25, 2019
@pnkfelix
Copy link
Member

pnkfelix commented May 2, 2019

triage: marking as P-high since its an ICE. Does not seem like there's much to discuss so removing the nomination tag.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels May 2, 2019
@estebank estebank self-assigned this May 8, 2019
Centril added a commit to Centril/rust that referenced this issue May 8, 2019
Use `delay_span_bug` for "Failed to unify obligation"

Fix rust-lang#60283.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants