Skip to content

Strange ICE in a linter when using syntax extensions #22091

Closed
@LeoTestard

Description

@LeoTestard
                        error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Vec::reserve: `usize` overflow', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/option.rs:330

stack backtrace:
   1:     0x7fc03d90b280 - sys::backtrace::write::h25503045cef8c0c0pvy
   2:     0x7fc03d92e980 - failure::on_fail::h2581836e6847e312n0F
   3:     0x7fc03d88fa10 - rt::unwind::begin_unwind_inner::hfde7584b0f347ac4IEF
   4:     0x7fc03d890520 - rt::unwind::begin_unwind_fmt::h63c856440ef5a7afeDF
   5:     0x7fc03d92e7e0 - rust_begin_unwind
   6:     0x7fc03d978870 - panicking::panic_fmt::h0f5128f8e91dc358Tqw
   7:     0x7fc03abb8480 - vec::Vec<T>::reserve::h12271285414625644921
   8:     0x7fc03ac5b810 - diagnostic::emit::h4768553017b57fffOtF
   9:     0x7fc03ac591a0 - diagnostic::EmitterWriter.Emitter::emit::h4be90c42b1d73d43bqF
  10:     0x7fc03ac57ad0 - diagnostic::Handler::emit::hb481977d8e04eabfO4E
  11:     0x7fc03ac57e90 - diagnostic::SpanHandler::span_warn::h3147bfd49accb8236TE
  12:     0x7fc03bc32350 - lint::context::raw_emit_lint::h8e6d28bb654c5be2S0u
  13:     0x7fc03bc32b10 - lint::context::Context<'a, 'tcx>::lookup_and_emit::h18c43a40d6e0f81ba8u
  14:     0x7fc03bc21010 - lint::builtin::NonCamelCaseTypes::check_case::h000ef025b6300fb0i8s
  15:     0x7fc03bc21930 - lint::builtin::NonCamelCaseTypes.LintPass::check_item::h4e7ac4ecb3d987f2tct
  16:     0x7fc03bc32ce0 - lint::context::Context<'a, 'tcx>::with_lint_attrs::h2049493418187456314
  17:     0x7fc03bc3a640 - lint::context::Context<'a, 'tcx>.Visitor<'v>::visit_mod::h5ed586dc3e2dff13MAv
  18:     0x7fc03bc32ce0 - lint::context::Context<'a, 'tcx>::with_lint_attrs::h2049493418187456314
  19:     0x7fc03bc3a640 - lint::context::Context<'a, 'tcx>.Visitor<'v>::visit_mod::h5ed586dc3e2dff13MAv
  20:     0x7fc03bc42d10 - lint::context::check_crate::h2f723dbff19a7c4doTv
  21:     0x7fc03defbc20 - driver::phase_3_run_analysis_passes::h7a142ff0647d384dGGa
  22:     0x7fc03dee1b60 - driver::compile_input::h48e128556d26f55bCba
  23:     0x7fc03dfb3ce0 - run_compiler::h763e312f828f22a0Rbc
  24:     0x7fc03dfb2370 - thunk::F.Invoke<A, R>::invoke::h4670445912642657619
  25:     0x7fc03dfb12a0 - rt::unwind::try::try_fn::h16156493216513710930
  26:     0x7fc03d99ae00 - rust_try_inner
  27:     0x7fc03d99adf0 - rust_try
  28:     0x7fc03dfb1550 - thunk::F.Invoke<A, R>::invoke::h11636038058777759556
  29:     0x7fc03d91ae70 - sys::thread::thread_start::h4554e7282d94c6f4KFB
  30:     0x7fc037959fe0 - start_thread
  31:     0x7fc03d513c99 - __clone
  32:                0x0 - <unknown>

The warning that caused this was:

warning: variant `op` should have a camel case name such as `Op`, #[warn(non_camel_case_types)] on by default

I'd like to provide a minimal reproducable test case but since it involves expansion of a quite complex syntax extension, I don't think it is possible.
Furthermore, if I first produce code using --pretty expanded and then compile it, it compiles fine (the warnings are displayed properly and no ICE occurs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions