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

ICE when using serde derives with an invalid inner doc comment #86781

Closed
solarretrace opened this issue Jul 1, 2021 · 1 comment · Fixed by #86814
Closed

ICE when using serde derives with an invalid inner doc comment #86781

solarretrace opened this issue Jul 1, 2021 · 1 comment · Fixed by #86814
Assignees
Labels
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.

Comments

@solarretrace
Copy link

I'm hitting an ICE when using serde derives with an invalid inner doc comment. This occurs on the playground on both stable and nightly.

Code

use serde::Serialize;

//! Pc
#[derive(Serialize)]
pub struct Pc;

Meta

This is the version on my machine:

rustc --version --verbose:

rustc 1.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: x86_64-apple-darwin
release: 1.53.0
LLVM version: 12.0.1

Error output

   Compiling playground v0.0.1 (/playground)
error[E0753]: expected outer doc comment
 --> src/lib.rs:4:1
  |
4 | //! Pc
  | ^^^^^^
  |
  = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items

thread 'rustc' panicked at 'Failed to find trailing delimited group in: [(Token(Token { kind: Ident("pub", false), span: src/lib.rs:6:1: 6:4 (#0) }), Alone), (Token(Token { kind: Ident("struct", false), span: src/lib.rs:6:5: 6:11 (#0) }), Alone), (Token(Token { kind: Ident("Pc", false), span: src/lib.rs:6:12: 6:14 (#0) }), Joint), (Token(Token { kind: Semi, span: src/lib.rs:6:14: 6:15 (#0) }), Alone)]', compiler/rustc_ast/src/tokenstream.rs:276:25
note: run with `RUST_BACKTRACE=1` environment variable to display 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (868c702d0 2021-06-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0753`.
error: could not compile `playground`

To learn more, run the command again with --verbose.
Backtrace

stack backtrace:
   0: _rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
   3: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
   4: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   5: rustc_ast::tokenstream::AttrAnnotatedTokenStream::to_tokenstream
   6: rustc_parse::prepend_attrs
   7: rustc_parse::nt_to_tokenstream
   8: <rustc_expand::proc_macro::ProcMacroDerive as rustc_expand::base::MultiItemModifier>::expand
   9: rustc_expand::expand::MacroExpander::fully_expand_fragment
  10: rustc_expand::expand::MacroExpander::expand_crate
  11: rustc_session::utils::<impl rustc_session::session::Session>::time
  12: rustc_interface::passes::configure_and_expand_inner
  13: rustc_interface::passes::configure_and_expand::{{closure}}
  14: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  15: rustc_interface::passes::configure_and_expand
  16: rustc_interface::queries::Queries::expansion
  17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  18: rustc_span::with_source_map
  19: rustc_interface::interface::create_compiler_and_run
  20: scoped_tls::ScopedKey<T>::set

@solarretrace solarretrace 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. labels Jul 1, 2021
@Aaron1011 Aaron1011 self-assigned this Jul 1, 2021
@hellow554
Copy link
Contributor

hellow554 commented Jul 2, 2021

In case somebody is interested in the bisection:

searched nightlies: from nightly-2021-01-01 to nightly-2021-06-01
regressed nightly: nightly-2021-04-12
searched commits: from a836d9b to a866124
regressed commit: ba6275b

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --end=2021-06-01 --access=github --regress=ice --without-cargo -- check

cc #82608

JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 18, 2021
…bank

Recover from a misplaced inner doc comment

Fixes rust-lang#86781
@bors bors closed this as completed in 5c9bd9c Jul 18, 2021
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) ❄️ 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.

3 participants