about summary refs log tree commit diff
path: root/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-08-06 15:55:42 +0200
committerGitHub <noreply@github.com>2025-08-06 15:55:42 +0200
commite89ae47b978f50b6fc1873d65486d661520bdf28 (patch)
treeae387ab4a528a1d83c3816a5da26bc8772bd0723 /tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs
parentdc0bae1db725fbba8524f195f74f680995fd549e (diff)
parent7196d8cd661b875401126a81641d2effc40b3d85 (diff)
downloadrust-e89ae47b978f50b6fc1873d65486d661520bdf28.tar.gz
rust-e89ae47b978f50b6fc1873d65486d661520bdf28.zip
Rollup merge of #144552 - Oneirical:uncountable-integer-3, r=jieyouxu
Rehome 33 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that ``@Kivooeo`` was using.

r? ``@jieyouxu``
Diffstat (limited to 'tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs')
-rw-r--r--tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs
new file mode 100644
index 00000000000..e8c27ff5cc8
--- /dev/null
+++ b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs
@@ -0,0 +1,42 @@
+// https://github.com/rust-lang/rust/issues/20413
+trait Foo {
+    fn answer(self);
+}
+
+struct NoData<T>;
+//~^ ERROR: parameter `T` is never used
+
+impl<T> Foo for T where NoData<T>: Foo {
+  //~^ ERROR: overflow evaluating the requirement
+  fn answer(self) {
+    let val: NoData<T> = NoData;
+  }
+}
+
+trait Bar {
+    fn answer(self);
+}
+
+trait Baz {
+    fn answer(self);
+}
+
+struct AlmostNoData<T>(Option<T>);
+
+struct EvenLessData<T>(Option<T>);
+
+impl<T> Bar for T where EvenLessData<T>: Baz {
+//~^ ERROR: overflow evaluating the requirement
+  fn answer(self) {
+    let val: EvenLessData<T> = EvenLessData(None);
+  }
+}
+
+impl<T> Baz for T where AlmostNoData<T>: Bar {
+//~^ ERROR: overflow evaluating the requirement
+  fn answer(self) {
+    let val: NoData<T> = AlmostNoData(None);
+  }
+}
+
+fn main() {}