diff options
| author | bors <bors@rust-lang.org> | 2023-01-06 15:20:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-06 15:20:58 +0000 |
| commit | afe8c4537c9009a251a31e8f022b7795fc305d4f (patch) | |
| tree | 47f65b14f307c56212bb6538f378970b5131c214 /src/test/codegen | |
| parent | 7bbbaabbb6ec93800409478e2af7bc063701604b (diff) | |
| parent | d165a6d70844020e4958ded4f80e30d64dd0bac1 (diff) | |
| download | rust-afe8c4537c9009a251a31e8f022b7795fc305d4f.tar.gz rust-afe8c4537c9009a251a31e8f022b7795fc305d4f.zip | |
Auto merge of #106474 - erikdesjardins:noalias, r=bjorn3
cleanup: handle -Zmutable-noalias like -Zbox-noalias r? `@bjorn3` cc `@RalfJung` this will conflict with #106180
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/noalias-flag.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/codegen/noalias-flag.rs b/src/test/codegen/noalias-flag.rs new file mode 100644 index 00000000000..a9ec61e286d --- /dev/null +++ b/src/test/codegen/noalias-flag.rs @@ -0,0 +1,23 @@ +// compile-flags: -O -Zmutable-noalias=no + +#![crate_type = "lib"] + +// `-Zmutable-noalias=no` should disable noalias on mut refs... + +// CHECK-LABEL: @test_mut_ref( +// CHECK-NOT: noalias +// CHECK-SAME: %x +#[no_mangle] +pub fn test_mut_ref(x: &mut i32) -> &mut i32 { + x +} + +// ...but not on shared refs + +// CHECK-LABEL: @test_ref( +// CHECK-SAME: noalias +// CHECK-SAME: %x +#[no_mangle] +pub fn test_ref(x: &i32) -> &i32 { + x +} |
