about summary refs log tree commit diff
path: root/tests/ui/suggestions
AgeCommit message (Collapse)AuthorLines
2025-10-02bring back plural 'alternatives' in suggestion messageKarol Zwolak-1/+1
2025-10-02fix wording; we're replacing coma with a barKarol Zwolak-3/+3
2025-10-01regression testKarol Zwolak-0/+54
2025-09-30Rollup merge of #146617 - Jules-Bertholet:E0277-NOFORN, r=SparrowLiiMatthias Krüger-12/+76
Don’t suggest foreign `doc(hidden)` types in "the following other types implement trait" diagnostics Fixes https://github.com/rust-lang/rust/issues/132024. ``@rustbot`` label A-diagnostics T-compiler
2025-09-29Make replacement suggestion `_` in type verboseEsteban Küber-12/+21
``` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | ^ not allowed in type signatures | help: replace with the correct return type | LL - fn arr_fn() -> [u8; _] { LL + fn arr_fn() -> [u8; 3] { | ```
2025-09-26Ignore more failing ui tests for GCC backendGuillaume Gomez-9/+11
2025-09-26Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkovbors-5/+2
Extended temporary argument to format_args!() in all cases Fixes https://github.com/rust-lang/rust/issues/145880 by removing the special case.
2025-09-23Rollup merge of #146907 - cyrgani:146537-test, r=nnethercoteMatthias Krüger-0/+34
add regression test for issue 146537 Adds a test based on the reduction in https://github.com/rust-lang/rust/issues/146537#issuecomment-3289438439. This was already fixed in rust-lang/rust#142882 before the issue was even reported, but no test for it was added yet.
2025-09-22add regression test for issue 146537cyrgani-0/+34
2025-09-19chore(compiletest): Use newest anstyle-svg versionScott Schafer-1/+1
2025-09-16Rollup merge of #146605 - jyn514:update-rustfix, r=nnethercoteMatthias Krüger-4/+4
Bump rustfix 0.8.1 -> 0.8.7 This commit can be replicated by running `cargo update -p rustfix --precise 0.8.7 && x test ui --bless`. --- The reasons this affects UI tests is as follows: - The UI test suite runs rustc with `-Z deduplicate-diagnostics=no --error-format=json`, which means that rustc emits multiple errors containing identical suggestions. That caused the weird-looking code that had multiple `X: Copy` suggestions. - Those suggestions are interpreted not by rustc itself, but by the `rustfix` library, maintained by cargo but published as a separate crates.io library and used by compiletest. - Sometime between rustfix 0.8.1 and 0.8.7 (probably in rust-lang/cargo#14747, but it's hard to tell because rustfix's versioning doesn't match cargo's), rustfix got smarter and stopped applying duplicate suggestions. Update rustfix to match cargo's behavior. Ideally, we would always share a version of rustfix between cargo and rustc (perhaps with a path dependency?), to make sure we are testing the behavior we ship. But for now, just manually update it to match. Note that the latest version of rustfix published to crates.io is 0.9.1, not 0.8.7. But 0.9.1 is not the version used in cargo, which is 0.9.3. Rather than trying to match versions exactly, I just updated rustfix to the latest in the 0.8 branch.
2025-09-16Rollup merge of #146442 - Qelxiros:trait-suggestion-generics, r=BoxyUwUMatthias Krüger-6/+23
Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary context: rust-lang/rust#145929 This fixes the MetaSized issue and adds const generics and early bound lifetimes. Late bound lifetimes are harder because they aren't returned by `generics_of`. I'm going to look into it, but there's no guarantee I'll be successful. Fixes https://github.com/rust-lang/rust/issues/146404. r? `@BoxyUwu`
2025-09-16handle const generics, ?Sized, early bound lifetimesJeremy Smart-6/+23
2025-09-15Don’t suggest foreign `doc(hidden)` types in E0277 diagnosticsJules Bertholet-12/+76
2025-09-15Bump rustfix 0.8.1 -> 0.8.7Jynn Nelson-4/+4
This commit can be replicated by running `cargo update -p rustfix --precise 0.8.7 && x test ui --bless`. --- The reasons this affects UI tests is as follows: - The UI test suite runs rustc with `-Z deduplicate-diagnostics=no --error-format=json`, which means that rustc emits multiple errors containing identical suggestions. That caused the weird-looking code that had multiple `X: Copy` suggestions. - Those suggestions are interpreted not by rustc itself, but by the `rustfix` library, maintained by cargo but published as a separate crates.io library and used by compiletest. - Sometime between rustfix 0.8.1 and 0.8.7 (probably in cargo 14747, but it's hard to tell because rustfix's versioning doesn't match cargo's), rustfix got smarter and stopped applying duplicate suggestions. Update rustfix to match cargo's behavior. Ideally, we would always share a version of rustfix between cargo and rustc (perhaps with a path dependency?), to make sure we are testing the behavior we ship. But for now, just manually update it to match. Note that the latest version of rustfix published to crates.io is 0.9.1, not 0.8.7. But 0.9.1 is not the version used in cargo, which is 0.9.3. Rather than trying to match versions exactly, I just updated rustfix to the latest in the 0.8 branch.
2025-09-13Rollup merge of #146456 - IoaNNUwU:issue-146446, r=estebankJacob Pratt-1/+77
Fix panic and incorrectly suggested examples in `format_args` macro. Follow up on rust-lang/rust#146123 Fixes: rust-lang/rust#146446 r? `@estebank`
2025-09-13Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxuJacob Pratt-0/+59
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-09-13Rollup merge of #146403 - cyrgani:array-sugg-sorting, r=fee1-deadJana Dönszelmann-3/+3
sort array trait implementation suggestions correctly Fixes rust-lang/rust#135098. Previously tried in rust-lang/rust#137428.
2025-09-12Add test batch 3Oneirical-0/+59
2025-09-12sort array trait implementation suggestions correctlycyrgani-3/+3
2025-09-12Use raw fmt str in format macroIoaNNUwU-1/+77
2025-09-10Rollup merge of #146123 - IoaNNUwU:issue-68293, r=estebankMatthias Krüger-0/+84
Suggest examples of format specifiers in error messages Format macro now suggests adding `{}` if no formatting specifiers are present. It also gives an example: ```rust LL | println!("Hello", "World"); | ------- ^^^^^^^ argument never used | | | formatting specifier missing | = note: format specifiers use curly braces: `{}` help: consider adding format specifier | LL | println!("Hello{}", "World"); | ++ ``` When one or more `{}` are present, it doesn't show 'format specifiers use curly braces: `{}`' and example, just small hint on how many you missing: ```rust LL | println!("list: {}", 1, 2, 3); | ---------- ^ ^ argument never used | | | | | argument never used | multiple missing formatting specifiers | = help: consider adding 2 format specifiers ``` Original issue: rust-lang/rust#68293 Based on discussion in this PR: rust-lang/rust#76443 Let me know if something is missing
2025-09-09Rollup merge of #145929 - Qelxiros:apitit-suggestion, r=BoxyUwUMatthias Krüger-0/+28
fix APITIT being treated as a normal generic parameter in suggestions closes rust-lang/rust#126395
2025-09-08Apply requested changesIoaNNUwU-6/+4
2025-09-08Implement better suggestions based on additional tests and other code pathsIoaNNUwU-9/+2
2025-09-08Suggest examples of format specifiers in error messagesIoaNNUwU-0/+93
2025-09-08fix APITIT being treated as a normal generic parameter in suggestionsJeremy Smart-0/+28
2025-09-04fix ICE when suggesting `::new`Lukas Markeffsky-2/+2
2025-08-30Detect negative literal inferred to unsigned integerEsteban Küber-0/+38
``` error[E0277]: the trait bound `usize: Neg` is not satisfied --> $DIR/negative-literal-infered-to-unsigned.rs:2:14 | LL | for x in -5..5 { | ^^ the trait `Neg` is not implemented for `usize` | help: consider specifying an integer type that can be negative | LL | for x in -5isize..5 { | +++++ ```
2025-08-26fix: Render continuation between no source labelsScott Schafer-1/+1
2025-08-26fix: Add col separator before secondary messages with no sourceScott Schafer-0/+7
2025-08-26fix: Don't add an end column separator after a file with no sourceScott Schafer-3/+0
2025-08-26Rollup merge of #145481 - mu001999-contrib:fix/closure-sugg, r=SparrowLiiGuillaume Gomez-0/+49
Add parentheses for closure when suggesting calling closure Fixes rust-lang/rust#145404
2025-08-26Update tests.Mara Bos-5/+2
2025-08-22Rollup merge of #145641 - estebank:point-at-type-in-e0277, r=davidtwcoJacob Pratt-5/+30
On E0277, point at type that doesn't implement bound When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-22Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-SimulacrumJacob Pratt-8/+8
Implementation: `#[feature(nonpoison_rwlock)]` Tracking Issue: https://github.com/rust-lang/rust/issues/134645 This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::rwlock`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable. ### Related PRs - `nonpoison_condvar` implementation: https://github.com/rust-lang/rust/pull/144651 - `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-5/+30
When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-20diagnostics :3lcnr-14/+8
2025-08-20handle opaque types before region inferencelcnr-9/+15
2025-08-19bless tests with new lint messagesKarol Zwolak-5/+5
2025-08-19Rollup merge of #140956 - Kixunil:impl-partialeq-str-for-path, r=AmanieuStuart Cook-0/+2
`impl PartialEq<{str,String}> for {Path,PathBuf}` This is a revival of #105877 Comparison of paths and strings is expected to be possible and needed e.g. in tests. This change adds the impls os `PartialEq` between strings and paths, both owned and unsized, in both directions. ACP: https://github.com/rust-lang/libs-team/issues/151
2025-08-16Add parentheses for closure when suggesting calling closureMu001999-3/+4
2025-08-16old testcase outputMu001999-0/+48
2025-08-15Rollup merge of #145378 - xizheyin:144968, r=davidtwcoStuart Cook-6/+0
Add `FnContext` in parser for diagnostic Fixes rust-lang/rust#144968 Inspired by https://github.com/rust-lang/rust/issues/144968#issuecomment-3156094581, I implemented `FnContext` to indicate whether a function should have a self parameter, for example, whether the function is a trait method, whether it is in an impl block. And I removed the outdated note. I made two commits to show the difference. cc ``@estebank`` ``@djc`` r? compiler
2025-08-14Adjust error message grammar to be less awkwardJake Goulding-47/+47
2025-08-14Add FnContext in parser for diagnosticxizheyin-6/+0
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-08-10Add support for method callsEsteban Küber-22/+684
2025-08-10Point at the `Fn()` or `FnMut()` bound that coerced a closure, which caused ↵Esteban Küber-21/+170
a move error When encountering a move error involving a closure because the captured value isn't `Copy`, and the obligation comes from a bound on a type parameter that requires `Fn` or `FnMut`, we point at it and explain that an `FnOnce` wouldn't cause the move error. ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:15:25 | 14 | fn do_stuff(foo: Option<Foo>) { | --- ----------- move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | | | captured outer variable 15 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 16 | if foo.map_or(false, |f| f.foo()) { | --- variable moved due to use in coroutine | help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but an `FnOnce` consume them only once --> f111.rs:12:53 | 12 | fn require_fn_trait<F: Future<Output = ()>>(_: impl Fn() -> F) {} | ^^^^^^^^^ help: consider cloning the value if the performance cost is acceptable | 16 | if foo.clone().map_or(false, |f| f.foo()) { | ++++++++ ```
2025-08-09add `nonpoison::rwlock` implementationConnor Tsui-8/+8
Adds the equivalent `nonpoison` types to the `poison::rwlock` module. These types and implementations are gated under the `nonpoison_rwlock` feature gate. Also blesses the ui tests that now have a name conflicts (because these types no longer have unique names). The full path distinguishes the different types.
2025-08-09Rollup merge of #145124 - compiler-errors:for-eq, r=lqdStuart Cook-15/+25
Recover `for PAT = EXPR {}` I type this constantly, and the existing suggestion to put `in` before the `=` is misleading.