about summary refs log tree commit diff
path: root/tests/ui/methods/tuple-suggestions-issue-142488.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-09-10 18:17:51 +0000
committerbors <bors@rust-lang.org>2025-09-10 18:17:51 +0000
commit1c785abde778e1173dce1aba1ae471814c8fa1ab (patch)
tree4eea515b347e78c2887bf89c544e21533edc0a8f /tests/ui/methods/tuple-suggestions-issue-142488.rs
parentfb918cec013920472f6975b2009b0339d9e8cc9c (diff)
parentb630713bdf6fa2a00b66c7174bb147c40067c9d4 (diff)
downloadrust-1c785abde778e1173dce1aba1ae471814c8fa1ab.tar.gz
rust-1c785abde778e1173dce1aba1ae471814c8fa1ab.zip
Auto merge of #146350 - cuviper:beta-next, r=cuviper
[beta] backports

- Rust build fails on OpenBSD after using file_lock feature rust-lang/rust#145511
- Revert suggestions for missing methods in tuples rust-lang/rust#145765
- When determining if a trait has no entries for the purposes of omitting vptrs from subtrait vtables, consider its transitive supertraits' entries, instead of just its own entries. rust-lang/rust#145807
- Ship LLVM tools for the correct target when cross-compiling rust-lang/rust#145763
- bootstrap: vendor `clippy_test_deps` too rust-lang/rust#145861

r? cuviper
Diffstat (limited to 'tests/ui/methods/tuple-suggestions-issue-142488.rs')
-rw-r--r--tests/ui/methods/tuple-suggestions-issue-142488.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/methods/tuple-suggestions-issue-142488.rs b/tests/ui/methods/tuple-suggestions-issue-142488.rs
new file mode 100644
index 00000000000..f6c58fce9a1
--- /dev/null
+++ b/tests/ui/methods/tuple-suggestions-issue-142488.rs
@@ -0,0 +1,48 @@
+// Regression test for issue #142488, a diagnostics ICE when trying to suggest missing methods
+// present in similar tuple types.
+// This is a few of the MCVEs from the issues and its many duplicates.
+
+// 1
+fn main() {
+    for a in x {
+        //~^ ERROR: cannot find value `x` in this scope
+        (a,).to_string()
+        //~^ ERROR: the method `to_string` exists for tuple
+    }
+}
+
+// 2
+trait Trait {
+    fn meth(self);
+}
+
+impl<T, U: Trait> Trait for (T, U) {
+    fn meth(self) {}
+}
+
+fn mcve2() {
+    ((), std::collections::HashMap::new()).meth()
+    //~^ ERROR: the method `meth` exists for tuple
+}
+
+// 3
+trait I {}
+
+struct Struct;
+impl I for Struct {}
+
+trait Tr {
+    fn f<A>(self) -> (A,)
+    where
+        Self: Sized,
+    {
+        loop {}
+    }
+}
+
+impl<T> Tr for T where T: I {}
+
+fn mcve3() {
+    Struct.f().f();
+    //~^ ERROR: the method `f` exists for tuple
+}