Balance sidebar Deref cycle check with main content

The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense
that the main content code path checks for cycles _before_ descending, while the
sidebar checks _after_. Checking _before_ is correct, so this changes the
sidebar path to match the main content path.
This commit is contained in:
J. Ryan Stinnett 2021-01-28 22:03:20 +00:00
parent 7ce1b3b244
commit 7e3217845d
2 changed files with 26 additions and 7 deletions

View file

@ -0,0 +1,15 @@
// check-pass
// #81395: Fix ICE when recursing into Deref target only differing in type args
pub struct Generic<T>(T);
impl<'a> std::ops::Deref for Generic<&'a mut ()> {
type Target = Generic<&'a ()>;
fn deref(&self) -> &Self::Target {
unimplemented!()
}
}
impl<'a> Generic<&'a ()> {
pub fn some_method(&self) {}
}