1
Fork 0

make PointerKind directly reflect pointer types

The code that consumes PointerKind (`adjust_for_rust_scalar` in rustc_ty_utils)
ended up using PointerKind variants to talk about Rust reference types (& and
&mut) anyway, making the old code structure quite confusing: one always had to
keep in mind which PointerKind corresponds to which type. So this changes
PointerKind to directly reflect the type.

This does not change behavior.
This commit is contained in:
Ralf Jung 2022-12-27 12:31:17 +01:00
parent 0c13c17250
commit 201ae73872
4 changed files with 40 additions and 59 deletions

View file

@ -29,6 +29,12 @@ pub fn borrow(x: &i32) -> &i32 {
x
}
// CHECK: align 4 {{i32\*|ptr}} @borrow_mut({{i32\*|ptr}} align 4 %x)
#[no_mangle]
pub fn borrow_mut(x: &mut i32) -> &mut i32 {
x
}
// CHECK-LABEL: @borrow_call
#[no_mangle]
pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {