Normalize <X as Y>::T for rustdoc#77467
Conversation
a1ad03f to
3a57b53
Compare
GuillaumeGomez
left a comment
There was a problem hiding this comment.
The generated doc is simpler, so I strongly approve this change! Well done. :)
|
Great job, @jyn514 !! 🔥 |
|
Summarizing my conversation with eddyb:
|
0d06449 to
c647bcb
Compare
|
This now works for cross-crate re-exports, but does not work for 'partial' normalization like Fixing partial normalization requires actually having a correct ParamEnv, which requires a lot of infrastructure in rustdoc I'm not sure how to write. @eddyb I know this isn't 100% correct, but do you think it's better than the current situation of no normalization at all? I'm not sure where to start for having a correct ParamEnv :/ |
|
Current status: this is blocked on #78082 to get the param context, since otherwise the API is different enough from rustc I wouldn't be convinced it had consistent behavior. |
49e8029 to
2833896
Compare
|
Still looks good to me! Waiting for @eddyb now. :) |
This comment has been minimized.
This comment has been minimized.
|
r? @oli-obk |
oli-obk
left a comment
There was a problem hiding this comment.
just a nit, then this lgtm
... and fix some fuzzy wording in the debug logging.
|
@bors r=oli-obk 🎉 🎉 |
|
📌 Commit 277bdbc has been approved by |
|
☀️ Test successful - checks-actions |
Cleanup more of rustdoc - Use `Item::from_def_id` for StructField - Use `from_def_id_and_parts` for primitives and keywords - Take `String` instead of `Symbol` in `from_def_id` - this avoids having to intern then immediately stringify the existing string. - Remove unused `get_stability` and `get_deprecation` - Remove unused `attrs` field from `primitives` - Remove unused `attrs` field from `keywords` This will probably conflict with rust-lang#79335 and I would prefer for that PR to land first - I'm anxious for rust-lang#77467 to land :) Makes rust-lang#76998 easier to add. r? `@GuillaumeGomez`
…jyn514 Revert "Normalize `<X as Y>::T` for rustdoc" Reverts rust-lang#77467 by disabling normalization. See rust-lang#79459; I intend to reland normalization once that's fixed. r? `@Aaron1011` cc `@oli-obk` `@GuillaumeGomez`
Don't run `resolve_vars_if_possible` in `normalize_erasing_regions` Neither `@eddyb` nor I could figure out what this was for. I changed it to `assert_eq!(normalized_value, infcx.resolve_vars_if_possible(&normalized_value));` and it passed the UI test suite. <details><summary> Outdated, I figured out the issue - `needs_infer()` needs to come _after_ erasing the lifetimes </summary> Strangely, if I change it to `assert!(!normalized_value.needs_infer())` it panics almost immediately: ``` query stack during panic: #0 [normalize_generic_arg_after_erasing_regions] normalizing `<str::IsWhitespace as str::pattern::Pattern>::Searcher` #1 [needs_drop_raw] computing whether `str::iter::Split<str::IsWhitespace>` needs drop #2 [mir_built] building MIR for `str::<impl str>::split_whitespace` #3 [unsafety_check_result] unsafety-checking `str::<impl str>::split_whitespace` #4 [mir_const] processing MIR for `str::<impl str>::split_whitespace` #5 [mir_promoted] processing `str::<impl str>::split_whitespace` rust-lang#6 [mir_borrowck] borrow-checking `str::<impl str>::split_whitespace` rust-lang#7 [analysis] running analysis passes on this crate end of query stack ``` I'm not entirely sure what's going on - maybe the two disagree? </details> For context, this came up while reviewing rust-lang#77467 (cc `@lcnr).` Possibly this needs a crater run? r? `@nikomatsakis` cc `@matthewjasper`




QPath::ResolvedwithSomeself parameter (<X as Y>::T)The first commit is a pure refactor and should probably be reviewed by @GuillaumeGomez. I recommend reviewing the second commit on its own.
Fixes #77459.
r? @eddyb
cc @danielhenrymantilla , @lcnr