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

Internal compiler error due to invalid integer literal #3891

Closed
j-tai opened this issue Mar 17, 2019 · 0 comments · Fixed by #3931
Closed

Internal compiler error due to invalid integer literal #3891

j-tai opened this issue Mar 17, 2019 · 0 comments · Fixed by #3931
Assignees
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@j-tai
Copy link

j-tai commented Mar 17, 2019

fn main() {
    1x;
}

The invalid integer literal 1x causes clippy to panic.

error: invalid suffix `x` for numeric literal
 --> src/main.rs:2:5
  |
2 |     1x;
  |     ^^ invalid suffix `x`
  |
  = help: the suffix must be one of the integral types (`u32`, `isize`, etc)

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/libcore/result.rs:997:5
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
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   6: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:385
   7: rust_begin_unwind
             at src/libstd/panicking.rs:312
   8: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   9: core::result::unwrap_failed
  10: <clippy_lints::literal_representation::LiteralRepresentation as rustc::lint::EarlyLintPass>::check_expr
  11: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_expr
  12: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_block
  13: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_fn
  14: syntax::visit::walk_item
  15: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_item
  16: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_mod
  17: rustc::lint::context::check_ast_crate
  18: rustc::util::common::time
  19: rustc_driver::driver::phase_2_configure_and_expand
  20: rustc_driver::driver::compile_input
  21: rustc_driver::run_compiler_with_pool
  22: <scoped_tls::ScopedKey<T>>::set
  23: rustc_driver::run_compiler
  24: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
end of query stack
error: aborting due to previous error


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.33.0 (2aa4c46cf 2019-02-28) running on x86_64-unknown-linux-gnu

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

note: some of the compiler flags provided by cargo are hidden
@mcarton mcarton added I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ T-macros Type: Issues with macros and macro expansion and removed T-macros Type: Issues with macros and macro expansion labels Mar 18, 2019
@phansch phansch self-assigned this Apr 8, 2019
bors added a commit that referenced this issue Apr 10, 2019
Fix ICE in decimal_literal_representation lint

Handling the integer parsing properly instead of just unwrapping.

Note that the test is not catching the ICE because plain UI tests
[currently hide ICEs][compiletest_issue]. Once that issue is fixed, this
test would fail properly again.

Fixes #3891

[compiletest_issue]: Manishearth/compiletest-rs#169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants