-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc-json: Better representation of lifetime bounds in where clauses.
As suggested [on zulip][1], there's no need to use `GenericBound` here, as the only bound a lifetime can have is that it outlives other lifetimes. While we're making breaking changes here, I also renamed it from using "region" to "lifetime", as this is more user-aligned. See [this comment][2] for details. [1]: https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/.60ItemEnum.3A.3AOpaqueTy.60/near/448871430 [2]: #100961 (comment)
- Loading branch information
1 parent
c872a14
commit 7e8aac5
Showing
6 changed files
with
47 additions
and
8 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
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
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,8 @@ | ||
// ignore-tidy-linelength | ||
|
||
// @count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2 | ||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\" | ||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' [] | ||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"' | ||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]' | ||
pub fn outlives<'a, T: 'a>() {} |
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 @@ | ||
// ignore-tidy-linelength | ||
|
||
// @is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]' | ||
pub fn on_lifetimes<'a, 'b, 'c, 'all>() | ||
where | ||
'all: 'a + 'b + 'c, | ||
{ | ||
} | ||
|
||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[*]' 2 | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\" | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' [] | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"' | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' [] | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' [] | ||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1 | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"' | ||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1 | ||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\" | ||
pub fn on_trait<'a, T>() | ||
where | ||
T: 'a, | ||
{ | ||
} |