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

compiler: Fix handling of repr(align(N), simd) #130460

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

workingjubilee
Copy link
Member

The attributes may not be sensible to combine in user code, but they should still work.

Fixes #130402

@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2024

r? @pnkfelix

rustbot has assigned @pnkfelix.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 17, 2024
@rust-log-analyzer

This comment has been minimized.

The attributes may not be sensible to combine in user code, but
they should still work.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
------
 > importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:fb97a1d6377f6cf2227825318ca4bbde3889e0c420746f5a03ba46a07e9a862725c26a09b9fc49a0d129ebd75935d3f6cd19acf41cc4267a6846fd4aa574b12c:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [ui] tests/ui/simd/repr-align-and-simd.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/simd/repr-align-and-simd.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/simd/repr-align-and-simd/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/simd/repr-align-and-simd/auxiliary"
--- stderr -------------------------------
thread 'rustc' panicked at compiler/rustc_ty_utils/src/layout_sanity_check.rs:79:9:
assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {
assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {
    ty: IntelsIdeaOfWhatAvx512Means,
    layout: Layout {
        size: Size(64 bytes),
        align: AbiAndPrefAlign {
            abi: Align(64 bytes),
            pref: Align(64 bytes),
        abi: Vector {
            element: Initialized {
                value: Int(
                    I8,
---
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_abi::Align, rustc_abi::Align>
   4: rustc_ty_utils::layout::layout_of
      [... omitted 2 frames ...]
   5: rustc_hir_analysis::check::check::check_transparent::{closure#0}
   6: <core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::VariantDef>, <rustc_middle::ty::adt::AdtDef>::all_fields::{closure#0}> as core::iter::traits::iterator::Iterator>::fold::<usize, <core::iter::adapters::flatten::FlattenCompat<_, _>>::iter_fold::flatten<core::slice::iter::Iter<rustc_middle::ty::FieldDef>, usize, <core::iter::adapters::flatten::FlattenCompat<_, _> as core::iter::traits::iterator::Iterator>::fold::flatten<core::slice::iter::Iter<rustc_middle::ty::FieldDef>, usize, core::iter::adapters::map::map_fold<&rustc_middle::ty::FieldDef, (rustc_span::span_encoding::Span, bool, core::option::Option<(&str, rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>, bool)>), usize, rustc_hir_analysis::check::check::check_transparent::{closure#0}, core::iter::adapters::filter_map::filter_map_fold<(rustc_span::span_encoding::Span, bool, core::option::Option<(&str, rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>, bool)>), rustc_span::span_encoding::Span, usize, rustc_hir_analysis::check::check::check_transparent::{closure#1}, <core::iter::adapters::filter_map::FilterMap<core::iter::adapters::map::Map<core::iter::adapters::flatten::FlatMap<core::slice::iter::Iter<rustc_middle::ty::VariantDef>, core::slice::iter::Iter<rustc_middle::ty::FieldDef>, <rustc_middle::ty::adt::AdtDef>::all_fields::{closure#0}>, rustc_hir_analysis::check::check::check_transparent::{closure#0}>, rustc_hir_analysis::check::check::check_transparent::{closure#1}> as core::iter::traits::iterator::Iterator>::count::{closure#0}>::{closure#0}>::{closure#0}>::{closure#0}>::{closure#0}>
   8: rustc_hir_analysis::check::check::check_item_type
   9: rustc_hir_analysis::check::wfcheck::check_well_formed
   9: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 2 frames ...]
  10: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_impl_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#1}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
  11: <rustc_middle::hir::ModuleItems>::par_items::<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#0}>
  12: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
      [... omitted 2 frames ...]
  13: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_hir_analysis::check_crate::{closure#0}::{closure#0}>::{closure#0}
  14: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#0}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
  16: rustc_interface::passes::analysis
  16: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  18: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  19: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  20: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
note: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (25b9b80da 2024-09-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
query stack during panic:
#0 [layout_of] computing layout of `IntelsIdeaOfWhatAvx512Means`
#1 [check_well_formed] checking that `DesignValidation` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
end of query stack
------------------------------------------


@workingjubilee
Copy link
Member Author

workingjubilee commented Sep 17, 2024

@rustbot author

This needs some extra work on pulling out the assertions that the code is making. Some, anyways.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2024
@workingjubilee workingjubilee marked this pull request as draft September 17, 2024 07:02
@bors
Copy link
Contributor

bors commented Oct 31, 2024

☔ The latest upstream changes (presumably #132371) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When a type is #[repr(simd)], #[repr(align(N))] annotations are ignored.
5 participants