rust/compiler/rustc_monomorphize
Matthias Krüger 3481c0d3cb
Rollup merge of #150569 - check_static_initializer_acyclic, r=workingjubilee
Ensure that static initializers are acyclic for NVPTX

NVPTX does not support cycles in static initializers (see rust-lang/rust#146787). LLVM produces an error when attempting to generate code for such constructs, like self-referential structs.

To avoid LLVM UB, we emit a post-monomorphization error on the Rust side before reaching codegen.

This is achieved by analyzing a subgraph of the "mono item graph" that only contains statics.
1. Calculate the strongly connected components (SCCs) of the graph.
2. Check for cycles (more than one node in an SCC or one node that references itself).
2026-01-08 16:25:30 +01:00
..
src Rollup merge of #150569 - check_static_initializer_acyclic, r=workingjubilee 2026-01-08 16:25:30 +01:00
Cargo.toml Ensure that static initializers are acyclic for NVPTX 2026-01-06 17:00:21 +01:00
messages.ftl Ensure that static initializers are acyclic for NVPTX 2026-01-06 17:00:21 +01:00