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: thread 'rustc' panicked at 'attribute takes lit', compiler/rustc_middle/src/ty/context.rs:1095:38 #83180

Closed
chengniansun opened this issue Mar 16, 2021 · 1 comment · Fixed by #83196
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

@chengniansun
Copy link

Code

#[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
struct NonZero(T);
fn not_field() -> impl {
    NonZero(false)
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (107896c32 2021-03-15)
binary: rustc
commit-hash: 107896c32d5dda4db508968ff34997a39d286966
commit-date: 2021-03-15
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

error: at least one trait must be specified
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 | fn not_field() -> impl {
  |                   ^^^^

error[E0412]: cannot find type `T` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:16
  |
2 | struct NonZero(T);
  |               -^ not found in this scope
  |               |
  |               help: you might be missing a type parameter: `<T>`

error[E0658]: the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable niche optimizations in libcore and will never be stable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
2 | | struct NonZero(T);
3 | | fn not_field() -> impl {
4 | |     NonZero(false)
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: expected exactly one integer literal argument
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'attribute takes lit', compiler/rustc_middle/src/ty/context.rs:1095:38
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.52.0-nightly (107896c32 2021-03-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [unsafety_check_result] unsafety-checking `not_field`
#1 [mir_const] processing MIR for `not_field`
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.
Backtrace

error: at least one trait must be specified
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 | fn not_field() -> impl {
  |                   ^^^^

error[E0412]: cannot find type `T` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:16
  |
2 | struct NonZero(T);
  |               -^ not found in this scope
  |               |
  |               help: you might be missing a type parameter: `<T>`

error[E0658]: the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable niche optimizations in libcore and will never be stable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
2 | | struct NonZero(T);
3 | | fn not_field() -> impl {
4 | |     NonZero(false)
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: expected exactly one integer literal argument
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'attribute takes lit', compiler/rustc_middle/src/ty/context.rs:1095:38
stack backtrace:
   0: rust_begin_unwind
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/core/src/panicking.rs:92:14
   2: core::option::expect_failed
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/core/src/option.rs:1321:5
   3: rustc_middle::ty::context::TyCtxt::layout_scalar_valid_range::{{closure}}
   4: rustc_middle::ty::context::TyCtxt::layout_scalar_valid_range
   5: <rustc_mir::transform::check_unsafety::UnsafetyChecker as rustc_middle::mir::visit::Visitor>::visit_rvalue
   6: rustc_mir::transform::check_unsafety::unsafety_check_result
   7: core::ops::function::FnOnce::call_once
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
   9: rustc_query_system::query::plumbing::force_query_with_job
  10: rustc_query_system::query::plumbing::get_query_impl
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result
  12: rustc_mir::transform::mir_const
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  14: rustc_query_system::query::plumbing::force_query_with_job
  15: rustc_query_system::query::plumbing::get_query_impl
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
  17: rustc_mir::transform::mir_promoted
  18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  19: rustc_query_system::query::plumbing::force_query_with_job
  20: rustc_query_system::query::plumbing::get_query_impl
  21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_promoted
  22: rustc_mir::borrow_check::mir_borrowck
  23: core::ops::function::FnOnce::call_once
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  25: rustc_query_system::query::plumbing::force_query_with_job
  26: rustc_query_system::query::plumbing::get_query_impl
  27: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  28: rustc_typeck::collect::type_of::type_of
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_data_structures::stack::ensure_sufficient_stack
  31: rustc_query_system::query::plumbing::force_query_with_job
  32: rustc_query_system::query::plumbing::get_query_impl
  33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  34: rustc_typeck::check::check::check_opaque
  35: rustc_typeck::check::check::check_item_type
  36: rustc_middle::hir::map::Map::visit_item_likes_in_module
  37: rustc_typeck::check::check::check_mod_item_types
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_query_system::query::plumbing::force_query_with_job
  40: rustc_query_system::query::plumbing::get_query_impl
  41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
  42: rustc_session::utils::<impl rustc_session::session::Session>::time
  43: rustc_typeck::check_crate
  44: rustc_interface::passes::analysis
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_data_structures::stack::ensure_sufficient_stack
  47: rustc_query_system::query::plumbing::force_query_with_job
  48: rustc_query_system::query::plumbing::get_query_impl
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  50: rustc_interface::passes::QueryContext::enter
  51: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  52: rustc_span::with_source_map
  53: 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.52.0-nightly (107896c32 2021-03-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [unsafety_check_result] unsafety-checking `not_field`
#1 [mir_const] processing MIR for `not_field`
#2 [mir_promoted] processing `not_field`
#3 [mir_borrowck] borrow-checking `not_field`
#4 [type_of] computing type of `not_field::{opaque#0}`
#5 [check_mod_item_types] checking item types in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.

@chengniansun chengniansun 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 Mar 16, 2021
@jonas-schievink
Copy link
Contributor

should be fixed by #83054

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.

2 participants