Auto merge of #90329 - nbdd0121:typeck, r=nagisa
Try all stable method candidates first before trying unstable ones Currently we try methods in this order in each step: * Stable by value * Unstable by value * Stable autoref * Unstable autoref * ... This PR changes it to first try pick methods without any unstable candidates, and if none is found, try again to pick unstable ones. Fix #90320 CC #88971, hopefully would allow us to rename the "unstable_*" methods for integer impls back. `@rustbot` label T-compiler T-libs-api
This commit is contained in:
commit
ce3f3a5ffa
7 changed files with 191 additions and 27 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(staged_api)]
|
||||
#![feature(arbitrary_self_types)]
|
||||
|
||||
#![stable(feature = "ipu_iterator", since = "1.0.0")]
|
||||
|
||||
|
|
@ -8,6 +9,22 @@ pub trait IpuIterator {
|
|||
fn ipu_flatten(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[unstable(feature = "ipu_flatten", issue = "99999")]
|
||||
fn ipu_by_value_vs_by_ref(self) -> u32 where Self: Sized {
|
||||
0
|
||||
}
|
||||
|
||||
#[unstable(feature = "ipu_flatten", issue = "99999")]
|
||||
fn ipu_by_ref_vs_by_ref_mut(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[unstable(feature = "ipu_flatten", issue = "99999")]
|
||||
fn ipu_by_mut_ptr_vs_by_const_ptr(self: *mut Self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[unstable(feature = "assoc_const_ipu_iter", issue = "99999")]
|
||||
const C: i32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,22 @@
|
|||
#![feature(arbitrary_self_types)]
|
||||
|
||||
pub trait IpuItertools {
|
||||
fn ipu_flatten(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn ipu_by_value_vs_by_ref(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn ipu_by_ref_vs_by_ref_mut(&mut self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn ipu_by_mut_ptr_vs_by_const_ptr(self: *const Self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
const C: i32;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ use inference_unstable_itertools::IpuItertools;
|
|||
fn main() {
|
||||
assert_eq!('x'.ipu_flatten(), 1);
|
||||
//~^ WARN an associated function with this name may be added to the standard library in the future
|
||||
//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
|
||||
assert_eq!('x'.ipu_by_value_vs_by_ref(), 1);
|
||||
//~^ WARN an associated function with this name may be added to the standard library in the future
|
||||
//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
|
||||
assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1);
|
||||
//~^ WARN an associated function with this name may be added to the standard library in the future
|
||||
//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
|
||||
assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1);
|
||||
//~^ WARN an associated function with this name may be added to the standard library in the future
|
||||
//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
|
||||
assert_eq!(char::C, 1);
|
||||
//~^ WARN an associated constant with this name may be added to the standard library in the future
|
||||
|
|
|
|||
|
|
@ -10,8 +10,41 @@ LL | assert_eq!('x'.ipu_flatten(), 1);
|
|||
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method
|
||||
= help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten`
|
||||
|
||||
warning: an associated function with this name may be added to the standard library in the future
|
||||
--> $DIR/inference_unstable.rs:19:20
|
||||
|
|
||||
LL | assert_eq!('x'.ipu_by_value_vs_by_ref(), 1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
|
||||
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
|
||||
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_value_vs_by_ref(...)` to keep using the current method
|
||||
= help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref`
|
||||
|
||||
warning: an associated function with this name may be added to the standard library in the future
|
||||
--> $DIR/inference_unstable.rs:22:20
|
||||
|
|
||||
LL | assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
|
||||
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
|
||||
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_ref_vs_by_ref_mut(...)` to keep using the current method
|
||||
= help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut`
|
||||
|
||||
warning: an associated function with this name may be added to the standard library in the future
|
||||
--> $DIR/inference_unstable.rs:25:40
|
||||
|
|
||||
LL | assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
|
||||
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
|
||||
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_mut_ptr_vs_by_const_ptr(...)` to keep using the current method
|
||||
= help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_mut_ptr_vs_by_const_ptr`
|
||||
|
||||
warning: an associated constant with this name may be added to the standard library in the future
|
||||
--> $DIR/inference_unstable.rs:19:16
|
||||
--> $DIR/inference_unstable.rs:28:16
|
||||
|
|
||||
LL | assert_eq!(char::C, 1);
|
||||
| ^^^^^^^ help: use the fully qualified path to the associated const: `<char as IpuItertools>::C`
|
||||
|
|
@ -20,5 +53,5 @@ LL | assert_eq!(char::C, 1);
|
|||
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
|
||||
= help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C`
|
||||
|
||||
warning: 2 warnings emitted
|
||||
warning: 5 warnings emitted
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue