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

rustc 1.25.0-nightly (3d292b793 2018-02-03) panicks on simple function #48000

Closed
pbevin opened this issue Feb 4, 2018 · 6 comments
Closed

rustc 1.25.0-nightly (3d292b793 2018-02-03) panicks on simple function #48000

pbevin opened this issue Feb 4, 2018 · 6 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@pbevin
Copy link

pbevin commented Feb 4, 2018

My source file contains just this:

pub fn has_digit(s: &str) -> bool {
    s.contains(char::is_digit)
}

Running rustc lib.rs results in this error:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

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.25.0-nightly (3d292b793 2018-02-03) running on x86_64-apple-darwin

My Rust version is:

rustc 1.25.0-nightly (3d292b793 2018-02-03)
binary: rustc
commit-hash: 3d292b793ade0c1c9098fb32586033d79f6e9969
commit-date: 2018-02-03
host: x86_64-apple-darwin
release: 1.25.0-nightly
LLVM version: 4.0

Backtrace:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::panicking::panic
  10: rustc::traits::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::report_selection_error
  11: rustc::traits::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::report_fulfillment_errors
  12: rustc_typeck::check::FnCtxt::select_obligations_where_possible
  13: rustc_typeck::check::FnCtxt::check_argument_types
  14: rustc_typeck::check::FnCtxt::check_method_argument_types
  15: rustc_typeck::check::FnCtxt::check_expr_kind
  16: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  17: rustc_typeck::check::FnCtxt::check_block_with_expected
  18: rustc_typeck::check::FnCtxt::check_expr_kind
  19: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  20: rustc_typeck::check::FnCtxt::check_return_expr
  21: rustc_typeck::check::check_fn
  22: <std::thread::local::LocalKey<T>>::with
  23: rustc::ty::context::GlobalCtxt::enter_local
  24: rustc_typeck::check::typeck_tables_of
  25: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::compute_result
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: rustc_errors::Handler::track_diagnostics
  28: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  31: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  32: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  33: rustc::session::Session::track_errors
  34: rustc_typeck::check::typeck_item_bodies
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc_errors::Handler::track_diagnostics
  37: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  38: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
  39: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  40: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  41: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  42: rustc_typeck::check_crate
  43: <std::thread::local::LocalKey<T>>::with
  44: <std::thread::local::LocalKey<T>>::with
  45: rustc::ty::context::TyCtxt::create_and_enter
  46: rustc_driver::driver::compile_input
  47: rustc_driver::run_compiler
@pbevin
Copy link
Author

pbevin commented Feb 4, 2018

Stable 1.23.0 correctly gives an error message:

error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
 --> lib.rs:2:7
  |
2 |     s.contains(char::is_digit)
  |       ^^^^^^^^ expected function that takes 1 argument
  |
  = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `fn(char, u32) -> bool {std::char::<impl char>::is_digit}`

@kennytm kennytm added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. C-bug Category: This is a bug. labels Feb 4, 2018
@kennytm
Copy link
Member

kennytm commented Feb 4, 2018

The regression is introduced by 8d3e93b (rollup #47622), within this it seems #47573 is the only relevant PR. cc @estebank

@nikomatsakis
Copy link
Contributor

Maybe fixed by #48047 ? @etaoins -- do you have a build lying around of your PR, can you check?

@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Feb 8, 2018
@estebank
Copy link
Contributor

estebank commented Feb 8, 2018

Definitely looks like a duplicate of #48046. We can confirm once #48047 lands.

@etaoins
Copy link
Contributor

etaoins commented Feb 8, 2018

@nikomatsakis #48047 does fix this. Its output is:

error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
 --> main.rs:2:7
  |
2 |     s.contains(char::is_digit)
  |       ^^^^^^^^ expected function that takes 1 argument
  |
  = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `fn(char, u32) -> bool {std::char::<impl char>::is_digit}`

error: aborting due to previous error

# for free to join this conversation on GitHub. Already have an account? # 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 regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

6 participants