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: 'derive attribute should exist', src/librustc_expand/expand.rs:505:1 #69341

Closed
matthiaskrgr opened this issue Feb 21, 2020 · 9 comments · Fixed by #69522
Closed

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

matthiaskrgr opened this issue Feb 21, 2020 · 9 comments · Fixed by #69522
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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.
@matthiaskrgr matthiaskrgr 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 Feb 21, 2020
@matthiaskrgr
Copy link
Member Author

This crashes on stable, beta and nightly.

@jonas-schievink jonas-schievink added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-nominated labels Feb 21, 2020
@Centril
Copy link
Contributor

Centril commented Feb 21, 2020

cc @petrochenkov

@pnkfelix
Copy link
Member

godbolt says this regressed between releases 1.40 and 1.41.

@pnkfelix pnkfelix added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Feb 27, 2020
@pnkfelix
Copy link
Member

triage: P-high to bisect and determine severity. Removing nomination. Added stable-to-stable regression label.

@pnkfelix pnkfelix added P-high High priority E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc and removed I-nominated labels Feb 27, 2020
@chrissimpkins
Copy link
Member

chrissimpkins commented Feb 27, 2020

searched nightlies: from nightly-2019-11-01 to nightly-2020-02-25
regressed nightly: nightly-2019-12-08
searched commits: from ae1b871 to 5c5c8eb
regressed commit: 41601a8
source code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=b7ea70ffbf916dccefcab318e419a84c

Instructions

$ cargo bisect-rustc --start ae1b871cca56613b1af1a5121dd24ac810ff4b89 --end 41601a8c95240cada94c13466a1fea02e5fe87ed --regress=ice

Confirmed automated tests with manual run using --prompt

Error

Before ICE

COLLAPSIBLE ERROR STACKTRACE

error: expected one of `)`, `,`, or `::`, found `(`
 --> src/main.rs:6:19
  |
6 |     #[derive(parse(from_os_str))]
  |                   ^ expected one of `)`, `,`, or `::`

error[E0432]: unresolved import `structopt`
 --> src/main.rs:1:5
  |
1 | use structopt::StructOpt;
  |     ^^^^^^^^^ use of undeclared type or module `structopt`

error: cannot determine resolution for the derive macro `StructOpt`
 --> src/main.rs:3:10
  |
3 | #[derive(StructOpt)]
  |          ^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 3 previous errors

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

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

ICE

COLLAPSIBLE ERROR STACKTRACE

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:507: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:1053
   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: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: rust_begin_unwind
             at src/libstd/panicking.rs:378
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  14: core::option::expect_failed
             at src/libcore/option.rs:1203
  15: rustc_expand::expand::MacroExpander::fully_expand_fragment
  16: rustc_expand::expand::MacroExpander::expand_crate
  17: rustc_session::utils::<impl rustc_session::session::Session>::time
  18: rustc_interface::passes::configure_and_expand_inner
  19: rustc_interface::passes::configure_and_expand::{{closure}}
  20: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  21: rustc_interface::passes::configure_and_expand
  22: rustc_interface::queries::Queries::expansion
  23: rustc_interface::interface::run_compiler_in_existing_thread_pool
  24: 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 (abc3073c9 2020-02-26) 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

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

error: could not compile `bisectit`.

@chrissimpkins
Copy link
Member

@rustbot modify labels: -E-needs-bisection

@rustbot rustbot removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 27, 2020
@chrissimpkins
Copy link
Member

Maybe #67052?

@Centril
Copy link
Contributor

Centril commented Feb 27, 2020

Reduced:

fn main() {}

struct CLI {
    #[derive(parse())]
    path: (),
}

@Centril
Copy link
Contributor

Centril commented Feb 27, 2020

Fixed by #69522.

@bors bors closed this as completed in 87cc521 Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

6 participants