Skip to content

ICE: 'derive attribute should exist', src/librustc_expand/expand.rs:505:1 #69341

Closed
@matthiaskrgr

Description

@matthiaskrgr
git clone https://github.com/TrueWarg/grrs/
cd grrs
cargo check

Code

use structopt::StructOpt;

#[derive(StructOpt)]
struct CLI {
    pattern: String,
    #[derive(parse(from_os_str))]
    path: std::path::PathBuf
}

fn main() {
}

Meta

rustc --version --verbose:

rustc 1.43.0-nightly (2c462a2f7 2020-02-20)
binary: rustc
commit-hash: 2c462a2f776b899d46743b1b44eda976e846e61d
commit-date: 2020-02-20
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Error output

    Checking grrs v0.1.0 (/tmp/grrs)
error: traits in `#[derive(...)]` don't accept arguments
 --> src/main.rs:6:19
  |
6 |     #[derive(parse(from_os_str))]
  |                   ^^^^^^^^^^^^^ help: remove the arguments

thread 'rustc' panicked at '`derive` attribute should exist', src/librustc_expand/expand.rs:505:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/2c462a2f776b899d46743b1b44eda976e846e61d/src/liballoc/boxed.rs:1031
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/2c462a2f776b899d46743b1b44eda976e846e61d/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  14: rust_begin_unwind
             at src/libstd/panicking.rs:378
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  16: core::option::expect_failed
             at src/libcore/option.rs:1203
  17: rustc_expand::expand::MacroExpander::fully_expand_fragment
  18: rustc_expand::expand::MacroExpander::expand_crate
  19: rustc_session::utils::<impl rustc_session::session::Session>::time
  20: rustc_interface::passes::configure_and_expand_inner
  21: rustc_interface::passes::configure_and_expand::{{closure}}
  22: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  23: rustc_interface::passes::configure_and_expand
  24: rustc_interface::queries::Queries::expansion
  25: rustc_interface::interface::run_compiler_in_existing_thread_pool
  26: scoped_tls::ScopedKey<T>::set
  27: syntax::attr::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (2c462a2f7 2020-02-20) running on x86_64-unknown-linux-gnu

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

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

error: could not compile `grrs`.

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

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions