Skip to content

ICE: compiler/rustc_middle/src/ty/layout.rs:370:17: univariant: field comes after unsized field #84108

Closed
@chengniansun

Description

@chengniansun

The bug should be different from #61335, as the stack traces are different.

Code

static NONE: (AsRef<OsStr>, u8);

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (a836d9b64 2021-04-10)
binary: rustc
commit-hash: a836d9b6413d9d593be6c09463ff8c4c70e56599
commit-date: 2021-04-10
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error: free static item without body
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | static NONE: (AsRef<OsStr>, u8);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
  |                                |
  |                                help: provide a definition for the static: `= <expr>;`

error[E0412]: cannot find type `OsStr` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:21
  |
1 | static NONE: (AsRef<OsStr>, u8);
  |                     ^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::ffi::OsStr;
  |

warning: trait objects without an explicit `dyn` are deprecated
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:15
  |
1 | static NONE: (AsRef<OsStr>, u8);
  |               ^^^^^^^^^^^^ help: use `dyn`: `dyn AsRef<OsStr>`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

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 | static NONE: (AsRef<OsStr>, u8);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: internal compiler error: compiler/rustc_middle/src/ty/layout.rs:370:17: univariant: field #2 of `(dyn AsRef<[type error]>, u8)` comes after unsized field

thread 'rustc' panicked at 'Box<Any>', /rustc/a836d9b6413d9d593be6c09463ff8c4c70e56599/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.53.0-nightly (a836d9b64 2021-04-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [layout_raw] computing layout of `(dyn std::convert::AsRef<[type error]>, u8)`
#1 [check_mod_item_types] checking item types in top-level module
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

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

error: free static item without body
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | static NONE: (AsRef<OsStr>, u8);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
  |                                |
  |                                help: provide a definition for the static: `= <expr>;`

error[E0412]: cannot find type `OsStr` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:21
  |
1 | static NONE: (AsRef<OsStr>, u8);
  |                     ^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::ffi::OsStr;
  |

warning: trait objects without an explicit `dyn` are deprecated
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:15
  |
1 | static NONE: (AsRef<OsStr>, u8);
  |               ^^^^^^^^^^^^ help: use `dyn`: `dyn AsRef<OsStr>`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

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 | static NONE: (AsRef<OsStr>, u8);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: internal compiler error: compiler/rustc_middle/src/ty/layout.rs:370:17: univariant: field #2 of `(dyn AsRef<[type error]>, u8)` comes after unsized field

thread 'rustc' panicked at 'Box<Any>', /rustc/a836d9b6413d9d593be6c09463ff8c4c70e56599/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>::univariant_uninterned
   8: rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>::layout_raw_uncached
   9: rustc_middle::ty::layout::layout_raw
  10: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::layout_raw>::compute
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  12: rustc_data_structures::stack::ensure_sufficient_stack
  13: rustc_query_system::query::plumbing::force_query_with_job
  14: rustc_query_system::query::plumbing::get_query_impl
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_raw
  16: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of
  17: rustc_typeck::check::check::check_static_inhabited
  18: rustc_typeck::check::check::check_item_type
  19: rustc_middle::hir::map::Map::visit_item_likes_in_module
  20: rustc_typeck::check::check::check_mod_item_types
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_query_system::query::plumbing::force_query_with_job
  23: rustc_query_system::query::plumbing::get_query_impl
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
  25: rustc_session::utils::<impl rustc_session::session::Session>::time
  26: rustc_typeck::check_crate
  27: rustc_interface::passes::analysis
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_data_structures::stack::ensure_sufficient_stack
  30: rustc_query_system::query::plumbing::force_query_with_job
  31: rustc_query_system::query::plumbing::get_query_impl
  32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  33: rustc_interface::passes::QueryContext::enter
  34: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  35: rustc_span::with_source_map
  36: rustc_interface::interface::create_compiler_and_run
  37: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.53.0-nightly (a836d9b64 2021-04-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [layout_raw] computing layout of `(dyn std::convert::AsRef<[type error]>, u8)`
#1 [check_mod_item_types] checking item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions