rustdoc: fix cross-crate impl Sized & impl ?Sized#114059
rustdoc: fix cross-crate impl Sized & impl ?Sized#114059bors merged 2 commits intorust-lang:masterfrom
impl Sized & impl ?Sized#114059Conversation
|
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
|
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
src/librustdoc/clean/mod.rs
Outdated
There was a problem hiding this comment.
This is just a refactor. I found the map followed by and_then, try-operator and if-let quite hairy.
src/librustdoc/clean/mod.rs
Outdated
There was a problem hiding this comment.
This further enlarges the preexisting bound cleaning duplication of clean_ty_generics and clean_middle_opaque_bounds. Let me know if this is okay for the time being, I plan on consolidating these implementations when I overhaul bound cleaning next to fix #113015.
This comment was marked as outdated.
This comment was marked as outdated.
7061f7a to
28d40f1
Compare
| if b.is_sized_bound(cx) { | ||
| has_sized = true; |
There was a problem hiding this comment.
Looking at this, I don't think it handles ~const Sized (TraitBoundModifier::MaybeConst) correctly.
I pretty sure it results in has_sized == false making us add + ?Sized to it.
Let me know if I should fix it here or in a follow-up (I guess there might be some more misuses of is_sized_bound).
Edit: impl ~const Sized is actually not allowed (at the moment?) since Sized is not a #[const_trait].
There was a problem hiding this comment.
That answers the question then. ;)
|
Thanks! @bors r+ rollup |
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#114032 (typos) - rust-lang#114059 (rustdoc: fix cross-crate `impl Sized` & `impl ?Sized`) - rust-lang#114088 (Bump syn dependency) - rust-lang#114091 (docs: fmt::Debug*: Fix comments for finish method.) - rust-lang#114109 (Docs: Fix URL for `rmatches`) - rust-lang#114117 (Restore region uniquification in the new solver 🎉 ) - rust-lang#114123 (Turns out opaque types can have hidden types registered during mir validation) r? `@ghost` `@rustbot` modify labels: rollup
Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single
Sizedbound (modulo outlives-bounds) and ones that are?Sizedwere incorrectly rendered. To give you a taste (before vs. after):Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error ambiguous
+in a type if we fed the rendered code back to it).Best reviewed commit by commit :)
@rustbot label A-cross-crate-reexports