Skip to content

Use more detailed spans in dyn compat errors within bodies #141580

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented May 26, 2025

Within bodies we can employ the full dyn compat check query instead of only doing the minimal hir ty lowerer one. This in turn gives us better spans and also silences many follow-up duplicate or bogus errors.

alternative to #141439, tho I think I could turn the delayed bug from that one into a bug now instead of having an error code path.

r? @compiler-errors
cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 26, 2025
@rustbot

This comment was marked as duplicate.

@oli-obk oli-obk force-pushed the early-dyn-catches-the-incompat branch from 6f120f9 to 8c0a364 Compare May 26, 2025 10:50
@compiler-errors
Copy link
Member

This isn't really an alternative to #141439 but instead just an additional cleanup, since my PR still catches cases where the dyn Trait coercion RHS is coming from outside the body, like here:

fn foo(_: &dyn NotDynSafe) {}

fn main() {
    foo(&1);
}

That would still need to be a delayed bug. Let me double check, tho.

@compiler-errors
Copy link
Member

Yeah, this is a nice improvement for more cases but it definitely doesn't supersede #141439, so I'm gonna keep that one open too lol

@bors
Copy link
Collaborator

bors commented May 27, 2025

☔ The latest upstream changes (presumably #141605) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the early-dyn-catches-the-incompat branch from 8c0a364 to 3fff727 Compare May 27, 2025 08:18
@oli-obk
Copy link
Contributor Author

oli-obk commented May 27, 2025

rebased

@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 27, 2025

📌 Commit 3fff727 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 27, 2025
bors added a commit that referenced this pull request May 27, 2025
…rors

Rollup of 17 pull requests

Successful merges:

 - #140591 (Fix malformed suggestion for E0061 when method is a macro token in macro context)
 - #141536 (Improve `ambiguous_wide_pointer_comparisons` lint compare diagnostics)
 - #141552 (Pull out dedicated `cfg_version` syntax test from feature gate test)
 - #141556 (bootstrap: translate Windows paths in a way that works for both Cygwin and MSYS2)
 - #141563 (Remove out-of-date `noop_*` names.)
 - #141568 (dist: make sure llvm-project submodule is present)
 - #141580 (Use more detailed spans in dyn compat errors within bodies)
 - #141582 (intrinsics, ScalarInt: minor cleanup)
 - #141584 (Support `opaque_types_defined_by` for `SyntheticCoroutineBody`)
 - #141587 (Add missing edition directives for async-await tests)
 - #141594 (Add `generic_arg_infer` test)
 - #141596 (rustc book: fix erratic sentence by making it more simple)
 - #141599 (Remove an unnecessary use of `Box::into_inner`.)
 - #141611 (Update mdbook to 0.4.51)
 - #141616 (Remove spastorino from vacations)
 - #141623 (use custom types to clarify arguments to `emit_ptr_va_arg`)
 - #141635 (further dedup `WalkItemKind` for `mut_visit` and `visit`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fbac805 into rust-lang:master May 27, 2025
7 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 27, 2025
rust-timer added a commit that referenced this pull request May 27, 2025
Rollup merge of #141580 - oli-obk:early-dyn-catches-the-incompat, r=compiler-errors

Use more detailed spans in dyn compat errors within bodies

Within bodies we can employ the full dyn compat check query instead of only doing the minimal hir ty lowerer one. This in turn gives us better spans and also silences many follow-up duplicate or bogus errors.

alternative to #141439, tho I think I could turn the delayed bug from that one into a bug now instead of having an error code path.

r? `@compiler-errors`
cc `@fmease`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants