diff options
| author | bors <bors@rust-lang.org> | 2024-11-10 02:52:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-10 02:52:25 +0000 |
| commit | 7660aed73d5233fdd1ff2651fc8a6acab1b61691 (patch) | |
| tree | bb105208b620d54c194a677cf434122f89d28a4f /tests/ui/layout | |
| parent | 303fc0527aea5c7e9bbef97da926639e1ade3399 (diff) | |
| parent | c8b76bcf58298cced4ef3ca9dd823eb318fc11f5 (diff) | |
| download | rust-7660aed73d5233fdd1ff2651fc8a6acab1b61691.tar.gz rust-7660aed73d5233fdd1ff2651fc8a6acab1b61691.zip | |
Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errors
Emit warning when calling/declaring functions with unavailable vectors. On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558 r? RalfJung
Diffstat (limited to 'tests/ui/layout')
| -rw-r--r-- | tests/ui/layout/post-mono-layout-cycle-2.rs | 1 | ||||
| -rw-r--r-- | tests/ui/layout/post-mono-layout-cycle-2.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/layout/post-mono-layout-cycle.rs | 1 | ||||
| -rw-r--r-- | tests/ui/layout/post-mono-layout-cycle.stderr | 10 |
4 files changed, 10 insertions, 12 deletions
diff --git a/tests/ui/layout/post-mono-layout-cycle-2.rs b/tests/ui/layout/post-mono-layout-cycle-2.rs index 356f1e777c7..e9a5292fbbd 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.rs +++ b/tests/ui/layout/post-mono-layout-cycle-2.rs @@ -45,7 +45,6 @@ where T: Blah, { async fn ice(&mut self) { - //~^ ERROR a cycle occurred during layout computation let arr: [(); 0] = []; self.t.iter(arr.into_iter()).await; } diff --git a/tests/ui/layout/post-mono-layout-cycle-2.stderr b/tests/ui/layout/post-mono-layout-cycle-2.stderr index ad01c2694fa..2e8d237844e 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.stderr +++ b/tests/ui/layout/post-mono-layout-cycle-2.stderr @@ -12,12 +12,12 @@ LL | Blah::iter(self, iterator).await | = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future -error: a cycle occurred during layout computation - --> $DIR/post-mono-layout-cycle-2.rs:47:5 +note: the above error was encountered while instantiating `fn Wrap::<()>::ice` + --> $DIR/post-mono-layout-cycle-2.rs:56:9 | -LL | async fn ice(&mut self) { - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | t.ice(); + | ^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/layout/post-mono-layout-cycle.rs b/tests/ui/layout/post-mono-layout-cycle.rs index 8d136190c00..6753c01267e 100644 --- a/tests/ui/layout/post-mono-layout-cycle.rs +++ b/tests/ui/layout/post-mono-layout-cycle.rs @@ -14,7 +14,6 @@ struct Wrapper<T: Trait> { } fn abi<T: Trait>(_: Option<Wrapper<T>>) {} -//~^ ERROR a cycle occurred during layout computation fn indirect<T: Trait>() { abi::<T>(None); diff --git a/tests/ui/layout/post-mono-layout-cycle.stderr b/tests/ui/layout/post-mono-layout-cycle.stderr index 47f7f30b1cb..7f246b3d409 100644 --- a/tests/ui/layout/post-mono-layout-cycle.stderr +++ b/tests/ui/layout/post-mono-layout-cycle.stderr @@ -5,12 +5,12 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>` = note: cycle used when computing layout of `core::option::Option<Wrapper<()>>` = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: a cycle occurred during layout computation - --> $DIR/post-mono-layout-cycle.rs:16:1 +note: the above error was encountered while instantiating `fn abi::<()>` + --> $DIR/post-mono-layout-cycle.rs:19:5 | -LL | fn abi<T: Trait>(_: Option<Wrapper<T>>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | abi::<T>(None); + | ^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. |
