about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-06 23:06:10 +0200
committerGitHub <noreply@github.com>2022-04-06 23:06:10 +0200
commitebba894f197ac06bfca84d61e11234484ce74773 (patch)
treea3c11a30dc96000927385cae40f36a194b09ed41 /src/test
parentd2697e31280bae9e85adda11b87e6fc76db0ed63 (diff)
parent27dc503556f220a747b1d3b155f9d3671c33fa9a (diff)
downloadrust-ebba894f197ac06bfca84d61e11234484ce74773.tar.gz
rust-ebba894f197ac06bfca84d61e11234484ce74773.zip
Rollup merge of #95731 - oli-obk:lazy_tait_regression, r=compiler-errors
Check that all hidden types are the same and then deduplicate them.

fixes #95538

This used to trigger a sanity check. Now we accept that there may be multiple places where a hidden type is constrained and we merge all of these at the end.

Ideally we'd merge eagerly, but that is a larger refactoring that I don't want to put into a backport
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/type-alias-impl-trait/multiple_definitions.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/multiple_definitions.rs b/src/test/ui/type-alias-impl-trait/multiple_definitions.rs
new file mode 100644
index 00000000000..9e6268e63cd
--- /dev/null
+++ b/src/test/ui/type-alias-impl-trait/multiple_definitions.rs
@@ -0,0 +1,30 @@
+// check-pass
+
+use std::marker::PhantomData;
+
+pub struct ConcreteError {}
+pub trait IoBase {}
+struct X {}
+impl IoBase for X {}
+
+pub struct ClusterIterator<B, E, S = B> {
+    pub fat: B,
+    phantom_s: PhantomData<S>,
+    phantom_e: PhantomData<E>,
+}
+
+pub struct FileSystem<IO: IoBase> {
+    pub disk: IO,
+}
+
+impl<IO: IoBase> FileSystem<IO> {
+    pub fn cluster_iter(&self) -> ClusterIterator<impl IoBase + '_, ConcreteError> {
+        ClusterIterator {
+            fat: X {},
+            phantom_s: PhantomData::default(),
+            phantom_e: PhantomData::default(),
+        }
+    }
+}
+
+fn main() {}