Skip to content

Report infer ty errors during hir ty lowering #142420

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 12, 2025

This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent.

r? @compiler-errors

@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 Jun 12, 2025
Comment on lines +4538 to +4566
impl ForeignItemKind<'_> {
pub fn descr(&self) -> &'static str {
match self {
ForeignItemKind::Fn(..) => "function",
ForeignItemKind::Static(..) => "static variable",
ForeignItemKind::Type => "type",
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably just use tcx.def_descr, but it causes a lot of diffs across the test suite because it calls associated functions associated functions or methods respectively

Comment on lines -8 to +11
//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for functions
//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for opaque types
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for opaque types
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for opaque types
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for opaque types
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit dumb, but I could special case Synthetic things separately handle opaque types to also check if they are part of an afit

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from 17b63c8 to 993b819 Compare June 12, 2025 15:41
Comment on lines +321 to 325
impl Drop for ItemCtxt<'_> {
fn drop(&mut self) {
_ = self.check_tainted_by_errors();
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only type_of invokes check_tainted_by_errors as it's the only ItemCtxt using query that actually has a way to report errors

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from 993b819 to b4492d2 Compare June 12, 2025 15:43
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 13, 2025

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

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from b4492d2 to e7c1ba8 Compare June 13, 2025 08:17
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2025

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 13, 2025

based on #142449 as the crashes tests were "fixed" by this PR only in as much as that they stopped ICEing, but the error message was referring to _ constants that weren't there at all

This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent.
@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from e7c1ba8 to fb8cfca Compare June 16, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants