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

error updating smallvec in rustc #61549

Closed
ehuss opened this issue Jun 5, 2019 · 10 comments
Closed

error updating smallvec in rustc #61549

ehuss opened this issue Jun 5, 2019 · 10 comments
Assignees
Labels
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

@ehuss
Copy link
Contributor

ehuss commented Jun 5, 2019

I'm trying to update rust-lang/rust to the latest smallvec (0.6.7 ➙ 0.6.9), and an running into an issue where rustc fails to compile:

error: internal compiler error: src/librustc/ty/relate.rs:773: impossible case reached: can't relate: '_#0r with Type(RustaceansAreAwesome)

I have narrowed down the change that breaks this to servo/rust-smallvec#137.

I don't know anything about smallvec and very little about rustc, so if anyone can help figure out what's wrong, I'd appreciate it. I'll keep digging a little, but it is unlikely that I'll be able to do more. This can be reproduced with cargo update -p smallvec; ./x.py build (on master, acda261).

backtrace
thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:637:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.25/src/backtrace/libunwind.rs:97
   1: backtrace::backtrace::trace_unsynchronized
             at /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.25/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:197
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   6:  as core::ops::function::Fn>::call
             at ./src/liballoc/boxed.rs:760
   7: rustc::util::common::panic_hook
             at src/librustc/util/common.rs:40
   8: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   9: std::panicking::begin_panic
             at ./src/libstd/panicking.rs:408
  10: rustc_errors::Handler::bug
             at src/librustc_errors/lib.rs:637
  11: rustc::util::bug::opt_span_bug_fmt::{{closure}}
             at src/librustc/util/bug.rs:36
  12: rustc::ty::context::tls::with_opt::{{closure}}
             at src/librustc/ty/context.rs:2079
  13: rustc::ty::context::tls::with_context_opt
             at src/librustc/ty/context.rs:2014
  14: rustc::ty::context::tls::with_opt
             at src/librustc/ty/context.rs:2079
  15: rustc::util::bug::opt_span_bug_fmt
             at src/librustc/util/bug.rs:32
  16: rustc::util::bug::bug_fmt
             at src/librustc/util/bug.rs:12
  17: ::relate
             at src/librustc/ty/relate.rs:773
  18: rustc::ty::relate::TypeRelation::relate
             at src/librustc/ty/relate.rs:43
  19: ::relate_with_variance
             at src/librustc/infer/sub.rs:59
  20: rustc::ty::relate::relate_substs::{{closure}}
             at src/librustc/ty/relate.rs:141
  21: core::ops::function::impls:: for &mut F>::call_once
             at ./src/libcore/ops/function.rs:279
  22: core::option::Option::map
             at ./src/libcore/option.rs:416
  23:  as core::iter::traits::iterator::Iterator>::next
             at ./src/libcore/iter/adapters/mod.rs:570
  24: < as core::iter::traits::collect::FromIterator>>::from_iter::Adapter as core::iter::traits::iterator::Iterator>::next
             at ./src/libcore/result.rs:1250
  25: <&mut I as core::iter::traits::iterator::Iterator>::next
             at ./src/libcore/iter/traits/iterator.rs:2608
  26:  as core::iter::traits::collect::Extend<::Item>>::extend
             at /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-0.6.9/lib.rs:1363
  27:  as core::iter::traits::collect::FromIterator<::Item>>::from_iter
             at /home/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-0.6.9/lib.rs:1339
  28:  as core::iter::traits::collect::FromIterator>>::from_iter
             at ./src/libcore/result.rs:1267
  29: core::iter::traits::iterator::Iterator::collect
             at ./src/libcore/iter/traits/iterator.rs:1466
  30:  as rustc::ty::context::InternIteratorElement>::intern_with
             at src/librustc/ty/context.rs:3002
  31: >::intern_with
             at src/librustc/ty/context.rs:2974
  32: rustc::ty::context::TyCtxt::mk_substs
             at src/librustc/ty/context.rs:2831
  33: rustc::ty::relate::relate_substs
             at src/librustc/ty/relate.rs:144
  34: ::relate
             at src/librustc/ty/relate.rs:293
  35: rustc::ty::relate::TypeRelation::relate
             at src/librustc/ty/relate.rs:43
  36: rustc::infer::higher_ranked::::higher_ranked_sub::{{closure}}
             at src/librustc/infer/higher_ranked/mod.rs:51
  37: rustc::infer::InferCtxt::commit_if_ok
             at src/librustc/infer/mod.rs:810
  38: rustc::infer::higher_ranked::::higher_ranked_sub
             at src/librustc/infer/higher_ranked/mod.rs:34
  39: ::binders
             at src/librustc/infer/sub.rs:184
  40:  as rustc::ty::relate::Relate>::relate
             at src/librustc/ty/relate.rs:723
  41: rustc::ty::relate::TypeRelation::relate
             at src/librustc/ty/relate.rs:43
  42: rustc::infer::at::Trace::sub::{{closure}}
             at src/librustc/infer/at.rs:227
  43: rustc::infer::InferCtxt::commit_if_ok
             at src/librustc/infer/mod.rs:810
  44: rustc::infer::at::Trace::sub
             at src/librustc/infer/at.rs:225
  45: rustc::infer::at::At::sub_exp
             at src/librustc/infer/at.rs:90
  46: rustc::infer::at::At::sup
             at src/librustc/infer/at.rs:103
  47: rustc::traits::select::SelectionContext::match_poly_trait_ref
             at src/librustc/traits/select.rs:3712
  48: rustc::traits::select::SelectionContext::match_where_clause_trait_ref
             at src/librustc/traits/select.rs:3697
  49: rustc::traits::select::SelectionContext::evaluate_where_clause::{{closure}}
             at src/librustc/traits/select.rs:1876
  50: rustc::traits::select::SelectionContext::evaluation_probe::{{closure}}
             at src/librustc/traits/select.rs:674
  51: rustc::infer::InferCtxt::probe
             at src/librustc/infer/mod.rs:842
  52: rustc::traits::select::SelectionContext::evaluation_probe
             at src/librustc/traits/select.rs:673
  53: rustc::traits::select::SelectionContext::evaluate_where_clause
             at src/librustc/traits/select.rs:1875
  54: rustc::traits::select::SelectionContext::assemble_candidates_from_caller_bounds
             at src/librustc/traits/select.rs:1859
  55: rustc::traits::select::SelectionContext::assemble_candidates
             at src/librustc/traits/select.rs:1692
  56: rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache
             at src/librustc/traits/select.rs:1339
  57: rustc::traits::select::SelectionContext::candidate_from_obligation::{{closure}}
             at src/librustc/traits/select.rs:1226
  58: rustc::traits::select::SelectionContext::in_task::{{closure}}
             at src/librustc/traits/select.rs:1247
  59: rustc::dep_graph::graph::DepGraph::with_anon_task
             at src/librustc/dep_graph/graph.rs:370
  60: rustc::traits::select::SelectionContext::in_task
             at src/librustc/traits/select.rs:1245
  61: rustc::traits::select::SelectionContext::candidate_from_obligation
             at src/librustc/traits/select.rs:1226
  62: rustc::traits::select::SelectionContext::evaluate_stack
             at src/librustc/traits/select.rs:1023
  63: rustc::traits::select::SelectionContext::evaluate_trait_predicate_recursively::{{closure}}
             at src/librustc/traits/select.rs:871
  64: rustc::traits::select::SelectionContext::in_task::{{closure}}
             at src/librustc/traits/select.rs:1247
  65: rustc::dep_graph::graph::DepGraph::with_anon_task
             at src/librustc/dep_graph/graph.rs:370
  66: rustc::traits::select::SelectionContext::in_task
             at src/librustc/traits/select.rs:1245
  67: rustc::traits::select::SelectionContext::evaluate_trait_predicate_recursively
             at src/librustc/traits/select.rs:871
  68: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
             at src/librustc/traits/select.rs:733
  69: rustc::traits::select::SelectionContext::evaluate_predicates_recursively
             at src/librustc/traits/select.rs:696
  70: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
             at src/librustc/traits/select.rs:1071
  71: rustc::traits::select::SelectionContext::evaluation_probe::{{closure}}
             at src/librustc/traits/select.rs:674
  72: rustc::infer::InferCtxt::probe
             at src/librustc/infer/mod.rs:842
  73: rustc::traits::select::SelectionContext::evaluation_probe
             at src/librustc/traits/select.rs:673
  74: rustc::traits::select::SelectionContext::evaluate_candidate
             at src/librustc/traits/select.rs:1068
  75: rustc::traits::select::SelectionContext::evaluate_stack
             at src/librustc/traits/select.rs:1024
  76: rustc::traits::select::SelectionContext::evaluate_trait_predicate_recursively::{{closure}}
             at src/librustc/traits/select.rs:871
  77: rustc::traits::select::SelectionContext::in_task::{{closure}}
             at src/librustc/traits/select.rs:1247
  78: rustc::dep_graph::graph::DepGraph::with_anon_task
             at src/librustc/dep_graph/graph.rs:370
  79: rustc::traits::select::SelectionContext::in_task
             at src/librustc/traits/select.rs:1245
  80: rustc::traits::select::SelectionContext::evaluate_trait_predicate_recursively
             at src/librustc/traits/select.rs:871
  81: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
             at src/librustc/traits/select.rs:733
  82: rustc::traits::select::SelectionContext::evaluate_obligation_recursively::{{closure}}
             at src/librustc/traits/select.rs:664
  83: rustc::traits::select::SelectionContext::evaluation_probe::{{closure}}
             at src/librustc/traits/select.rs:674
  84: rustc::infer::InferCtxt::probe
             at src/librustc/infer/mod.rs:842
  85: rustc::traits::select::SelectionContext::evaluation_probe
             at src/librustc/traits/select.rs:673
  86: rustc::traits::select::SelectionContext::evaluate_obligation_recursively
             at src/librustc/traits/select.rs:663
  87: rustc_traits::evaluate_obligation::evaluate_obligation::{{closure}}
             at src/librustc_traits/evaluate_obligation.rs:32
  88: rustc::infer::InferCtxtBuilder::enter_with_canonical::{{closure}}
             at ./src/librustc/infer/mod.rs:509
  89: rustc::infer::InferCtxtBuilder::enter::{{closure}}
             at ./src/librustc/infer/mod.rs:520
  90: rustc::ty::context::GlobalCtxt::enter_local::{{closure}}::{{closure}}
             at ./src/librustc/ty/context.rs:1703
  91: rustc::ty::context::tls::enter_context::{{closure}}
             at ./src/librustc/ty/context.rs:1935
  92: rustc::ty::context::tls::set_tlv
             at ./src/librustc/ty/context.rs:1868
  93: rustc::ty::context::tls::enter_context
             at ./src/librustc/ty/context.rs:1934
  94: rustc::ty::context::GlobalCtxt::enter_local::{{closure}}
             at ./src/librustc/ty/context.rs:1702
  95: rustc::ty::context::tls::with_related_context::{{closure}}
             at ./src/librustc/ty/context.rs:2040
  96: rustc::ty::context::tls::with_context::{{closure}}
             at ./src/librustc/ty/context.rs:2024
  97: rustc::ty::context::tls::with_context_opt
             at ./src/librustc/ty/context.rs:2014
  98: rustc::ty::context::tls::with_context
             at ./src/librustc/ty/context.rs:2024
  99: rustc::ty::context::tls::with_related_context
             at ./src/librustc/ty/context.rs:2036
  100: rustc::ty::context::GlobalCtxt::enter_local
             at ./src/librustc/ty/context.rs:1694
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 5, 2019
@jonas-schievink
Copy link
Contributor

Can you post your config.toml? I can't reproduce on my machine.

@ehuss
Copy link
Contributor Author

ehuss commented Jun 5, 2019

That's curious. Happens with no config.toml, all defaults. I repro'd on both macos and linux. Also just updated to the tip of master (2a1d6c8). Did you wait all the way through stage1? It only happens when rustc rebuilds itself.

@jonas-schievink
Copy link
Contributor

Ah I see, that helps. I didn't do a full bootstrap.

@memoryruins
Copy link
Contributor

Reproduces on Windows (47f4975)

Copying stage1 test from stage1 (x86_64-pc-windows-gnu -> x86_64-pc-windows-gnu / x86_64-pc-windows-gnu)
Building stage1 compiler artifacts (x86_64-pc-windows-gnu -> x86_64-pc-windows-gnu)
/* ... */
   Compiling syntax_pos v0.0.0 
   Compiling rustc_errors v0.0.0
   Compiling syntax_ext v0.0.0
error: internal compiler error: src\librustc\ty\relate.rs:773: impossible case reached: can't relate: '_#0r with Type(RustaceansAreAwesome)
thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:638:9
stack backtrace:
   0: _report_error
/* debug info was not enabled */
  99: _report_error
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `&Self: std::ops::DispatchFromDyn<&RustaceansAreAwesome>`
#1 [is_object_safe] determine object safety of trait `lint::LateLintPass`
#2 [check_item_well_formed] processing `lint::context::LintStore`
#3 [analysis] running analysis passes on this crate
end of query stack

@pnkfelix
Copy link
Member

pnkfelix commented Jun 6, 2019

triage: P-high because I cannot tell how bad this is. Assigning to self for further investigation. Leaving nominated in hopes that we might discuss at meeting, maybe.

@pnkfelix pnkfelix added the P-high High priority label Jun 6, 2019
@pnkfelix pnkfelix self-assigned this Jun 6, 2019
@ehuss
Copy link
Contributor Author

ehuss commented Jun 6, 2019

I've discovered the problem. SmallVec is assuming that once an iterator returns None, it doesn't resume. I'll try to get a fix together.

@alexcrichton
Copy link
Member

alexcrichton commented Jun 10, 2019

Looks like this was fixed in servo/rust-smallvec#151 (see next comment) and we're just waiting on a version bump to smallvec now

@ehuss
Copy link
Contributor Author

ehuss commented Jun 10, 2019

Just a minor correction, that's the wrong PR for this issue. The fix was in servo/rust-smallvec#150. I just did a few other drive-by fixes when I was reviewing the code.

@jdm
Copy link
Contributor

jdm commented Jun 10, 2019

Once servo/rust-smallvec#153 merges I'll publish a new release.

Centril added a commit to Centril/rust that referenced this issue Jun 14, 2019
…tsakis

Updates smallvec and new_debug_unreachable

The version `0.6.10` of smallvec has released that fixes an [ICE](rust-lang#61549).
This is re-submission of rust-lang#58773.
And this may let rust-lang#56440 re-start.
Centril added a commit to Centril/rust that referenced this issue Jun 14, 2019
…tsakis

Updates smallvec and new_debug_unreachable

The version `0.6.10` of smallvec has released that fixes an [ICE](rust-lang#61549).
This is re-submission of rust-lang#58773.
And this may let rust-lang#56440 re-start.
Centril added a commit to Centril/rust that referenced this issue Jun 14, 2019
…tsakis

Updates smallvec and new_debug_unreachable

The version `0.6.10` of smallvec has released that fixes an [ICE](rust-lang#61549).
This is re-submission of rust-lang#58773.
And this may let rust-lang#56440 re-start.
@pnkfelix
Copy link
Member

closing as resolved since it sounds like the newer version of smallvec resolves the problems here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

No branches or pull requests

6 participants