rust/tests/ui-fulldeps/rustc_public
Martin Nordholts 1e367f9663 tests: rustc_public: Check const allocation for all variables (1 of 11 was missing)
In the test `tests/ui-fulldeps/rustc_public/check_allocation.rs` there
is a check for constant allocations of local variables of this function:

    fn other_consts() {{
        let _max_u128 = u128::MAX;
        let _min_i128 = i128::MIN;
        let _max_i8 = i8::MAX;
        let _char = 'x';
        let _false = false;
        let _true = true;
        let _ptr = &BAR;
        let _null_ptr: *const u8 = NULL;
        let _tuple = TUPLE;
        let _char_id = const {{ type_id::<char>() }};
        let _bool_id = const {{ type_id::<bool>() }};
    }}

The current test only finds 10 out of 11 allocations. The constant
allocation for

    let _ptr = &BAR;

is not checked, because the `SingleUseConsts` MIR pass does not optimize
away that assignment. Add code to also collect constant allocation from
assignment rvalues. Not only does this change make sense on its own, it
also makes the test pass both with and without the `SingleUseConsts`
pass.
2026-02-14 19:51:56 +01:00
..
check_abi.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_allocation.rs tests: rustc_public: Check const allocation for all variables (1 of 11 was missing) 2026-02-14 19:51:56 +01:00
check_assoc_items.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_attribute.rs Fix name() functions for local defs in rustc_public 2025-12-01 00:17:14 +00:00
check_binop.rs use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
check_coroutine_body.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_crate_defs.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_def_parent.rs Fix name and pretty print now uses trimmed_name 2025-12-01 01:34:14 +00:00
check_def_ty.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_defs.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_foreign.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_instance.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_intrinsics.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_item_kind.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_normalization.rs use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
check_trait_queries.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_transform.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_ty_fold.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
check_variant.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
closure-generic-body.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
closure_body.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
compilation-result.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
crate-info.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
projections.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
smir_internal.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
smir_serde.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00
smir_visitor.rs Stabilize assert_matches 2026-02-11 14:13:44 +01:00