-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Don't use unnormalized type in Ty::fn_sig
call in rustdoc clean_middle_ty
#102831
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @CraftSpider (rust-highfive has picked a reviewer for you, use r? to override) |
@@ -1582,12 +1582,12 @@ fn normalize<'tcx>(cx: &mut DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> { | |||
} | |||
|
|||
pub(crate) fn clean_middle_ty<'tcx>( | |||
this: Ty<'tcx>, | |||
ty: Ty<'tcx>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally renaming this
-> ty
so that the normalized let ty = ...
below shadows the unnormalized type, so this doesn't happen again.
@@ -1610,7 +1610,6 @@ pub(crate) fn clean_middle_ty<'tcx>( | |||
type_: Box::new(clean_middle_ty(ty, cx, None)), | |||
}, | |||
ty::FnDef(..) | ty::FnPtr(_) => { | |||
let ty = cx.tcx.lift(this).expect("FnPtr lift failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But technically this is the only fix needed -- this should've been cx.tcx.lift(ty)
, but also isn't needed at all.
I didn't find this self explanatory at first - the problem here is that we were using a normalized and unnormalized type inconsistently, not just that it was unnormalized. The fix is to consistently use one or the other, and @compiler-errors chose the normalized version (which is what I'd prefer, thanks, otherwise -Znormalize-docs does nothing). @bors r+ rollup |
… r=jyn514 Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty` Self-explanatory Fixes rust-lang#102828
Rollup of 8 pull requests Successful merges: - rust-lang#101118 (fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD) - rust-lang#102072 (Add `ptr::Alignment` type) - rust-lang#102799 (rustdoc: remove hover gap in file picker) - rust-lang#102820 (Show let-else suggestion on stable.) - rust-lang#102829 (rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`) - rust-lang#102831 (Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`) - rust-lang#102834 (Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc) - rust-lang#102838 (remove cfg(bootstrap) from Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang#101118 (fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD) - rust-lang#102072 (Add `ptr::Alignment` type) - rust-lang#102799 (rustdoc: remove hover gap in file picker) - rust-lang#102820 (Show let-else suggestion on stable.) - rust-lang#102829 (rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`) - rust-lang#102831 (Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`) - rust-lang#102834 (Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc) - rust-lang#102838 (remove cfg(bootstrap) from Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Self-explanatory
Fixes #102828