about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2021-10-26 23:24:45 +0100
committerGary Guo <gary@garyguo.net>2021-11-15 02:14:54 +0000
commit6ad626fb5c79bbaafcf533780e30b03d73737c57 (patch)
tree6f4f7845c524320345fccb8228c87b19df9dfa45 /src
parent6a207f23eb5570d10b98dcfa669c17d5ab94e8af (diff)
downloadrust-6ad626fb5c79bbaafcf533780e30b03d73737c57.tar.gz
rust-6ad626fb5c79bbaafcf533780e30b03d73737c57.zip
Add regression test for issue 90320
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/inference/auxiliary/inference_unstable_iterator.rs17
-rw-r--r--src/test/ui/inference/auxiliary/inference_unstable_itertools.rs14
-rw-r--r--src/test/ui/inference/inference_unstable.rs9
-rw-r--r--src/test/ui/inference/inference_unstable.stderr37
4 files changed, 75 insertions, 2 deletions
diff --git a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
index 91fc398f741..04bc0b1a8ac 100644
--- a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
+++ b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
@@ -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;
 }
diff --git a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
index e00adda5c33..fa1efbcfefc 100644
--- a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
+++ b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
@@ -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;
 }
 
diff --git a/src/test/ui/inference/inference_unstable.rs b/src/test/ui/inference/inference_unstable.rs
index 86bb62b8a5f..daf0cf042c4 100644
--- a/src/test/ui/inference/inference_unstable.rs
+++ b/src/test/ui/inference/inference_unstable.rs
@@ -16,6 +16,15 @@ 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
 //~| WARN once this associated item is added to the standard library, the ambiguity may cause an
diff --git a/src/test/ui/inference/inference_unstable.stderr b/src/test/ui/inference/inference_unstable.stderr
index 2c282e610b2..df7a09686bf 100644
--- a/src/test/ui/inference/inference_unstable.stderr
+++ b/src/test/ui/inference/inference_unstable.stderr
@@ -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