mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 05:13:35 +00:00
fix: Prevent infinite recursion of bounds formatting
This commit is contained in:
parent
649e65ce1e
commit
3fe7415c83
3 changed files with 128 additions and 71 deletions
|
|
@ -10349,40 +10349,3 @@ macro_rules! str {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_19007() {
|
||||
check(
|
||||
r#"
|
||||
trait Foo {
|
||||
type Assoc;
|
||||
|
||||
fn foo(&self) -> Self::Assoc;
|
||||
}
|
||||
|
||||
trait Bar {
|
||||
type Target;
|
||||
}
|
||||
|
||||
trait Baz<T> {}
|
||||
|
||||
struct Struct<T: Foo> {
|
||||
field: T,
|
||||
}
|
||||
|
||||
impl<T> Struct<T>
|
||||
where
|
||||
T: Foo,
|
||||
T::Assoc: Baz<<T::Assoc as Bar>::Target> + Bar,
|
||||
{
|
||||
fn f(&self) {
|
||||
let x$0 = self.field.foo();
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![
|
||||
r#"
|
||||
"#
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1203,6 +1203,40 @@ fn f5<G: T<Assoc = ()>>(it: G) {
|
|||
let l = it.f();
|
||||
//^ ()
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_19007() {
|
||||
check_types(
|
||||
r#"
|
||||
trait Foo {
|
||||
type Assoc;
|
||||
|
||||
fn foo(&self) -> Self::Assoc;
|
||||
}
|
||||
|
||||
trait Bar {
|
||||
type Target;
|
||||
}
|
||||
|
||||
trait Baz<T> {}
|
||||
|
||||
struct Struct<T: Foo> {
|
||||
field: T,
|
||||
}
|
||||
|
||||
impl<T> Struct<T>
|
||||
where
|
||||
T: Foo,
|
||||
T::Assoc: Baz<<T::Assoc as Bar>::Target> + Bar,
|
||||
{
|
||||
fn f(&self) {
|
||||
let x = self.field.foo();
|
||||
//^ impl Baz<<<T as Foo>::Assoc as Bar>::Target> + Bar
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue