Skip to content
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

Point at cause of expectation of break value when possible #116071

Merged
merged 1 commit into from Sep 23, 2023

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Sep 22, 2023

When encountering a type error within the value of a break statement, climb the HIR tree to identify if the expectation comes from an assignment or a return type (if the loop is the tail expression of a fn).

Fix #115905.

@rustbot
Copy link
Collaborator

rustbot commented Sep 22, 2023

r? @petrochenkov

(rustbot has picked a reviewer for you, use r? to override)

@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 Sep 22, 2023
compiler/rustc_hir_typeck/src/demand.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member

pls fix typo, r=me

@estebank
Copy link
Contributor Author

r? @compiler-errors

I added another mechanism to check for when the typeck inference comes from other break statements.

@estebank estebank force-pushed the issue-115905 branch 2 times, most recently from bae2b8f to d3dea30 Compare September 22, 2023 22:28
@estebank
Copy link
Contributor Author

Actually, I'll just open another PR.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Sep 22, 2023

📌 Commit d3dea30 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 Sep 22, 2023
@bors
Copy link
Contributor

bors commented Sep 23, 2023

⌛ Testing commit d3dea30 with merge 136d74f...

@bors
Copy link
Contributor

bors commented Sep 23, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 136d74f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 23, 2023
@bors bors merged commit 136d74f into rust-lang:master Sep 23, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 23, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (136d74f): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Binary size

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

Bootstrap: 635.361s -> 633.587s (-0.28%)
Artifact size: 317.70 MiB -> 317.57 MiB (-0.04%)

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 26, 2023
…errors

Point at more causes of expectation of break value when possible

Follow up to rust-lang#116071.

r? `@compiler-errors`

Disregard the first commit, which is in the other PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Unhelpful message when not using value from a loop break
6 participants