rust/compiler
Jubilee 3313e760d0
Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay
remove const-support for align_offset and is_aligned

As part of the recent discussion to stabilize `ptr.is_null()` in const context, the general vibe was that it's okay for a const function to panic when the same operation would work at runtime (that's just a case of "dynamically detecting that something is not supported as a const operation"), but it is *not* okay for a const function to just return a different result.

Following that, `is_aligned` and `is_aligned_to` have their const status revoked in this PR, since they do return actively wrong results at const time. In the future we can consider having a new intrinsic or so that can check whether a pointer is "guaranteed to be aligned", but the current implementation based on `align_offset` does not have the behavior we want.

In fact `align_offset` itself behaves quite strangely in const, and that support needs a bunch of special hacks. That doesn't seem worth it. Instead, the users that can fall back to a different implementation should just use const_eval_select directly, and everything else should not be made const-callable. So this PR does exactly that, and entirely removes const support for align_offset.

Closes some tracking issues by removing the associated features:
Closes https://github.com/rust-lang/rust/issues/90962
Closes https://github.com/rust-lang/rust/issues/104203

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-11-03 20:08:13 -08:00
..
rustc
rustc_abi
rustc_arena
rustc_ast Do not format generic consts 2024-11-02 20:25:06 +00:00
rustc_ast_ir
rustc_ast_lowering
rustc_ast_passes Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_ast_pretty
rustc_attr
rustc_baked_icu_data
rustc_borrowck compiler: Replace rustc_target with _abi in _borrowck 2024-11-02 20:31:47 -07:00
rustc_builtin_macros
rustc_codegen_cranelift Auto merge of #132526 - bjorn3:sync_cg_clif-2024-11-02, r=bjorn3 2024-11-03 05:03:52 +00:00
rustc_codegen_gcc Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
rustc_codegen_llvm compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
rustc_codegen_ssa Rollup merge of #131222 - thejpster:fix-sparc-v7-symbol-o, r=workingjubilee 2024-11-03 20:08:13 -08:00
rustc_const_eval Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay 2024-11-03 20:08:13 -08:00
rustc_data_structures
rustc_driver
rustc_driver_impl make time format parsing compiletime 2024-11-03 15:51:39 +03:00
rustc_error_codes
rustc_error_messages
rustc_errors Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
rustc_expand
rustc_feature Yeet effects feature 2024-11-03 18:59:31 +00:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay 2024-11-03 20:08:13 -08:00
rustc_hir_analysis Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors 2024-11-03 15:25:00 -08:00
rustc_hir_pretty
rustc_hir_typeck Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors 2024-11-03 15:25:00 -08:00
rustc_incremental replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_index
rustc_index_macros
rustc_infer Remove or fix some FIXME(async_closure) 2024-11-02 03:33:31 +00:00
rustc_interface Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
rustc_lexer
rustc_lint compiler: Directly use rustc_abi in lints 2024-11-03 13:38:47 -08:00
rustc_lint_defs
rustc_llvm Auto merge of #132555 - matthiaskrgr:rollup-2d79661, r=matthiaskrgr 2024-11-03 13:46:47 +00:00
rustc_log
rustc_macros
rustc_metadata compiler: Directly use rustc_abi in metadata and middle 2024-11-03 13:38:47 -08:00
rustc_middle Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors 2024-11-03 15:25:00 -08:00
rustc_mir_build
rustc_mir_dataflow compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_mir_transform compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
rustc_monomorphize compiler: Add rustc_abi to _monomorphize 2024-11-02 20:31:47 -07:00
rustc_next_trait_solver Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_parse
rustc_parse_format
rustc_passes Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_pattern_analysis compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_privacy
rustc_query_impl
rustc_query_system replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_resolve
rustc_sanitizers compiler: Add rustc_abi to _sanitizers 2024-11-02 20:31:47 -07:00
rustc_serialize
rustc_session compiler: Directly use rustc_abi in session 2024-11-03 13:38:47 -08:00
rustc_smir compiler: Directly use rustc_abi in smir again 2024-11-03 13:38:47 -08:00
rustc_span remove const-support for align_offset 2024-11-03 17:00:44 +01:00
rustc_symbol_mangling compiler: Replace rustc_target with abi in symbol_mangling 2024-11-03 13:38:47 -08:00
rustc_target Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
rustc_trait_selection Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_traits
rustc_transmute
rustc_ty_utils Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors 2024-11-03 15:25:00 -08:00
rustc_type_ir Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_type_ir_macros
stable_mir