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 +4556
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

Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a FIXME to the match on item kind in report_placeholder_type_error.

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
@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

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from e7c1ba8 to fb8cfca Compare June 16, 2025 07:36
@bors
Copy link
Collaborator

bors commented Jun 18, 2025

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

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from fb8cfca to 3db719c Compare June 20, 2025 06:32
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 20, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 20, 2025
bors added a commit that referenced this pull request Jun 20, 2025
Report infer ty errors during hir ty lowering

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`
@bors
Copy link
Collaborator

bors commented Jun 20, 2025

⌛ Trying commit 3db719c with merge 3dd01ac...

@bors
Copy link
Collaborator

bors commented Jun 20, 2025

☀️ Try build successful - checks-actions
Build commit: 3dd01ac (3dd01ac6b7d9291060432a92a28ec52247d9481d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3dd01ac): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 1.7%, secondary 2.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.7% [1.1%, 2.3%] 12
Regressions ❌
(secondary)
2.7% [1.2%, 6.5%] 19
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.9% [-5.9%, -5.9%] 1
All ❌✅ (primary) 1.7% [1.1%, 2.3%] 12

Cycles

Results (secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.4% [2.9%, 4.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.0% [-8.8%, -2.4%] 4
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 692.705s -> 693.181s (0.07%)
Artifact size: 372.00 MiB -> 372.06 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 20, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 20, 2025

perf is noise in ctfe

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch from 3db719c to f329df3 Compare June 25, 2025 16:36
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me pls squash

Comment on lines +4538 to +4556
impl ForeignItemKind<'_> {
pub fn descr(&self) -> &'static str {
match self {
ForeignItemKind::Fn(..) => "function",
ForeignItemKind::Static(..) => "static variable",
ForeignItemKind::Type => "type",
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a FIXME to the match on item kind in report_placeholder_type_error.

@oli-obk oli-obk force-pushed the infer-ty-coalescing branch 2 times, most recently from e21b47e to 110cf7e Compare June 25, 2025 17:32
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 25, 2025

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

📌 Commit 110cf7e 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 Jun 25, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 26, 2025

@bors rollup

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 26, 2025
…piler-errors

Report infer ty errors during hir ty lowering

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`
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jun 26, 2025
…piler-errors

Report infer ty errors during hir ty lowering

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``
@compiler-errors
Copy link
Member

@bors r-

merge conflict

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 26, 2025
@bors
Copy link
Collaborator

bors commented Jun 26, 2025

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

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 110cf7e to c51f05b Compare June 27, 2025 07:51
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 27, 2025

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

📌 Commit c51f05b 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 27, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 27, 2025
…piler-errors

Report infer ty errors during hir ty lowering

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`
bors added a commit that referenced this pull request Jun 27, 2025
Rollup of 6 pull requests

Successful merges:

 - #142270 (Rustdoc js: even more typechecking improvements)
 - #142420 (Report infer ty errors during hir ty lowering)
 - #142818 (Port `#[used]` to new attribute parsing infrastructure)
 - #143020 (codegen_fn_attrs: make comment more precise)
 - #143036 (Remove support for `dyn*` from the compiler)
 - #143060 (Only args in main diag are saved and restored without removing the newly added ones)

r? `@ghost`
`@rustbot` modify labels: rollup
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 27, 2025
…piler-errors

Report infer ty errors during hir ty lowering

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``
bors added a commit that referenced this pull request Jun 27, 2025
Rollup of 10 pull requests

Successful merges:

 - #142270 (Rustdoc js: even more typechecking improvements)
 - #142420 (Report infer ty errors during hir ty lowering)
 - #142671 (add #![rustc_no_implicit_bounds])
 - #142721 (Add tracing to `InterpCx::layout_of()` )
 - #142818 (Port `#[used]` to new attribute parsing infrastructure)
 - #143020 (codegen_fn_attrs: make comment more precise)
 - #143051 (Add tracing to `validate_operand`)
 - #143060 (Only args in main diag are saved and restored without removing the newly added ones)
 - #143065 (Improve recovery when users write `where:`)
 - #143084 (const-eval: error when initializing a static writes to that static)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

6 participants