rust
rust copied to clipboard
error on alignments greater than `isize::MAX`
Fixes #131122
On zulip someone had a concern that it was legal to create a type with alignment isize::MAX + 1, but I do not believe this should be allowed for repr(align), as repr(align) also increases the size of the type, and that would be larger than the maximum allowed size of objects.
(cc @workingjubilee #131276)
r? @nnethercote
rustbot has assigned @nnethercote. 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
The job x86_64-gnu-llvm-18 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:c32c805632780b5c1de330e3f44561b336c2efe163bc0990acb392390157a8e1d9f855d75914a239aa40c49d77f4a837247d05d2f8d46f554b98e1f46712a3e3:
------
##[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-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
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-18', '--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-18/bin/llvm-config
configure: llvm.link-shared := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
failures:
---- [ui] tests/ui/attributes/arg-error-issue-121425.rs stdout ----
error: Error: expected failure status (Some(1)) but received status Some(101).
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/attributes/arg-error-issue-121425.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)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/attributes/arg-error-issue-121425" "-A" "unused" "-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/attributes/arg-error-issue-121425/auxiliary" "-Zdeduplicate-diagnostics=yes"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument
|
|
LL | #[repr(align(N))]
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align('a'))]
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align("str"))]
error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses
|
|
LL | #[repr(align())]
error[E0552]: incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument
|
|
LL | #[repr(packed(P))]
error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all
|
LL | #[repr(packed())]
| ^^^^^^^^
---
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
5: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
6: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
7: rustc_passes::check_attr::check_mod_attrs
[... omitted 2 frames ...]
8: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#4}::{closure#0}>::{closure#0}
9: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
10: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#0}>
11: rustc_interface::passes::analysis
[... omitted 2 frames ...]
13: <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>>
14: <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>>
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 (0faf11d8f 2024-10-12) 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 -Z deduplicate-diagnostics=yes
query stack during panic:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
---
---- [ui] tests/ui/attributes/nonterminal-expansion.rs stdout ----
error: Error: expected failure status (Some(1)) but received status Some(101).
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/attributes/nonterminal-expansion.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)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/attributes/nonterminal-expansion" "-A" "unused" "-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/attributes/nonterminal-expansion/auxiliary" "-Zdeduplicate-diagnostics=yes"
--- stderr -------------------------------
--- stderr -------------------------------
error: expected unsuffixed literal, found `n!()`
|
|
LL | #[repr(align($n))]
...
...
LL | pass_nonterminal!(n!());
|
= note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1800:64:
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1800:64:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
5: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
6: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
7: rustc_passes::check_attr::check_mod_attrs
[... omitted 2 frames ...]
8: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#4}::{closure#0}>::{closure#0}
9: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
10: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#0}>
11: rustc_interface::passes::analysis
[... omitted 2 frames ...]
13: <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>>
14: <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>>
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 (0faf11d8f 2024-10-12) 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 -Z deduplicate-diagnostics=yes
query stack during panic:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
end of query stack
error: aborting due to 1 previous error
------------------------------------------
---- [ui] tests/ui/repr/malformed-repr-hints.rs stdout ----
error: Error: expected failure status (Some(1)) but received status Some(101).
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/repr/malformed-repr-hints.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)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/malformed-repr-hints" "-A" "unused" "-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/repr/malformed-repr-hints/auxiliary" "-Zdeduplicate-diagnostics=yes"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all
|
LL | #[repr(packed())]
| ^^^^^^^^
error[E0589]: invalid `repr(align)` attribute: `align` needs an argument
|
|
LL | #[repr(align)]
| ^^^^^ help: supply an argument here: `align(...)`
error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses
|
|
LL | #[repr(align(2, 4))]
error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses
|
|
LL | #[repr(align())]
error[E0552]: invalid representation hint: `Rust` does not take a parenthesized argument list
##[error] --> /checkout/tests/ui/repr/malformed-repr-hints.rs:23:8
|
|
LL | #[repr(Rust(u8))]
error[E0552]: invalid representation hint: `Rust` does not take a parenthesized argument list
##[error] --> /checkout/tests/ui/repr/malformed-repr-hints.rs:25:8
|
|
LL | #[repr(Rust(0))]
error[E0552]: invalid representation hint: `Rust` does not take a value
##[error] --> /checkout/tests/ui/repr/malformed-repr-hints.rs:27:8
|
|
LL | #[repr(Rust = 0)]
error[E0552]: invalid representation hint: `i8` does not take a parenthesized argument list
##[error] --> /checkout/tests/ui/repr/malformed-repr-hints.rs:31:8
|
|
LL | #[repr(i8())]
error[E0552]: invalid representation hint: `u32` does not take a parenthesized argument list
|
|
LL | #[repr(u32(42))]
error[E0552]: invalid representation hint: `i64` does not take a value
##[error] --> /checkout/tests/ui/repr/malformed-repr-hints.rs:39:8
|
|
LL | #[repr(i64 = 2)]
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1800:64:
called `Option::unwrap()` on a `None` value
stack backtrace:
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
5: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
6: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
7: rustc_passes::check_attr::check_mod_attrs
[... omitted 2 frames ...]
8: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#4}::{closure#0}>::{closure#0}
9: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
10: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#0}>
11: rustc_interface::passes::analysis
[... omitted 2 frames ...]
13: <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>>
14: <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>>
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 (0faf11d8f 2024-10-12) 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 -Z deduplicate-diagnostics=yes
query stack during panic:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
---
---- [ui] tests/ui/repr/repr-align-assign.rs stdout ----
error: Error: expected failure status (Some(1)) but received status Some(101).
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/repr/repr-align-assign.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)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr-align-assign" "-A" "unused" "-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/repr/repr-align-assign/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0693]: incorrect `repr(align)` attribute format
|
|
LL | #[repr(align=8)] //~ ERROR incorrect `repr(align)` attribute format
| ^^^^^^^ help: use parentheses instead: `align(8)`
error[E0693]: incorrect `repr(align)` attribute format
|
|
LL | #[repr(align="8")] //~ ERROR incorrect `repr(align)` attribute format
| ^^^^^^^^^ help: use parentheses instead: `align(8)`
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1800:64:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: rust_begin_unwind
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
5: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
6: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
7: rustc_passes::check_attr::check_mod_attrs
[... omitted 2 frames ...]
8: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#4}::{closure#0}>::{closure#0}
9: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
10: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#0}>
11: rustc_interface::passes::analysis
[... omitted 2 frames ...]
13: <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>>
14: <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>>
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 (0faf11d8f 2024-10-12) 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:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
---
---- [ui] tests/ui/repr/repr-align.rs stdout ----
error: Error: expected failure status (Some(1)) but received status Some(101).
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/repr/repr-align.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)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr-align" "-A" "unused" "-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/repr/repr-align/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
##[error]error: internal compiler error: compiler/rustc_passes/src/check_attr.rs:1802:25: impossible case reached
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1802:25:
thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:1802:25:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
5: rustc_middle::util::bug::bug_fmt
6: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
6: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
7: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_item
8: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_passes::check_attr::CheckAttrVisitor>
9: rustc_passes::check_attr::check_mod_attrs
[... omitted 2 frames ...]
10: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}::{closure#4}::{closure#0}>::{closure#0}
11: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}>
12: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#0}>
13: rustc_interface::passes::analysis
[... omitted 2 frames ...]
15: <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>>
16: <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>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: please make sure that you have updated to the latest nightly
note: rustc 1.83.0-nightly (0faf11d8f 2024-10-12) 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:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
---
---- [ui] tests/ui/repr/repr_align_greater_usize.rs#msp430 stdout ----
error in revision `msp430`: test compilation failed although it shouldn't!
status: exit status: 1
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/repr/repr_align_greater_usize.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" "--cfg" "msp430" "--check-cfg" "cfg(FALSE,msp430,aarch32)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr_align_greater_usize.msp430" "-A" "unused" "-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/repr/repr_align_greater_usize.msp430/auxiliary" "--target=msp430-none-elf"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0589]: alignment must not be greater than `isize::MAX` bytes
##[error] --> /checkout/tests/ui/repr/repr_align_greater_usize.rs:22:8
|
LL | #[repr(align(32768))]
|
= note: `isize::MAX` is 32767 for the current target
error[E0589]: alignment must not be greater than `isize::MAX` bytes
##[error] --> /checkout/tests/ui/repr/repr_align_greater_usize.rs:25:8
|
LL | #[repr(align(65536))]
|
= note: `isize::MAX` is 32767 for the current target
error: aborting due to 2 previous errors
The job x86_64-gnu-llvm-18 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:c32c805632780b5c1de330e3f44561b336c2efe163bc0990acb392390157a8e1d9f855d75914a239aa40c49d77f4a837247d05d2f8d46f554b98e1f46712a3e3:
------
##[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-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
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-18', '--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-18/bin/llvm-config
configure: llvm.link-shared := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
failures:
---- [ui] tests/ui/repr/repr_align_greater_usize.rs#msp430 stdout ----
error in revision `msp430`: test compilation failed although it shouldn't!
status: exit status: 1
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/repr/repr_align_greater_usize.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" "--cfg" "msp430" "--check-cfg" "cfg(FALSE,msp430,aarch32)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr_align_greater_usize.msp430" "-A" "unused" "-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/repr/repr_align_greater_usize.msp430/auxiliary" "--target=msp430-none-elf"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0589]: alignment must not be greater than `isize::MAX` bytes
##[error] --> /checkout/tests/ui/repr/repr_align_greater_usize.rs:22:8
|
LL | #[repr(align(32768))]
|
= note: `isize::MAX` is 32767 for the current target
error[E0589]: alignment must not be greater than `isize::MAX` bytes
##[error] --> /checkout/tests/ui/repr/repr_align_greater_usize.rs:25:8
|
LL | #[repr(align(65536))]
|
= note: `isize::MAX` is 32767 for the current target
error: aborting due to 2 previous errors
"test compilation failed even though it shouldn't"... but it's a build-fail test???
"test compilation failed even though it shouldn't"... but it's a
build-failtest???
https://github.com/rust-lang/rust/issues/130894
The job x86_64-gnu-llvm-18 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:c32c805632780b5c1de330e3f44561b336c2efe163bc0990acb392390157a8e1d9f855d75914a239aa40c49d77f4a837247d05d2f8d46f554b98e1f46712a3e3:
------
##[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-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
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-18', '--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-18/bin/llvm-config
configure: llvm.link-shared := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
Downloaded boml v0.3.1
Compiling boml v0.3.1
Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
Finished `release` profile [optimized] target(s) in 3.57s
Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
---- [ui] tests/ui/repr/repr-align.rs stdout ----
diff of stderr:
46 LL | #[repr(align(0))]
48
48
+ error[E0589]: alignment must not be greater than `isize::MAX` bytes
+ |
+ |
+ LL | #[repr(align(4294967296))]
+ |
+ = note: `isize::MAX` is 2147483647 for the current target
+
+
+ error[E0589]: alignment must not be greater than `isize::MAX` bytes
+ |
+ |
+ LL | #[repr(align(4294967296))]
+ |
+ = note: `isize::MAX` is 2147483647 for the current target
+
+
49 error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
51 |
110 |
110 |
111 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- error: aborting due to 16 previous errors
+ error: aborting due to 18 previous errors
114
115 For more information about this error, try `rustc --explain E0589`.
---
To only update this specific test, also pass `--test-args repr/repr-align.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
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/repr/repr-align.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=i686-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr-align" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=x86_64-linux-gnu-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repr/repr-align/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
error[E0589]: alignment must not be greater than `isize::MAX` bytes
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
|
= note: `isize::MAX` is 2147483647 for the current target
error[E0589]: alignment must not be greater than `isize::MAX` bytes
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
|
= note: `isize::MAX` is 2147483647 for the current target
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
|
|
LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
|
|
LL | #[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 18 previous errors
For more information about this error, try `rustc --explain E0589`.
------------------------------------------
r? @workingjubilee
as
repr(align)also increases the size of the type, and that would be larger than the maximum allowed size of objects.
repr(align) can be applied to unit/ZST structs without increasing their size, so #[repr(align(32768))] struct ZST; is possible on 16-bit targets and currently does not error. (though it might be enough of an edge case to disallow anyway).
#![no_std]
#[repr(align(32768))]
struct Hello;
pub fn foo() -> usize { core::mem::align_of::<Hello>() }
This currently compiles fine with cargo +nightly build -Z build-std=core --target avr-unknown-gnu-atmega328 --release, but fails on this branch with
error[E0589]: alignment must not be greater than `isize::MAX` bytes
--> src/lib.rs:4:8
|
4 | #[repr(align(32768))]
| ^^^^^^^^^^^^
|
= note: `isize::MAX` is 32767 for the current target
For more information about this error, try `rustc --explain E0589`.
cc @Patryk27 as prospective maintainer for AVR cc @cr1901 because you're the one who comes to mind re: MSP430
You are the only targets affected by this, as all other targets have a bound on repr(align(N)) that is already below isize::MAX, functionally imposed by our codegen backends.
Do you think this #[repr(align(32768))] struct Hello16BitAlign; has any real use-case on AVR? Even a somewhat silly one?
Note that #[repr(align(16384))] struct Hello16BitSize(u8); is the limit for actually-sized types.
ah i see, i was under the impression repr(align) increased the size for structs that would otherwise be 1-ZSTs, i can probably add an exception if it's needed then? i do think this is a slightly weird use case, but i'm mostly neutral on this, and dont work with any 16 bit targets for rust to know what they might need.
I've never used Rust on an MSP430 with more than 10kB (8+2kB) of RAM. MSP430's max out at 512kB ROM and 66kB RAM.
However, from what I can gather, actual existing MSP430s top out at 18kB (16+2kB) of RAM without relying on stuff unsupported by LLVM. Given such constraints, #[repr(align(32768))]- or even #[repr(align(16384))], or #[repr(align(8192))], etc- isn't usable in practice.
If LLVM gets these features to access 20-bit addresses, I don't see how I'd use such functionality for RAM; you only have 64kB continguous RAM anyway- the other 2kB is a ~~marketing gimmick~~ "bonus" if you're not using the USB peripheral, at a much lower address than the rest of RAM. And having 20 ZSTs 32kB apart in ROM doesn't seem that useful either.
Do you think this
#[repr(align(32768))] struct Hello16BitAlign;has any real use-case on AVR? Even a somewhat silly one?
I don't think so - I mean, I think ideally we'd throw this error on instantiating the struct, so that a mere fact of such type existing wasn't a failure (as in @zachs18's example), but I think there's no point in doing more complex analysis considering it's already quite an edge case.
Okay!
Then if people using the targets cannot think of a good reason for us to support an alignment greater than isize::MAX, zero-sized type or no: let us not, and keep the rule consistent.
Unfortunately I don't know that this is the right place to emit this check, so having determined that, its implementation seems correct, but it would be good if someone with experience with rustc_passes could actually weigh in.
hmm, recent history (and a coinflip) says...
r? @jieyouxu
Unfortunately I don't know that this is the right place to emit this check [...]
I explored an alternative approach doing the error in the same location that the 2^64 check was emitted in rustc_attr::builtin::parse_alignment, but was unsatisfied with how the &'static str error type was being used and changing the call sites seemed non-trivial because it is used for repr(packed) as well.
... on further thought, should this isize::MAX check be done for repr(packed(N))? Since repr(packed) can only lower alignment, it's probably not necessary?
@rustbot author
@rustbot ready
will open a zulip thread about the potential follow up PR for repr(align), though personally i don't think it's necessary
Dropped the redundant check-fail, no other changes.
@bors r+ rollup=iffy
:pushpin: Commit 6fc7ce43d2f2cd2fef1b75c9c59f13f312e0d9d8 has been approved by jieyouxu
It is now in the queue for this repository.
:hourglass: Testing commit 6fc7ce43d2f2cd2fef1b75c9c59f13f312e0d9d8 with merge 66701c42263042f7120385725606edeb987ad4f1...