Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
728017e
Make AsyncDrop check that it's being implemented on a local ADT
compiler-errors Jul 9, 2025
b7d024b
moved tests
Kivooeo Jul 13, 2025
f5485e5
docs(alloc::fmt): Make `type` optional, instead of matching the empty…
nik-rev Jul 13, 2025
c6e1b21
Use hygenic macros for stable-mir
jacob-greenfield Jul 16, 2025
2ca2d93
Auto-label `src/ci` and `.github/workflows` with `A-CI`
jieyouxu Jul 17, 2025
491b873
Add myself to `infra-ci` reviewer group
jieyouxu Jul 17, 2025
c0597fb
cleaned up some tests
Kivooeo Jul 13, 2025
f204801
fix: fix issue 143740, Wrong messages from compiler confusing methods…
lichuang Jul 16, 2025
a886852
ci: use windows 22 for all free runners
marcoieni Jul 17, 2025
998df3a
resolve: Make disambiguators for underscore bindings module-local
petrochenkov Jul 15, 2025
2f5722c
Make `Option` `const PartialEq`
oli-obk Jul 11, 2025
9d29583
Make `NonZero` `const PartialEq`
oli-obk Jul 11, 2025
250648e
Make `derive_const` usable within libcore again
oli-obk Jul 11, 2025
cecf9ea
Add test raw-underscore-lifetime.rs
xizheyin Jul 1, 2025
848d4a5
Remove similar errors about raw underscore lifetime
xizheyin Jul 1, 2025
2dac5e9
Be a bit more careful around exotic cycles in in the inliner
compiler-errors Jul 9, 2025
68b415a
Make slices `[const] PartialEq`
oli-obk Jul 11, 2025
c375244
Add test for `default_field_values` and `const_default`
estebank Jul 8, 2025
949a8b9
Rollup merge of #143280 - xizheyin:143152-1, r=compiler-errors
matthiaskrgr Jul 18, 2025
c601fa9
Rollup merge of #143649 - estebank:const-trait-default-field-value, r…
matthiaskrgr Jul 18, 2025
b41deff
Rollup merge of #143699 - compiler-errors:async-drop-fund, r=oli-obk
matthiaskrgr Jul 18, 2025
23a3970
Rollup merge of #143704 - compiler-errors:cycle-exotic, r=cjgillot
matthiaskrgr Jul 18, 2025
77c8cde
Rollup merge of #143908 - Kivooeo:tf0, r=jieyouxu
matthiaskrgr Jul 18, 2025
9a7cca3
Rollup merge of #143909 - nik-rev:patch-1, r=jhpratt
matthiaskrgr Jul 18, 2025
0fdb283
Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead
matthiaskrgr Jul 18, 2025
3190751
Rollup merge of #143997 - Coder-256:stable-mir-macro-hygiene, r=oli-obk
matthiaskrgr Jul 18, 2025
999aa22
Rollup merge of #144013 - petrochenkov:disambunder, r=oli-obk
matthiaskrgr Jul 18, 2025
2d377d2
Rollup merge of #144029 - lichuang:fix_issue_143740, r=compiler-errors
matthiaskrgr Jul 18, 2025
97bee8f
Rollup merge of #144063 - jieyouxu:label-ci, r=Kobzol
matthiaskrgr Jul 18, 2025
2e21aa8
Rollup merge of #144069 - marcoieni:windows-22-free, r=jieyouxu
matthiaskrgr Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fix issue 143740, Wrong messages from compiler confusing methods…
… with the same name from different traits
  • Loading branch information
lichuang committed Jul 17, 2025
commit f2048019718409885ac57c480f010bdfbfe5bfd0
3 changes: 2 additions & 1 deletion compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
}
}

let sources = candidates.iter().map(|p| self.candidate_source(p, self_ty)).collect();
let sources =
applicable_candidates.iter().map(|p| self.candidate_source(p.0, self_ty)).collect();
return Some(Err(MethodError::Ambiguity(sources)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ LL | x.fmt(f);
= help: items from traits can only be used if the trait is in scope
help: the following traits which provide `fmt` are implemented but not in scope; perhaps you want to import one of them
|
LL + use std::fmt::Binary;
|
LL + use std::fmt::Debug;
|
LL + use std::fmt::Display;
|
LL + use std::fmt::LowerExp;
LL + use std::fmt::Pointer;
|
= and 5 other candidates

error: aborting due to 2 previous errors

Expand Down
8 changes: 0 additions & 8 deletions tests/ui/impl-trait/no-method-suggested-traits.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ help: the following traits which provide `method` are implemented but not in sco
|
LL + use foo::Bar;
|
LL + use no_method_suggested_traits::Reexported;
|
LL + use no_method_suggested_traits::foo::PubPub;
|
LL + use no_method_suggested_traits::qux::PrivPub;
|
help: there is a method `method2` with a similar name
|
LL | 1u32.method2();
Expand All @@ -31,12 +27,8 @@ help: the following traits which provide `method` are implemented but not in sco
|
LL + use foo::Bar;
|
LL + use no_method_suggested_traits::Reexported;
|
LL + use no_method_suggested_traits::foo::PubPub;
|
LL + use no_method_suggested_traits::qux::PrivPub;
|
help: there is a method `method2` with a similar name
|
LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,22 @@ error[E0034]: multiple applicable items in scope
LL | let z = x.foo();
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in the trait `FinalFoo`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:60:5
|
LL | fn foo(&self) -> u8;
| ^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `NuisanceFoo` for the type `T`
note: candidate #1 is defined in an impl of the trait `NuisanceFoo` for the type `T`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:73:9
|
LL | fn foo(self) {}
| ^^^^^^^^^^^^
note: candidate #3 is defined in an impl of the trait `X` for the type `T`
note: candidate #2 is defined in an impl of the trait `X` for the type `T`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:46:9
|
LL | fn foo(self: Smaht<Self, u64>) -> u64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL - let z = x.foo();
LL + let z = FinalFoo::foo(&x);
|
help: disambiguate the method for candidate #2
|
LL - let z = x.foo();
LL + let z = NuisanceFoo::foo(x);
|
help: disambiguate the method for candidate #3
help: disambiguate the method for candidate #2
|
LL - let z = x.foo();
LL + let z = X::foo(x);
Expand Down
34 changes: 34 additions & 0 deletions tests/ui/methods/wrong-ambig-message.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
fn main() {
trait Hello {
fn name(&self) -> String;
}

#[derive(Debug)]
struct Container2 {
val: String,
}

trait AName2 {
fn name(&self) -> String;
}

trait BName2 {
fn name(&self, v: bool) -> String;
}

impl AName2 for Container2 {
fn name(&self) -> String {
"aname2".into()
}
}

impl BName2 for Container2 {
fn name(&self, _v: bool) -> String {
"bname2".into()
}
}

let c2 = Container2 { val: "abc".into() };
println!("c2 = {:?}", c2.name());
//~^ ERROR: multiple applicable items in scope
}
30 changes: 30 additions & 0 deletions tests/ui/methods/wrong-ambig-message.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error[E0034]: multiple applicable items in scope
--> $DIR/wrong-ambig-message.rs:32:30
|
LL | println!("c2 = {:?}", c2.name());
| ^^^^ multiple `name` found
|
note: candidate #1 is defined in an impl of the trait `AName2` for the type `Container2`
--> $DIR/wrong-ambig-message.rs:20:9
|
LL | fn name(&self) -> String {
| ^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `BName2` for the type `Container2`
--> $DIR/wrong-ambig-message.rs:26:9
|
LL | fn name(&self, _v: bool) -> String {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL - println!("c2 = {:?}", c2.name());
LL + println!("c2 = {:?}", AName2::name(&c2));
|
help: disambiguate the method for candidate #2
|
LL - println!("c2 = {:?}", c2.name());
LL + println!("c2 = {:?}", BName2::name(&c2));
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0034`.
Loading