-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix generics where bounds order #89098
Conversation
f1aecc0
to
b226d17
Compare
I implemented @Mark-Simulacrum's suggestion. |
@GuillaumeGomez This bug seems to be cross-crate-export related, so you'll need to re-export a type implementing a trait to reproduce this. I came up with a repro that should work as a // In lib1.rs
pub struct Struct<A, B, C>(A, B, C);
// NOTE: would it make sense to define `struct B`, `struct A`, `struct C`, in that order,
// to make sure the symbol indices are in a random order?
pub trait Trait<Other> {}
impl<A, B, C> Trait<Struct<A, B, C>> for Struct<A, B, C>
where
A: Trait<A>,
B: Trait<B>,
C: Trait<C>,
{
} // In lib2.rs
// aux-build:lib1.rs
pub use lib1::*;
// Add `@has` checks here, either for `Struct`'s page, or for `Trait`'s page |
Also, could you update the PR description to reflect that this now uses |
@camelid: Just realized that we can't check that in |
Ah, that's unfortunate. I think it might not have been possible anyway because I don't know if there's a way to check ordering of elements with |
Actually, I don't think it is. You can check the implementors section of However, there's still the challenge of checking the order of the HTML elements in the |
We could add this check with a better XPath support:
Unfortunately, it's not supported: Traceback (most recent call last):
File "/usr/lib/python3.9/xml/etree/ElementPath.py", line 354, in iterfind
selector = _cache[cache_key]
KeyError: ('.//*[@id="implementors-list"]//span[@class="where fmt-newline"]/text()[1]',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 490, in <module>
check(sys.argv[1], get_commands(sys.argv[2]))
File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 482, in check
check_command(c, cache)
File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 439, in check_command
ret = check_tree_text(cache.get_tree(c.args[0]), pat, c.args[2], regexp)
File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 370, in check_tree_text
for e in tree.findall(path):
File "/usr/lib/python3.9/xml/etree/ElementPath.py", line 395, in findall
return list(iterfind(elem, path, namespaces))
File "/usr/lib/python3.9/xml/etree/ElementPath.py", line 368, in iterfind
selector.append(ops[token[0]](next, token))
KeyError: '()' |
The python module we use has been deprecated a while ago. We should switch to another parser like What do you think @jyn514 ? If we agree on that, let's approve this one, open an issue to add a test whenever it's possible and I'll send a PR to switch the HTML parser we use. |
@bors r+ rollup |
📌 Commit b226d17 has been approved by |
…r=camelid Fix generics where bounds order Fixes rust-lang#88809. Like said on the above issue, the issue is that we were expecting `Symbol` comparisons to be string-based but they are integer-based (because `Symbol` is an integer), messing up the bounds order. To fix it, I simply stored into a `FxIndexMap` instead. r? `@jyn514`
Rollup of 13 pull requests Successful merges: - rust-lang#87428 (Fix union keyword highlighting in rustdoc HTML sources) - rust-lang#88412 (Remove ignore-tidy-undocumented-unsafe from core::slice::sort) - rust-lang#89098 (Fix generics where bounds order) - rust-lang#89232 (Improve help for recursion limit errors) - rust-lang#89294 (:arrow_up: rust-analyzer) - rust-lang#89297 (Remove Never variant from clean::Type enum) - rust-lang#89311 (Add unit assignment to MIR for `asm!()`) - rust-lang#89313 (PassWrapper: handle function rename from upstream D36850) - rust-lang#89315 (Clarify that `CString::from_vec_unchecked` appends 0 byte.) - rust-lang#89335 (Optimize is_sorted for Range and RangeInclusive) - rust-lang#89366 (rustdoc: Remove lazy_static dependency) - rust-lang#89377 (Update cargo) - rust-lang#89378 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #88809.
Like said on the above issue, the issue is that we were expecting
Symbol
comparisons to be string-based but they are integer-based (becauseSymbol
is an integer), messing up the bounds order. To fix it, I simply stored into aFxIndexMap
instead.r? @jyn514