summary refs log tree commit diff
path: root/tests/ui/methods
AgeCommit message (Collapse)AuthorLines
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
2025-01-03Do not ICE when encountering predicates from other items in method error ↵Michael Goulet-0/+72
reporting
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-1/+1
2024-12-11Arbitrary self types v2: use Receiver traitAdrian Taylor-0/+101
In this new version of Arbitrary Self Types, we no longer use the Deref trait exclusively when working out which self types are valid. Instead, we follow a chain of Receiver traits. This enables methods to be called on smart pointer types which fundamentally cannot support Deref (for instance because they are wrappers for pointers that don't follow Rust's aliasing rules). This includes: * Changes to tests appropriately * New tests for: * The basics of the feature * Ensuring lifetime elision works properly * Generic Receivers * A copy of the method subst test enhanced with Receiver This is really the heart of the 'arbitrary self types v2' feature, and is the most critical commit in the current PR. Subsequent commits are focused on: * Detecting "shadowing" problems, where a smart pointer type can hide methods in the pointee. * Diagnostics and cleanup. Naming: in this commit, the "Autoderef" type is modified so that it no longer solely focuses on the "Deref" trait, but can now consider the "Receiver" trait instead. Should it be renamed, to something like "TraitFollower"? This was considered, but rejected, because * even in the Receiver case, it still considers built-in derefs * the name Autoderef is short and snappy.
2024-12-07Mention type parameter in more cases and don't suggest ~const bound already ↵Esteban Küber-4/+4
there
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-4/+4
``` help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ ``` ``` help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ ```
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-4/+4
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-6/+2
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-09-29Don't give method suggestions when method probe fails due to bad impl of DerefMichael Goulet-0/+25
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-0/+6
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-17Auto merge of #129073 - compiler-errors:receiver-variance, r=lcnrbors-0/+28
Relate receiver invariantly in method probe for `Mode::Path` Effectively reverts part of #126128 Fixes #126227 This PR changes method probing to use equality for fully path-based method lookup, and subtyping for receiver `.` method lookup. r? lcnr
2024-09-16Relate receiver invariantly in method probe for Mode::PathMichael Goulet-0/+28
2024-09-13Update tests for hidden references to mutable staticObei Sideg-0/+6
2024-09-12Use Autoderef::silence_errors more liberally throughout diagnostics codeMichael Goulet-11/+1
2024-09-12Do not report an excessive number of overflow errors for an ever-growing ↵Michael Goulet-0/+47
deref impl
2024-09-10Report the `note` when specified in `diagnostic::on_unimplemented`FedericoBruzzone-0/+2
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-08-26Do not ICE on non-ADT rcvr type when looking for crate version collisionEsteban Küber-0/+25
When looking for multiple versions of the same crate, do not blindly construct the receiver type. Follow up to #128786. Fix #129205.
2024-07-29Rollup merge of #128239 - compiler-errors:error-on-object-cand-confirm, ↵Matthias Krüger-0/+22
r=oli-obk Don't ICE when encountering error regions when confirming object method candidate See the inline comment for an explanation. Fixes #122914
2024-07-26Don't ICE when encountering error regions when confirming object method ↵Michael Goulet-0/+22
candidate
2024-07-22Revert suggestion verbosity changeEsteban Küber-12/+6
2024-07-22On generic and lifetime removal suggestion, do not leave behind stray `,`Esteban Küber-2/+2
2024-07-22Change suggestion message wordingEsteban Küber-2/+2
2024-07-22Use verbose suggestion for "wrong # of generics"Esteban Küber-6/+12
2024-07-17Rollup merge of #125042 - long-long-float:suggest-move-arg-outside, r=fmeaseMatthias Krüger-2/+2
Use ordinal number in argument error Add an ordinal number to two argument errors ("unexpected" and "missing") for ease of understanding error. ``` error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> test.rs:11:5 | 11 | f(42, 'a'); | ^ --- 2nd argument of type `f32` is missing | (snip) error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> test.rs:12:5 | 12 | f(42, 42, 1.0, 'a'); | ^ ---- | | | | | unexpected 2nd argument of type `{integer}` | help: remove the extra argument ``` To get an ordinal number, I copied `ordinalize` from other crate `rustc_resolve` because I think it is too much to link `rustc_resolve` for this small function. Please let me know if there is a better way.
2024-07-15Make sure trait def ids match before zipping args in ↵Michael Goulet-0/+97
note_function_argument_obligation
2024-07-14Use ordinal number in argument errorlong-long-float-2/+2
Fix error message Fix tests Format
2024-07-05Use verbose style for argument removal suggestionEsteban Küber-4/+6
2024-06-13Method resolution constrains hidden types instead of rejecting method candidatesOli Scherer-39/+3
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-3/+3
r=compiler-errors Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology. Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense. --- Old terminology (HIR, rustdoc): ``` `TypeBinding`: (associated) type binding ├── `Constraint`: associated type bound └── `Equality`: (associated) equality constraint (?) ├── `Ty`: (associated) type binding └── `Const`: associated const equality (constraint) ``` Old terminology (AST, abbrev.): ``` `AssocConstraint` ├── `Bound` └── `Equality` ├── `Ty` └── `Const` ``` New terminology (AST, HIR, rustdoc): ``` `AssocItemConstraint`: associated item constraint ├── `Bound`: associated type bound └── `Equality`: associated item equality constraint OR associated item binding (for short) ├── `Ty`: associated type equality constraint OR associated type binding (for short) └── `Const`: associated const equality constraint OR associated const binding (for short) ``` r? compiler-errors
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-3/+3
2024-05-23Don't continue probing for method if in suggestion and autoderef hits ambiguityMichael Goulet-0/+25
2024-05-20Note for E0599 if shadowed bindings has the method.surechen-0/+24
implement #123558
2024-05-13Add test to make sure suggestions are still quickMichael Goulet-0/+247
2024-05-09Fix test problems discovered by the revision checkZalathar-0/+1
Most of these changes either add revision names that were apparently missing, or explicitly mark a revision name as currently unused.
2024-05-04compiletest: add enable-by-default check-cfgUrgau-0/+3
2024-04-27tests: remove some trailing wsklensy-1/+1