Commit graph

6 commits

Author SHA1 Message Date
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
Lukas Bergdoll
2f3b952349 Stabilize assert_matches 2026-02-11 14:13:44 +01:00
Lukas Bergdoll
58be5d6620 Move assert_matches to planned stable path 2026-01-21 23:17:24 +01:00
Celina G. Val
2cf9b7f5e5 Fix name() functions for local defs in rustc_public
The `name()` function specifies that it returns absolute path of items,
however it wasn't including the crate name for local items.

This change fixes that.

This was reported here: https://github.com/rust-lang/project-stable-mir/issues/109
2025-12-01 00:17:14 +00:00
Makai
4d79328091 use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
Makai
08e3cf5118 rename ui-fulldeps/stable-mir 2025-07-18 18:49:12 +00:00
Renamed from tests/ui-fulldeps/stable-mir/check_allocation.rs (Browse further)