about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-02 21:22:04 +0200
committerGitHub <noreply@github.com>2024-04-02 21:22:04 +0200
commit8e271d70a249b69a1dbb4667e106dd9cd9d94d1a (patch)
treea9826bfce18a53f3d79087482402f8c86273b259 /tests
parent93729488895537f7ddc0dccb1ec817eb1d8a28af (diff)
parent70b4ace09d5b1033c751654b9bbe714eeb4d5b4d (diff)
downloadrust-8e271d70a249b69a1dbb4667e106dd9cd9d94d1a.tar.gz
rust-8e271d70a249b69a1dbb4667e106dd9cd9d94d1a.zip
Rollup merge of #123375 - fmease:rustdoc-sati-re-hotfix, r=GuillaumeGomez
rustdoc: synthetic auto trait impls: accept unresolved region vars for now

https://github.com/rust-lang/rust/pull/123348#issuecomment-2032494255:

> Right, [in #123340] I've intentionally changed a `vid_map.get(vid).unwrap_or(r)` to a `vid_map[vid]` making rustdoc panic if `rustc::AutoTraitFinder` returns a region inference variable that cannot be resolved because that is really fishy.  I can change it back with a `FIXME: investigate` […]. [O]nce I [fully] understand [the arcane] `rustc::AutoTraitFinder` [I] can fix the underlying issue if there's one.
>
> `rustc::AutoTraitFinder` can also return placeholder regions `RePlaceholder` which doesn't seem right either and which makes rustdoc ICE, too (we have a GitHub issue for that already[, namely #120606]).

Fixes #123370.
Fixes #112242.

r? ``@GuillaumeGomez``
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs17
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs11
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs
new file mode 100644
index 00000000000..1b67c2bc875
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs
@@ -0,0 +1,17 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 112242
+//@ check-pass
+//@ compile-flags: -Znormalize-docs
+
+pub trait MyTrait<'a> {
+    type MyItem;
+}
+pub struct Inner<Q>(Q);
+pub struct Outer<Q>(Inner<Q>);
+
+impl<'a, Q> std::marker::Unpin for Inner<Q>
+where
+    Q: MyTrait<'a>,
+    <Q as MyTrait<'a>>::MyItem: Copy,
+{
+}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs
new file mode 100644
index 00000000000..31d1b11ff31
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs
@@ -0,0 +1,11 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 123370
+//@ check-pass
+
+pub struct Inner<'a, Q>(&'a (), Q);
+
+pub struct Outer<'a, Q>(Inner<'a, Q>);
+
+impl<'a, Q: Trait<'a>> std::marker::Unpin for Inner<'static, Q> {}
+
+pub trait Trait<'a> {}