Add regression test for issue 90320

This commit is contained in:
Gary Guo 2021-10-26 23:24:45 +01:00
parent 6a207f23eb
commit 6ad626fb5c
4 changed files with 75 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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