Skip to content

[ICE]: malformed repr(align(N)) #132693

Closed as not planned
Closed as not planned
@wxie7

Description

@wxie7

Code

#![crate_type = "lib"]
#![feature(fn_align)]
#[no_mangle]
#[repr(align(16))]
pub fn fn_align() {}
pub struct A;
impl A {
    #[no_mangle]
    #[repr(align(16))]
    pub fn method_align(self) {}
    #[no_mangle]
    #[repr(align(no_mangle))]
    pub fn associated_fn() {}
}
trait T: Sized {
    fn trait_fn() {}
    #[repr(align(32))]
    fn trait_method(self) {}
}
impl T for A {
    #[no_mangle]
    #[repr(align(16))]
    fn trait_fn() {}
    #[no_mangle]
    #[repr(align(16))]
    fn trait_method(self) {}
}
impl T for () {}
pub fn foo() {
    ().trait_method();
}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.84.0-nightly (bc5cf99 2024-11-05)
binary: rustc
commit-hash: bc5cf99
commit-date: 2024-11-05
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Current error output

No response

Backtrace

     0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
     1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
     2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
     3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
     4: <rustc_passes::check_attr::CheckAttrVisitor>::check_attributes
     5: <rustc_passes::check_attr::CheckAttrVisitor as rustc_hir::intravisit::Visitor>::visit_impl_item
     6: rustc_passes::check_attr::check_mod_attrs
     7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
     8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
     9: rustc_query_impl::query_impl::check_mod_attrs::get_query_non_incr::__rust_end_short_backtrace
    10: <rustc_middle::hir::map::Map>::par_for_each_module::<rustc_interface::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}::{closure#0}>::{closure#0}
    11: rustc_interface::passes::run_required_analyses
    12: rustc_interface::passes::analysis
    13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
    14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    15: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    16: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    17: std::sys::backtrace::__rust_begin_short_backtrace::<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}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
    18: <<std::thread::Builder>::spawn_unchecked_<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}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    19: std::sys::pal::unix::thread::Thread::new::thread_start
    20: start_thread
               at ./nptl/pthread_create.c:442:8
    21: __GI___clone3
               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Anything else?

note: compiler flags: --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.F-fn_align`#![feature(fn_align)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions