about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
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-0/+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-02Fast path for stalled obligations on self tyMichael Goulet-5/+2
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-966/+966
2025-06-02Use the informative error as the main const eval error messageOli Scherer-4229/+4078
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-0/+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-0/+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-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-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-31Note ref expr being cast when encounter NonScalar cast errorxizheyin-0/+4
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-30Rollup merge of #141781 - matthewjasper:unused-unsafe-lifetimes, ↵Jubilee-0/+110
r=compiler-errors Fix spans for unsafe binders closes rust-lang/rust#141758 r? ``@compiler-errors``
2025-05-30Rollup merge of #141077 - chenyukang:yukang-fix-140991-comma, r=wesleywiserJubilee-0/+74
Fix the issue of typo of comma in arm parsing Fixes #140991 I also checked is it a '/', since it's near from ',' from keyboard.
2025-05-30Rollup merge of #140825 - rs-sac:ext, r=workingjubileeJubilee-2/+2
Add Range parameter to `BTreeMap::extract_if` and `BTreeSet::extract_if` This new parameter was requested in the btree_extract_if tracking issue: https://github.com/rust-lang/rust/issues/70530#issuecomment-2486566328 I attempted to follow the style used by `Vec::extract_if`. Before: ```rust impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { #[unstable(feature = "btree_extract_if", issue = "70530")] pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F, A> where K: Ord, F: FnMut(&K, &mut V) -> bool; } ``` After: ```rust impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { #[unstable(feature = "btree_extract_if", issue = "70530")] pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, K, V, R, F, A> where K: Ord, R: RangeBounds<K>, F: FnMut(&K, &mut V) -> bool; } ``` Related: #70530 — While I believe I have adjusted all of the necessary bits, as this is my first attempt to contribute to Rust, I may have overlooked something out of ignorance, but if you can point out any oversight, I shall attempt to remedy it.
2025-05-30Fix spans for unsafe bindersMatthew Jasper-0/+110
2025-05-30Rollup merge of #141703 - compiler-errors:deref-place, r=lcnrMatthias Krüger-0/+63
Structurally normalize types as needed in `projection_ty_core` Introduce a `structurally_normalize` callback to `projection_ty_core`, and then use it before we match on the ty kind in `projection_ty_core`. Previously we were only structurally normalizing the return type of the `handle_field` struct, but if we were to (e.g.) apply a deref projection to that type, then the resulting type is not guaranteed to be structurally normalized and any subsequent projections applied would ICE. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/221 I'll leave a few comments inline to explain the changes. r? lcnr --- Also fixes rust-lang/rust#141708
2025-05-30Address review comments.Orson Peters-1/+0
2025-05-30Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3Matthias Krüger-23/+23
atomic_load intrinsic: use const generic parameter for ordering We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that! This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics. The first two commits are preparation and could be a separate PR if you prefer. `@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer... `@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
2025-05-30Rollup merge of #141407 - mu001999-contrib:dead-code/refactor, r=petrochenkovMatthias Krüger-2/+57
Refactor the two-phase check for impls and impl items Refactor the two-phase dead code check to make the logic clearer and simpler: 1. adding assoc fn and impl into `unsolved_items` directly during the initial construction of the worklist 2. converge the logic of checking whether assoc fn and impl are used to `item_should_be_checked`, and the item is considered used only when its corresponding trait and Self adt are used This PR only refactors as much as possible to avoid affecting the original functions. However, due to the adjustment of the order of checks, the test results are slightly different, but overall, there is no regression problem Fixes rust-lang/rust#127911 Fixes rust-lang/rust#128839 Extracted from https://github.com/rust-lang/rust/pull/128637. r? petrochenkov try-job: dist-aarch64-linux
2025-05-30Rollup merge of #141004 - matthewjasper:unicode-before-expansion, r=davidtwcoMatthias Krüger-18/+143
Report text_direction_codepoint_in_literal when parsing The lint is now reported in code that gets removed/modified/duplicated by macro expansion, and spans are more accurate so we don't get ICEs from trying to split a span in the middle of a character. This removes support for lint level attributes for `text_direction_codepoint_in_literal` except at the crate level, I don't think that there's an easy way around this when the lint can be reported on code that's removed by `cfg` or that is only in the input of a macro. Fixes #140281
2025-05-30Rollup merge of #133823 - estebank:issue-56328, r=petrochenkovMatthias Krüger-23/+218
Use `cfg_attr_trace` in AST with a placeholder attribute for accurate suggestion In rust-lang/rust#138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix rust-lang/rust#56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused `extern crate` --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; | ``` r? `@petrochenkov` try-job: x86_64-gnu-aux
2025-05-29Remove `i128` and `u128` from `improper_ctypes_definitions`Trevor Gross-218/+60
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 [3], 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 [4], 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 Closes: https://github.com/rust-lang/rust/issues/128950 [1]: https://github.com/rust-lang/rust/issues/54341 [2]: https://github.com/rust-lang/rust/issues/128950 [3]: https://github.com/rust-lang/lang-team/issues/255#issuecomment-2088855084 [4]: https://github.com/rust-lang/rust/pull/138282
2025-05-29Add test for issue 127911 and 128839Mu001999-0/+50
2025-05-29Normalize possibly unnormalized type in relate_type_and_user_typeMichael Goulet-0/+31
2025-05-29Structurally normalize types as needed in projection_ty_coreMichael Goulet-0/+32
2025-05-29Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnosticsEsteban Küber-23/+218
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused extern crate --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; LL + | ```