Rustdoc-Json: Document HRTB's on DynTrait#99787
Conversation
src/rustdoc-json-types/lib.rs
Outdated
There was a problem hiding this comment.
I wasn't sure what the best name for this is. The compiler seems to use PolyTrait everywhere for this, but I don't think it's ever used outside that context.
There was a problem hiding this comment.
A Trait with possible HRTB params
There was a problem hiding this comment.
Don't hesitate to add doc comments to explain what it stands for. Always appreciated.
|
Looks good to me. Considering how big this change is, a second opinion would be very appreciated though. cc @camelid @notriddle |
|
Thanks you so much for fixing this. I have skimmed through the change and it looks good to me. FYI, I have run the cargo-public-api test suite against this change and it found no regressions. The cargo-public-api test suite covers some cases the in-tree test suite does not (See e.g. https://github.com/Enselic/cargo-public-api/issues/67) so it's always nice to make sure nothing breaks for big changes like these, I think. |
|
☔ The latest upstream changes (presumably #99577) made this pull request unmergeable. Please resolve the merge conflicts. |
Because python doesn't have lexical scope, loop variables persist after the loop is exited, set to the value of the last itteration ``` >>> i = 0 >>> for i in range(10): pass ... >>> i 9 ``` This causes the `ty` variable to be changed, causing unexpected crashes on ``` pub type RefFn<'a> = &'a dyn for<'b> Fn(&'a i32) -> i32; ```
|
Rebased onto master, updated documentation, renamed @rustbot ready |
src/librustdoc/json/conversions.rs
Outdated
There was a problem hiding this comment.
It seems to be doing the same thing but instead of creating one vector, it creates two. Did I miss something?
There was a problem hiding this comment.
Ah no nevermind. But then I wonder why the into_vec is needed at all...
There was a problem hiding this comment.
Because it’s not a Vec. It’s a boxed slice.
There was a problem hiding this comment.
Probably it could skip the into_vec because of the impl for IntoIterator right?
There was a problem hiding this comment.
args is a Box<[GenericArg]>, which doesn't impl IntoIterator, but Vec does and the conversion is zero cost. I guess you could impl <T, U: FromWithTcx<T>> FromWithTcx<Box<[T]>> for Vec<U>, but I don't think thats worth it as it only comes up twice.
There was a problem hiding this comment.
Huh strange. Well if it doesn't work don't worry about it then.
camelid
left a comment
There was a problem hiding this comment.
The code changes overall look good to me, though there are a few things I'd like changed. I haven't reviewed the tests.
src/librustdoc/json/conversions.rs
Outdated
There was a problem hiding this comment.
Probably it could skip the into_vec because of the impl for IntoIterator right?
src/librustdoc/json/conversions.rs
Outdated
There was a problem hiding this comment.
Ideally we keep it in Path form rather than allowing it to be any type. (Type definition needs to be updated too.)
| trait_: clean::Type::Path { path: trait_ }.into_tcx(tcx), | |
| trait_: trait_.into_tcx(tcx), |
There was a problem hiding this comment.
We don't yet have a ResolvedPath type in the json output, so I think that should be done in a followup change, as theirs a couple of other places we'd also want to use it (
rust/src/librustdoc/json/conversions.rs
Line 423 in e141246
rust/src/librustdoc/json/conversions.rs
Line 500 in e141246
There was a problem hiding this comment.
Ok, makes sense to hold off then.
|
@rustbot ready |
|
Ok @GuillaumeGomez this should be ready for your final review :) |
|
Looks good to me, thanks! @bors r=camelid,notriddle,GuillaumeGomez |
Rollup of 7 pull requests Successful merges: - rust-lang#96478 (Implement `#[rustc_default_body_unstable]`) - rust-lang#99787 (Rustdoc-Json: Document HRTB's on DynTrait) - rust-lang#100181 (add method to get the mutability of an AllocId) - rust-lang#100221 (Don't document impossible to call default trait items on impls) - rust-lang#100228 (Don't ICE while suggesting updating item path.) - rust-lang#100301 (Avoid `&str` to `String` conversions) - rust-lang#100305 (Suggest adding an appropriate missing pattern excluding comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Closes #99118
Probably best reviewed commit by commit.
@rustbot modify labels: +A-rustdoc-json
cc @Enselic
r? @CraftSpider