summary refs log tree commit diff
path: root/tests/ui/layout
AgeCommit message (Collapse)AuthorLines
2024-11-10Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errorsbors-12/+10
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
2024-11-04Rollup merge of #132583 - mejrs:tuples, r=compiler-errorsMatthias Krüger-0/+4
Suggest creating unary tuples when types don't match a trait When you want to have a variadic function, a common workaround to implement this is to create a trait and then implement that trait for various tuples. For example in `pyo3` there exists ```rust /// Calls the object with only positional arguments. pub fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> PyResult<&PyAny> { ... } ``` with various impls like ```rust impl<A: IntoPy<PyObject> IntoPy<Py<PyAny>> for (A,) impl<A: IntoPy<PyObject, B: IntoPy<PyObject> IntoPy<Py<PyAny>> for (A, B) ... etc ``` This means that if you want to call the method with a single item you have to create a unary tuple, like `(x,)`, rather than just `x`. This PR implements a suggestion to do that, if applicable.
2024-11-04Suggest creating unary tuplesmejrs-0/+4
2024-11-03use backticks instead of single quotes when reporting "use of unstable ↵dianne-6/+6
library feature" This is consistent with all other diagnostics I could find containing features and enables the use of `DiagSymbolList` for generalizing diagnostics for unstable library features to multiple features.
2024-11-01Emit warning when calling/declaring functions with unavailable vectors.Luca Versari-12/+10
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
2024-10-30tests: Bless `rustc_abi::Abi::Aggregate` => `::Memory`Jubilee Young-47/+47
2024-10-25Revert "Emit error when calling/declaring functions with unavailable vectors."Rémy Rakic-10/+12
This reverts commit 5af56cac38fa48e4228e5e123d060e85eb1acbf7.
2024-10-25Auto merge of #127731 - veluca93:abi_checks, r=RalfJungbors-12/+10
Emit future-incompatibility lint when calling/declaring functions with vectors that require missing target feature 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 https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization error 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. r? RalfJung Part of https://github.com/rust-lang/rust/issues/116558
2024-10-25Emit error when calling/declaring functions with unavailable vectors.Luca Versari-12/+10
On some architectures, vector types may have a different ABI when relevant target features are enabled. As discussed in https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code. This commit makes it an error 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.
2024-10-20compiler: Reject impossible reprs during enum layoutJubilee Young-4/+107
2024-10-20compiler: pre-move code for fixing enum layout ICEsJubilee Young-0/+47
2024-10-08Dont ICE when encountering post-mono layout cycle errorMichael Goulet-0/+123
2024-09-20TL note: current means targetJubilee Young-4/+4
2024-09-17get rid of an old hackLukas Markeffsky-0/+65
For structs that cannot be unsized, the layout algorithm sometimes moves unsized fields to the end of the struct, which circumvented the error for unexpected unsized fields and returned an unsized layout anyway. This commit makes it so that the unexpected unsized error is always returned for structs that cannot be unsized, allowing us to remove an old hack and fixing some old ICE.
2024-09-16layout computation: eagerly error for unexpected unsized fieldsLukas Markeffsky-1/+141
2024-09-09Ban non-array SIMDScott McMurray-1/+1
2024-07-24Rollup merge of #126152 - RalfJung:size_of_val_raw, r=saethlinMatthias Krüger-0/+22
size_of_val_raw: for length 0 this is safe to call For motivation, see https://github.com/rust-lang/unsafe-code-guidelines/issues/465, specifically around [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/465#issuecomment-2136401114). Cc `@rust-lang/opsem`
2024-07-11Always use a colon in `//@ normalize-*:` headersZalathar-11/+11
2024-07-10size_of_val_raw: for length 0 this is safe to callRalf Jung-0/+22
2024-06-25Auto merge of #125740 - RalfJung:transmute-size-check, r=oli-obkbors-1/+1
transmute size check: properly account for alignment Fixes another place where ZST alignment was ignored when checking whether something is a newtype. I wonder how many more of these there are... Fixes https://github.com/rust-lang/rust/issues/101084
2024-05-30transmute size check: properly account for alignmentRalf Jung-1/+1
2024-05-28Allow type_of to return partially non-error types if the type was already ↵Oli Scherer-4/+35
tainted
2024-04-23Rollup merge of #124057 - gurry:124031-ice-layout-errored, r=compiler-errorsMatthias Krüger-0/+32
Fix ICE when ADT tail has type error Fixes #124031
2024-04-22Stabilize generic `NonZero`.Markus Reiter-6/+4
2024-04-22Fix ICE when ADT tail has type errorGurinder Singh-0/+32
2024-04-06add test for ICE: Unexpected unsized type tail: &ReStatic [u8] #122488Matthias Krüger-0/+37
Fixes https://github.com/rust-lang/rust/issues/122488
2024-04-06add test for ICE: !base.layout().is_sized() #123078Matthias Krüger-0/+48
Fixes https://github.com/rust-lang/rust/issues/123078
2024-04-04Error out of layout calculation if a non-last struct field is unsizedGurinder Singh-0/+185
Fixes an ICE that occurs when a struct with an unsized field at a non-last position is const evaluated.
2024-03-25add test for ICE: failed to get layout for [type error] #92979Matthias Krüger-0/+94
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25add test for Compiler panic using fn_traits #81974Matthias Krüger-0/+137
Fixes https://github.com/rust-lang/rust/issues/81974
2024-03-13Auto merge of #121668 - erikdesjardins:commonprim, r=scottmcm,oli-obkbors-1/+51
Represent `Result<usize, Box<T>>` as ScalarPair(i64, ptr) This allows types like `Result<usize, std::io::Error>` (and integers of differing sign, e.g. `Result<u64, i64>`) to be passed in a pair of registers instead of through memory, like `Result<u64, u64>` or `Result<Box<T>, Box<U>>` are today. Fixes #97540. r? `@ghost`
2024-03-06Check that return type is WF in typeckGurinder Singh-1/+12
Without it non-WF types could pass typeck and then later fail in MIR/const eval
2024-02-28fix test failure due to differing u64 alignment on different targetsErik Desjardins-3/+3
2024-02-27allow using scalarpair with a common prim of ptr/ptr-sized-intErik Desjardins-1/+51
2024-02-25Use generic `NonZero` in tests.Markus Reiter-20/+23
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-29/+29
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-4/+13
2024-01-27Update tests.Markus Reiter-1/+1
2024-01-19Remove feature(offset_of) from testsGeorge Bateman-1/+0
2024-01-18Remove no-longer-needed `allow(dead_code)` from the testsJake Goulding-1/+1
`repr(transparent)` now silences the lint.
2024-01-11Silence follow up errors if astconv already erroredOli Scherer-23/+3
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-2/+2
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-2/+2
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-9/+9
corresponding `check_well_formed` diagnostics
2023-11-24Show number in error message even for one errorNilstrieb-4/+4
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-27fix failure to detect a too-big-type after adding paddingRalf Jung-0/+26
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-3/+23
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-13/+4
2023-09-11Rollup merge of #115708 - RalfJung:homogeneous, r=davidtwcoMatthias Krüger-0/+76
fix homogeneous_aggregate not ignoring some ZST This is an ABI-breaking change, because it fixes bugs in our ABI code. I'm not sure what that means for this PR, we don't really have a process for such changes, do we? I can only hope nobody relied on the old buggy behavior. Fixes https://github.com/rust-lang/rust/issues/115664
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-5/+5
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.