about summary refs log tree commit diff
path: root/tests/ui/methods
AgeCommit message (Collapse)AuthorLines
2025-09-23add regression testlcnr-0/+30
2025-08-29Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxuMatthias Krüger-1/+1
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#2 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-08-27Add test batch 2Oneirical-1/+1
2025-08-26fix: Add col separator before secondary messages with no sourceScott Schafer-0/+1
2025-08-24Make sure to treat only param where clauses as inherentMichael Goulet-0/+196
2025-08-22Rollup merge of #145765 - lqd:revert-142034, r=fmeaseJacob Pratt-97/+109
Revert suggestions for missing methods in tuples As requested by `@estebank` and as discussed with `@jackh726,` this reverts rust-lang/rust#142034 because of diagnostics ICEs like rust-lang/rust#142488 and its duplicates that have reached stable by now. We will work on a proper fix to reland this cool work in the near future, but in the meantime, a revert is safer to validate and backport to beta and stable, so here it is.
2025-08-22add regression test for issue 142488Rémy Rakic-0/+109
there are a lot of MCVEs there, so this is only a few of them, not all duplicates that were opened
2025-08-22Revert "Detect method not being present that is present in other tuple types"Rémy Rakic-97/+0
This reverts commit 585a40963ea59808e74803f8610659a505b145e0.
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-1/+5
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-19bless tests with new lint messagesKarol Zwolak-5/+5
2025-08-17Rehome tests/ui/issues/ tests [5/?]Oneirical-0/+28
2025-08-07Use `tcx.short_string()` in more diagnosticsEsteban Küber-15/+21
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`. We add support for shortening the path of "trait path only". Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem). When we don't actually print out a shortened type we don't need the "use `--verbose`" note. On E0599 show type identity to avoid expanding the receiver's generic parameters. Unify wording on `long_ty_path` everywhere.
2025-08-07Rollup merge of #137831 - estebank:auto-trait-err, r=compiler-errorsStuart Cook-1/+1
Tweak auto trait errors Make suggestions to remove params and super traits verbose and make spans more accurate. ``` error[E0567]: auto traits cannot have generic parameters --> $DIR/auto-trait-validation.rs:6:19 | LL | auto trait Generic<T> {} | -------^^^ | | | auto trait cannot have generic parameters error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:8:20 | LL | auto trait Bound : Copy {} | ----- ^^^^ | | | auto traits cannot have super traits or lifetime bounds ``` ``` error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | LL | unsafe auto trait Trait { | ----- auto traits cannot have associated items LL | fn method(&self) { | ^^^^^^ ```
2025-08-04Rehome tests/ui/issues/ tests [3/?]Oneirical-0/+30
2025-08-04Tweak auto trait errorsEsteban Küber-1/+1
Make suggestions to remove params and super traits tool-only, and make the suggestion span more accurate. ``` error[E0567]: auto traits cannot have generic parameters --> $DIR/auto-trait-validation.rs:6:19 | LL | auto trait Generic<T> {} | -------^^^ | | | auto trait cannot have generic parameters error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:8:20 | LL | auto trait Bound : Copy {} | ----- ^^^^ | | | auto traits cannot have super traits or lifetime bounds ``` ``` error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | LL | unsafe auto trait Trait { | ----- auto traits cannot have associated items LL | fn method(&self) { | ^^^^^^ ```
2025-07-24Rehome tests/ui/issues/ tests [1/?]Oneirical-0/+28
2025-07-17fix: fix issue 143740, Wrong messages from compiler confusing methods with ↵codedump-13/+67
the same name from different traits
2025-06-30Use predicate spans instead of whole item spansOli Scherer-29/+16
2025-06-29Rollup merge of #142417 - Kivooeo:tf12, r=jieyouxuGuillaume Gomez-55/+69
`tests/ui`: A New Order [12/N] Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@jieyouxu`
2025-06-28cleaned up some testsKivooeo-55/+69
2025-06-24Make missing lifetime suggestion verboseMichael Goulet-5/+11
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-4/+2
2025-06-14Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errorsMatthias Krüger-21/+11
Unimplement unsized_locals Implements https://github.com/rust-lang/compiler-team/issues/630 Tracking issue here: https://github.com/rust-lang/rust/issues/111942 Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`. There may be more that should be removed (possibly in follow up prs) - the `forget_unsized` function and `forget` intrinsic. - the `unsized_locals` test directory; I've just fixed up the tests for now - various codegen support for unsized values and allocas cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3`` ``@rustbot`` label F-unsized_locals Fixes rust-lang/rust#79409
2025-06-13Unimplement unsized_localsmejrs-21/+11
2025-06-12Rollup merge of #142034 - estebank:issue-141258, r=davidtwcoMatthias Krüger-0/+97
Detect method not being present that is present in other tuple types When a method is not present because of a trait bound not being met, and that trait bound is on a tuple, we check if making the tuple have no borrowed types makes the method to be found and highlight it if it does. This is a common problem for Bevy in particular and ORMs in general. <img width="1166" alt="Screenshot 2025-06-04 at 10 38 24 AM" src="https://github.com/user-attachments/assets/d257c9ea-c2d7-42e7-8473-8b93aa54b8e0" /> Address rust-lang/rust#141258. I believe that more combination of cases in the tuple types should be handled (like adding borrows and checking when a specific type needs to not be a borrow while the rest stay the same), but for now this handles the most common case.
2025-06-11cleaned up some testsKivooeo-0/+28
2025-06-04Detect method not being present that is present in other tuple typesEsteban Küber-0/+97
When a method is not present because of a trait bound not being met, and that trait bound is on a tuple, we check if making the tuple have no borrowed types makes the method to be found and highlight it if it does. This is a common problem for Bevy in particular and ORMs in general.
2025-05-31cleaned up some testsKivooeo-0/+83
2025-05-24Avoid extra path trimming in method not found errorNoratrieb-3/+23
Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`). A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered. The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
2025-05-05Do not gather local all together at the beginning of typeckMichael Goulet-77/+77
2025-04-30Auto merge of #140503 - matthiaskrgr:rollup-n7zigts, r=matthiaskrgrbors-15/+43
Rollup of 11 pull requests Successful merges: - #136160 (Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`) - #139059 (uses_power_alignment: wording tweaks) - #139192 (mention provenance in the pointer::wrapping_offset docs) - #140312 (Improve pretty-printing of braces) - #140404 (rm `TypeVistable` impls for `Canonical`) - #140437 (enable msa feature for mips in codegen tests) - #140438 (Add `rust.debug-assertions-tools` option) - #140439 (miri: algebraic intrinsics: bring back float non-determinism) - #140445 (Treat ManuallyDrop as ~const Destruct) - #140446 (chore: fix some tests) - #140448 (Rename `rustc_query_append!` to `rustc_with_all_queries!`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-23/+27
2025-04-29Coalesce duplicate missing clone testsmejrs-15/+43
2025-04-25Cleaned up 5 tests in `tests/ui`reddevilmidzy-0/+35
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-3/+3
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+2
2025-03-06Rollup merge of #137565 - compiler-errors:macro-ex, r=estebankMichael Goulet-0/+39
Try to point of macro expansion from resolver and method errors if it involves macro var In the case that a macro caller passes an identifier into a macro generating a path or method expression, point out that identifier in the context of the *macro* so it's a bit more clear how the macro is involved in causing the error. r? ``````````@estebank`````````` or reassign
2025-03-03Point of macro expansion from call expr if it involves macro varMichael Goulet-0/+39
2025-03-04tests: remove explicit long type filename hash normalization from some ui tests许杰友 Jieyou Xu (Joe)-6/+4
2025-02-21More sophisticated span trimmingMichael Goulet-9/+6
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-2/+2
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-6/+4
2025-02-14fallout :skull_emoji:lcnr-5/+8
2025-02-13Implement lint for definition site item shadowing tooMichael Goulet-19/+172
2025-02-13Add more testsMichael Goulet-0/+172
2025-02-13Rework collapse method to work correctly with more complex supertrait graphsMichael Goulet-0/+219
2025-02-13Implement shadowing lintMichael Goulet-0/+100
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-120/+180
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-05When displaying a parameter mismatch error, only highlight the mismatched ↵Jason Newcomb-1/+1
parameters when showing the definition.
2025-02-03Check for generic parameter mismatches on trait functions.Jason Newcomb-1/+1