forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#98053 - GuillaumeGomez:fix-generic-impl-jso…
…n-ice, r=notriddle Fix generic impl rustdoc json output Fixes rust-lang#97986. The problem in case of generic trait impl is that the trait's items are the same for all the types afterward. But since they're the same, it's safe for rustdoc-json to just ignore them. A little representation of what's going on: ```rust trait T { fn f(); // <- defid 0 } impl<Y> T for Y { fn f() {} // <- defid 1 } struct S; // <- defid 1 (since it matches `impl<Y> T for Y` ``` cc ``@Urgau`` r? ``@CraftSpider``
- Loading branch information
Showing
2 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/97986>. | ||
|
||
// @has generic_impl.json | ||
// @has - "$.index[*][?(@.name=='f')]" | ||
// @has - "$.index[*][?(@.name=='AssocTy')]" | ||
// @has - "$.index[*][?(@.name=='AssocConst')]" | ||
|
||
pub mod m { | ||
pub struct S; | ||
} | ||
|
||
pub trait F { | ||
type AssocTy; | ||
const AssocConst: usize; | ||
fn f() -> m::S; | ||
} | ||
|
||
impl<T> F for T { | ||
type AssocTy = u32; | ||
const AssocConst: usize = 0; | ||
fn f() -> m::S { | ||
m::S | ||
} | ||
} |