mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
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``
This commit is contained in:
commit
8e271d70a2
@ -181,8 +181,14 @@ fn clean_param_env<'tcx>(
|
||||
})
|
||||
.map(|pred| {
|
||||
tcx.fold_regions(pred, |r, _| match *r {
|
||||
ty::ReVar(vid) => vid_to_region[&vid],
|
||||
// FIXME: Don't `unwrap_or`, I think we should panic if we encounter an infer var that
|
||||
// we can't map to a concrete region. However, `AutoTraitFinder` *does* leak those kinds
|
||||
// of `ReVar`s for some reason at the time of writing. See `rustdoc-ui/` tests.
|
||||
// This is in dire need of an investigation into `AutoTraitFinder`.
|
||||
ty::ReVar(vid) => vid_to_region.get(&vid).copied().unwrap_or(r),
|
||||
ty::ReEarlyParam(_) | ty::ReStatic | ty::ReBound(..) | ty::ReError(_) => r,
|
||||
// FIXME(#120606): `AutoTraitFinder` can actually leak placeholder regions which feels
|
||||
// incorrect. Needs investigation.
|
||||
ty::ReLateParam(_) | ty::RePlaceholder(_) | ty::ReErased => {
|
||||
bug!("unexpected region kind: {r:?}")
|
||||
}
|
||||
|
@ -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,
|
||||
{
|
||||
}
|
@ -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> {}
|
Loading…
Reference in New Issue
Block a user