error: an inner attribute is not permitted in this context
--> ice/src/lib.rs:1:1
|
1 | ice_macros::proc_macro_ice!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
= note: this error originates in the macro `ice_macros::proc_macro_ice` (in Nightly builds, run with -Z macro-backtrace for more info)
thread 'rustc' panicked at 'Found outer attribute Attribute { kind: Normal(AttrItem { path: Path { span: ice/src/lib.rs:1:1: 1:31 (#4), segments: [PathSegment { ident: allow#4, id: NodeId(4294967040), args: None }], tokens: None }, args: Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Parenthesis, TokenStream([(Token(Token { kind: Ident("missing_docs", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone)])), tokens: None }, Some(LazyTokenStream(AttrAnnotatedTokenStream([(Token(Token { kind: Pound, span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone), (Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Bracket, AttrAnnotatedTokenStream([(Token(Token { kind: Ident("allow", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone), (Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Paren, AttrAnnotatedTokenStream([(Token(Token { kind: Ident("missing_docs", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone)])), Alone)])), Alone)])))), id: AttrId(32), style: Outer, span: ice/src/lib.rs:1:1: 1:31 (#4) } after inner attrs [Attribute { kind: Normal(AttrItem { path: Path { span: ice/src/lib.rs:1:1: 1:31 (#4), segments: [PathSegment { ident: deny#4, id: NodeId(4294967040), args: None }], tokens: None }, args: Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Parenthesis, TokenStream([(Token(Token { kind: Ident("missing_docs", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone)])), tokens: None }, Some(LazyTokenStream(AttrAnnotatedTokenStream([(Token(Token { kind: Pound, span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone), (Token(Token { kind: Not, span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone), (Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Bracket, AttrAnnotatedTokenStream([(Token(Token { kind: Ident("deny", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone), (Delimited(DelimSpan { open: ice/src/lib.rs:1:1: 1:31 (#4), close: ice/src/lib.rs:1:1: 1:31 (#4) }, Paren, AttrAnnotatedTokenStream([(Token(Token { kind: Ident("missing_docs", false), span: ice/src/lib.rs:1:1: 1:31 (#4) }), Alone)])), Alone)])), Alone)])))), id: AttrId(30), style: Inner, span: ice/src/lib.rs:1:1: 1:31 (#4) }]', compiler/rustc_ast/src/tokenstream.rs:224:33
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::boxed_resolver::BoxedResolver::new
14: rustc_interface::queries::Queries::expansion
15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
16: rustc_span::with_source_map
17: rustc_interface::interface::create_compiler_and_run
18: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.54.0 (a178d0322 2021-07-26) running on aarch64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --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
I encountered an ICE while incorrectly inserting a outer attribute above deriving
serde::Serializeorserde::Deserializeinside of a proc-macro. This did not happen with any other derive I tried.Code
Meta
rustc +stable --version --verbose:rustc +nightly --version --verbose:Error output
Backtrace