about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-06-04Rollup merge of #141888 - ferrocene:lw/decouple-tests-from-2015, ↵Matthias Krüger-193/+194
r=compiler-errors Use non-2015 edition paths in tests that do not test for their resolution This allows for testing these tests on editions other than 2015
2025-06-04Rollup merge of #141250 - folkertdev:s390x-z17-target-features, r=workingjubileeMatthias Krüger-0/+12
add s390x z17 target features tracking issue: https://github.com/rust-lang/rust/issues/130869 earlier target features were added in https://github.com/rust-lang/rust/pull/135630, and https://github.com/rust-lang/rust/issues/135413#issuecomment-2886439455 has some extra context on these new features. r? ``@ghost`` cc ``@uweigand``
2025-06-04Rollup merge of #137306 - tgross35:remove-i128-u128-improper-ctypes, ↵Matthias Krüger-218/+60
r=traviscross,workingjubilee Remove `i128` and `u128` from `improper_ctypes_definitions` Rust's 128-bit integers have historically been incompatible with C [1]. However, there have been a number of changes in Rust and LLVM that mean this is no longer the case: * Incorrect alignment of `i128` on x86 [1]: adjusting Rust's alignment proposed at https://github.com/rust-lang/compiler-team/issues/683, implemented at https://github.com/rust-lang/rust/pull/116672. * LLVM version of the above: resolved in LLVM, including ABI fix. Present in LLVM18 (our minimum supported version). * Incorrect alignment of `i128` on 64-bit PowerPC, SPARC, and MIPS [2]: Rust's data layouts adjusted at https://github.com/rust-lang/rust/pull/132422, https://github.com/rust-lang/rust/pull/132741, https://github.com/rust-lang/rust/pull/134115. * LLVM version of the above: done in LLVM 20 https://github.com/llvm/llvm-project/issues/102783. * Incorrect return convention of `i128` on Windows: adjusted to match GCC and Clang at https://github.com/rust-lang/rust/pull/134290. At https://github.com/rust-lang/lang-team/issues/255#issuecomment-2088855084, the lang team considered it acceptable to remove `i128` from `improper_ctypes_definitions` if the LLVM version is known to be compatible. Time has elapsed since then and we have dropped support for LLVM versions that do not have the x86 fixes, meaning a per-llvm-version lint should no longer be necessary. The PowerPC, SPARC, and MIPS changes only came in LLVM 20 but since Rust's datalayouts have also been updated to match, we will be using the correct alignment regardless of LLVM version. `repr(i128)` was added to this lint in https://github.com/rust-lang/rust/pull/138282, but is also removed here. Part of the decision is that `i128` should match `__int128` in C on platforms that provide it, which documentation is updated to indicate. We will not guarantee that `i128` matches `_BitInt(128)` since that can be different from `__int128`. Some platforms (usually 32-bit) do not provide `__int128`; if any ABIs are extended in the future to define it, we will need to make sure that our ABI matches. Closes: https://github.com/rust-lang/rust/issues/134288 [1]: https://github.com/rust-lang/rust/issues/54341 [2]: https://github.com/rust-lang/rust/issues/128950
2025-06-03Rollup merge of #141957 - ferrocene:lw/missing-dyn-kw2, r=compiler-errorsMatthias Krüger-31/+26
Add missing `dyn` keywords to tests that do not test for them Part 2 Some more tests that were found
2025-06-03Rollup merge of #141943 - nnethercote:rm-pre-expansion-ast-stats, ↵Matthias Krüger-117/+60
r=compiler-errors Remove pre-expansion AST stats. They're very little value, because they only measure the top-level `main.rs` or `lib.rs` file. (Other `.rs` files don't get read and parsed until expansion occurs.) I saw an example recently where the pre-expansion AST was 3KB in size and the post-expansion AST was 66MB. I kept the "POST EXPANSION" in the output header, I think that's useful information to avoid possible confusion about when the measurement happens. r? `@davidtwco`
2025-06-03Rollup merge of #141698 - oli-obk:ctfe-err-flip, r=RalfJungMatthias Krüger-4233/+4082
Use the informative error as the main const eval error message r? `@RalfJung` I only did the minimal changes necessary to the const eval error machinery. I'd prefer not to mix test changes with refactorings 😆
2025-06-03Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3Matthias Krüger-1/+3
Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi` Our `conv_from_spec_abi`, `adjust_abi`, and `is_abi_supported` combine to give us a very confusing way of reasoning about what _actual_ calling convention we want to lower our code to and whether we want to compile the resulting code at all. Instead of leaving this code as a miniature adventure game in which someone tries to combine stateful mutations into a Rube Goldberg machine that will let them escape the maze and arrive at the promised land of codegen, we let `AbiMap` devour this complexity. Once you have an `AbiMap`, you can answer which `ExternAbi`s will lower to what `CanonAbi`s (and whether they will lower at all). Removed: - `conv_from_spec_abi` replaced by `AbiMap::canonize_abi` - `adjust_abi` replaced by same - `Conv::PreserveAll` as unused - `Conv::Cold` as unused - `enum Conv` replaced by `enum CanonAbi` target-spec.json changes: - If you have a target-spec.json then now your "entry-abi" key will be specified in terms of one of the `"{abi}"` strings Rust recognizes, e.g. ```json "entry-abi": "C", "entry-abi": "win64", "entry-abi": "aapcs", ```
2025-06-03Rollup merge of #137725 - oli-obk:i-want-to-move-it-move-it, ↵Matthias Krüger-15/+630
r=compiler-errors,traviscross Add `iter` macro See related discussion in https://rust-lang.zulipchat.com/#narrow/channel/481571-t-lang.2Fgen/topic/iter!.20macro/near/500784563 very little error case testing so far, but the success path works. There is also no `IterFn` trait yet, as T-lang didn't consider it something urgently needed I think we can implement it in follow-up PRs. r? lang for the tests, `@compiler-errors` for the impl
2025-06-03Add `iter` macroOli Scherer-15/+630
This adds an `iter!` macro that can be used to create movable generators. This also adds a yield_expr feature so the `yield` keyword can be used within iter! macro bodies. This was needed because several unstable features each need `yield` expressions, so this allows us to stabilize them separately from any individual feature. Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de> Co-authored-by: Jieyou Xu <jieyouxu@outlook.com> Co-authored-by: Travis Cross <tc@traviscross.com>
2025-06-03bless test for CanonAbi::X86(SysV64) changeJubilee Young-1/+3
2025-06-03Rollup merge of #141833 - Kivooeo:test-reform1, r=jieyouxuMatthias Krüger-32/+51
`tests/ui`: A New Order [2/N] part of rust-lang/rust#133895 r? `@jieyouxu` let's try this kind of commits, one for each file, commit's name shows what i did, hope this is not harder to review than previous
2025-06-03Rollup merge of #141724 - Sol-Ell:issue-141141-fix, r=nnethercoteMatthias Krüger-0/+195
fix(#141141): When expanding `PartialEq`, check equality of scalar types first. Fixes rust-lang/rust#141141. Now, `cs_eq` function of `partial_eq.rs` compares [scalar types](https://doc.rust-lang.org/rust-by-example/primitives.html#scalar-types) first. - Add `is_scalar` field to `FieldInfo`. - Add `is_scalar` method to `TyKind`. - Pass `FieldInfo` via `CsFold::Combine` and refactor code relying on it. - Implement `TryFrom<&str>` and `TryFrom<Symbol>` for FloatTy. - Implement `TryFrom<&str>` and `TryFrom<Symbol>` for IntTy. - Implement `TryFrom<&str>` and `TryFrom<Symbol>` for UintTy.
2025-06-03Add missing `dyn` keywords to tests that do not test for them Part 2Lukas Wirth-31/+26
2025-06-03Use non-2015 edition paths in tests that do not test for their resolutionLukas Wirth-193/+194
This allows for testing these tests on editions other than 2015
2025-06-03Rollup merge of #141891 - jdonszelmann:fix-141764, r=jieyouxuMatthias Krüger-0/+37
Fix borrowck mentioning a name from an external macro we (deliberately) don't save Most of the info is already in the title :shrug: Closes rust-lang/rust#141764
2025-06-03Rollup merge of #141889 - ferrocene:lw/missing-dyn-kw, r=petrochenkovMatthias Krüger-34/+33
Add missing `dyn` keywords to tests that do not test for them This ensures that these tests can be run on editions other than 2015
2025-06-03Rollup merge of #141886 - ferrocene:lw/2015-edition-directives, ↵Matthias Krüger-15/+22
r=compiler-errors Add missing 2015 edition directives These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-06-03Rollup merge of #141876 - compiler-errors:missing-let-ty, r=SparrowLiiMatthias Krüger-0/+23
Don't declare variables in `ExprKind::Let` in invalid positions Handle `let` expressions in invalid positions specially during resolve in order to avoid making destructuring-assignment expressions that reference (invalid) variables that have not yet been delcared yet. See further explanation in test and comment in the source. Fixes rust-lang/rust#141844
2025-06-03Rollup merge of #141677 - ↵Matthias Krüger-28/+77
azhogin:azhogin/async-drop-unexpected-type-instead-of-drop-fn-fix, r=oli-obk Async drop - type instead of async drop fn, fixes #140484 Fixes: rust-lang/rust#140484 Fixes: rust-lang/rust#140500 Fixes ICE, when type is provided in AsyncDrop trait instead of `async fn drop()`. Fixes ICE, when async drop fn has wrong signature.
2025-06-03Remove pre-expansion AST stats.Nicholas Nethercote-117/+60
They're very little value, because they only measure the top-level `main.rs` or `lib.rs` file. (Other `.rs` files don't get read and parsed until expansion occurs.) I saw an example recently where the pre-expansion AST was 3KB in size and the post-expansion AST was 66MB. I kept the "POST EXPANSION" in the output header, I think that's useful information to avoid possible confusion about when the measurement happens.
2025-06-03cleaned up some testsKivooeo-32/+51
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-967/+967
2025-06-02Use the informative error as the main const eval error messageOli Scherer-4233/+4082
2025-06-02Rollup merge of #141892 - chenyukang:yukang-fix-141785-extern-crate, ↵Yukang-0/+11
r=petrochenkov Fix false positive lint error from no_implicit_prelude attr Fixes rust-lang/rust#141785 r? `@petrochenkov`
2025-06-02Separately check equality of the scalar types and compound types in the ↵Ell-0/+195
order of declaration.
2025-06-02add fixme to improve error matchingJana Dönszelmann-1/+2
2025-06-02Fix false positive lint error from no_implicit_prelude attryukang-0/+11
2025-06-02fix bug where borrowck tries to describe a name from a macro in another crateJana Dönszelmann-0/+21
2025-06-02add test for 141764Jana Dönszelmann-0/+15
2025-06-02Add missing `dyn` keywords to tests that do not test for themLukas Wirth-34/+33
This ensures that these tests can be run on editions other than 2015
2025-06-02Add missing 2015 edition directivesLukas Wirth-15/+22
These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-06-02allow macro_use as first segmentbohan-3/+60
2025-06-02Suppress redundant errorMichael Goulet-12/+2
2025-06-02Don't declare variables in ExprKind::Let in invalid positionsMichael Goulet-0/+33
2025-06-01Rollup merge of #141224 - RalfJung:no-objects, r=traviscrossGuillaume Gomez-1/+1
terminology: allocated object → allocation Rust does not have "objects" in memory so "allocated object" is a somewhat odd name. I am not sure where the term comes from. "object" has been used to refer to allocations already [in 1.0 docs](https://doc.rust-lang.org/1.0.0/std/primitive.pointer.html#method.offset); this was apparently later changed to "allocated object". "Allocation" is already the terminology used in Miri and in the [UCG](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#allocation). We should properly move to that terminology, and avoid any confusion about whether Rust has an object memory model. (It does not. Memory contains untyped bytes.) Cc ``@rust-lang/opsem`` ``@rust-lang/lang``
2025-06-01Rollup merge of #140370 - WaffleLapkin:unqualified, r=jdonszelmannGuillaume Gomez-62/+207
Improve diagnostics for usage of qualified paths within tuple struct exprs/pats For patterns the old diagnostic was just incorrect, but I also added machine applicable suggestions. For context, this special cases errors for `<T as Trait>::Assoc(..)` patterns and expressions (latter is just a call). Tuple struct patterns and expressions both live in the value namespace, so they are not forwarded through associated *types*. r? ``@jdonszelmann`` cc ``@petrochenkov`` in https://github.com/rust-lang/rust/pull/80080#issuecomment-800630582 you were wondering why it doesn't work for types, that's why — tuple patterns are resolved in the value namespace.
2025-06-01Async drop - type instead of async drop fn and incorrect drop signature ↵Andrew Zhogin-28/+77
don't ICE now
2025-06-01Auto merge of #141725 - nnethercote:avoid-UsePath-overcounting, r=BoxyUwUbors-161/+165
Avoid over-counting of `UsePath` in the HIR stats. Currently we over-count. Details in the individual commits. r? `@BoxyUwU`
2025-06-01Auto merge of #141842 - jhpratt:rollup-r7ldrl2, r=jhprattbors-0/+118
Rollup of 6 pull requests Successful merges: - rust-lang/rust#141072 (Stabilize feature `result_flattening`) - rust-lang/rust#141215 (std: clarify Clone trait documentation about duplication semantics) - rust-lang/rust#141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target) - rust-lang/rust#141521 (Add `const` support for float rounding methods) - rust-lang/rust#141812 (Fix "consider borrowing" for else-if) - rust-lang/rust#141832 (library: explain TOCTOU races in `fs::remove_dir_all`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-01Rollup merge of #141812 - JonathanBrouwer:fix-else-if-help, r=jdonszelmannJacob Pratt-0/+118
Fix "consider borrowing" for else-if Fixes rust-lang/rust#141810 When trying to suggest a borrow on a `if` or `block` expression, instead we now recurse into the `if` or `block`. The comments in the code should explain the goal of the new code. r? ``@jdonszelmann``
2025-05-31Auto merge of #139118 - scottmcm:slice-get-unchecked-intrinsic, r=workingjubileebors-66/+217
`slice.get(i)` should use a slice projection in MIR, like `slice[i]` does `slice[i]` is built-in magic, so ends up being quite different from `slice.get(i)` in MIR, even though they're both doing nearly identical operations -- checking the length of the slice then getting a ref/ptr to the element if it's in-bounds. This PR adds a `slice_get_unchecked` intrinsic for `impl SliceIndex for usize` to use to fix that, so it no longer needs to do a bunch of lines of pointer math and instead just gets the obvious single statement. (This is *not* used for the range versions, since `slice[i..]` and `slice[..k]` can't use the mir Slice projection as they're using fenceposts, not indices.) I originally tried to do this with some kind of GVN pattern, but realized that I'm pretty sure it's not legal to optimize `BinOp::Offset` to `PlaceElem::Index` without an extremely complicated condition. Basically, the problem is that the `Index` projection on a dereferenced slice pointer *cares about the metadata*, since it's UB to `PlaceElem::Index` outside the range described by the metadata. But then you cast the fat pointer to a thin pointer then offset it, that *ignores* the slice length metadata, so it's possible to write things that are legal with `Offset` but would be UB if translated in the obvious way to `Index`. Checking (or even determining) the necessary conditions for that would be complicated and error-prone, whereas this intrinsic-based approach is quite straight-forward. Zero backend changes, because it just lowers to MIR, so it's already supported naturally by CTFE/Miri/cg_llvm/cg_clif.
2025-05-31terminology: allocated object → allocationRalf Jung-1/+1
2025-05-31Auto merge of #141824 - matthiaskrgr:rollup-7nffwd0, r=matthiaskrgrbors-40/+77
Rollup of 8 pull requests Successful merges: - rust-lang/rust#140787 (Note expr being cast when encounter NonScalar cast error) - rust-lang/rust#141112 (std: note that `std::str::from_utf8*` functions are aliases to `<str>::from_utf8*` methods) - rust-lang/rust#141646 (Document what `distcheck` is intended to exercise) - rust-lang/rust#141740 (Hir item kind field order) - rust-lang/rust#141793 (`tests/ui`: A New Order [1/N]) - rust-lang/rust#141805 (Update `compiler-builtins` to 0.1.160) - rust-lang/rust#141815 (Enable non-leaf Frame Pointers for mingw-w64 Arm64 Windows) - rust-lang/rust#141819 (Fixes for building windows-gnullvm hosts) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-31Rollup merge of #141793 - Kivooeo:test-reform, r=jieyouxuMatthias Krüger-40/+57
`tests/ui`: A New Order [1/N] not sure if i should say something about changes here, just part of rust-lang/rust#133895 but this is my very first time doing something like this, id love to keep contributing in this area later on, so any feedback is appreciated also should say that im going to squash it after agreement on changes r? `@jieyouxu` mind if i name this PR series like "`tests/ui`: A New Order [N/N]", im not sure if it fits the project tone, so id like your approval first — but i think it sounds really neat (Star Wars reference) this could be a first part :)
2025-05-31Rollup merge of #140787 - xizheyin:issue-140491, r=nnethercoteMatthias Krüger-0/+20
Note expr being cast when encounter NonScalar cast error Fixes #140491 I added note for `expr` so that it doesn't treat `&x as T` as `&(x as T)` but `(&x) as T`. But I'm not sure if I want to add note for all NonScalar, maybe for specific `expr_ty`? r? compiler
2025-05-31Fix consider borrowing for else-ifJonathan Brouwer-11/+4
2025-05-31Failing tests for "consider borrowing"Jonathan Brouwer-0/+125
2025-05-31Auto merge of #141685 - orlp:inplace-tls-drop, r=joboetbors-0/+37
Do not move thread-locals before dropping Fixes rust-lang/rust#140816. I also (potentially) improved the speed of `get_or_init` a bit by having an explicit hot/cold path. We still move the value before dropping in the event of a recursive initialization (leading to double-initialization with one value being silently dropped). This is the old behavior, but changing this to panic instead would involve changing tests and also the other OS-specific `thread_local/os.rs` implementation, which is more than I'd like in this PR.
2025-05-31cleaned up some testsKivooeo-40/+57
2025-05-31Auto merge of #141667 - lqd:lazy-maybe-init, r=matthewjasperbors-7/+7
Add fast path for maybe-initializedness in liveness r? `@matthewjasper` Correct me if I'm wrong Matthew, but my understanding is that 1. `MaybeInitializedPlaces` is currently eagerly computed, in `do_mir_borrowck` 2. but this data is only used in liveness 3. and `liveness::trace` actually only uses it for drop-liveness This PR moves the computation to `liveness::trace` which looks to be its only use-site. We also add a fast path there, so that it's only computed by drop-liveness. This is interesting because 1) liveness is only computed for relevant live locals, 2) drop-liveness is only computed for relevant live locals with >0 drop points; 0 is the common case from our benchmarks, as far as I can tell, so even just computing the entire data lazily helps. It seems possible to also reduce the domain here, and speed up the analysis for the cases where it has to be computed -- so I've left a fixme for that, and may look into it soon. (I've come upon this while doing implementation work for polonius, so don't be too enamored with possible wins: the goal is to reduce the eventual polonius overhead and make it more palatable 😓)