-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix span when suggesting to add an associated type bound #87348
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
(rust-highfive has picked a reviewer for you, use r? to override) |
Please add tests for the two issues you described |
Should I add tests for them even if they currently produce the wrong output? Or should I make them not suggest anything and test that? |
Either is fine. We often test wrong output and add comments to the test stating that this is wrong and should be fixed. |
|
Digging around I think I've found a similar issue with generic bounds playground. The existing logic for them is a bit smarter than the one for opaque types, however it still fails when there are multiple generics. I'm tempted to include a fix for that issue in this PR and merge the logic. |
Whatever you prefer. We can also merge this right now and you can build a new PR on top of it |
@bors r+ Thanks! |
📌 Commit d1bc941 has been approved by |
Fix span when suggesting to add an associated type bound Fixes rust-lang#87261 Note that this fix is not perfect, it ~~will still give incorrect~~ won't give suggestions in some situations: - If the associated type is defined on a supertrait of those contained in the opaque type, it will fallback to the previous behaviour, e.g. if `AssocTy` is defined on the trait `Foo`, `Bar` has `Foo` as supertrait and the opaque type is a `impl Bar + Baz`. - If the the associated type is defined on a generic trait and the opaque type includes two versions of that generic trait, e.g. the opaque type is `impl Foo<A> + Foo<B>`
…arth Rollup of 9 pull requests Successful merges: - rust-lang#87348 (Fix span when suggesting to add an associated type bound) - rust-lang#87359 (Remove detection of rustup and cargo in 'missing extern crate' diagnostics) - rust-lang#87370 (Add support for powerpc-unknown-freebsd) - rust-lang#87389 (Rename `known_attrs` to `expanded_inert_attrs` and move to rustc_expand) - rust-lang#87395 (Clear up std::env::set_var panic section.) - rust-lang#87403 (Implement `AssignToDroppingUnionField` in THIR unsafeck) - rust-lang#87410 (Mark `format_args_nl` as `#[doc(hidden)]`) - rust-lang#87419 (IEEE 754 is not an RFC) - rust-lang#87422 (DOC: remove unnecessary feature crate attribute from example code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #87261
Note that this fix is not perfect, it
will still give incorrectwon't give suggestions in some situations:AssocTy
is defined on the traitFoo
,Bar
hasFoo
as supertrait and the opaque type is aimpl Bar + Baz
.impl Foo<A> + Foo<B>