-
Notifications
You must be signed in to change notification settings - Fork 13.6k
loop match: error on #[const_continue]
outside #[loop_match]
#143360
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
loop match: error on #[const_continue]
outside #[loop_match]
#143360
Conversation
rustbot has assigned @WaffleLapkin. Use |
tests/ui/loop-match/invalid.rs
Outdated
#[const_continue] | ||
break State::A; | ||
//~^ ERROR unlabeled `break` inside of a labeled block | ||
//~| ERROR mismatched types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is mismatched types coming from?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the break
is seen as a break from the loop with a value, and it's the final expression, so that value is returned, but the function's type says it'll return unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix the error so that the only errors here are the interesting ones? (e.g. by doing _ = loop {...};
) or do you think this test is better with the type error?
771373e
to
7d0caef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out there was a better way to do this at a much earlier stage. The logic now also properly handles shadowing labels (where the outer one is part of a loop_match
but the inner one is not).
@rustbot ready
@WaffleLapkin is anything else needed here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for making you wait so long, I was on vacation ^^'
This looks mostly good, just a few nitpicks.
tests/ui/loop-match/invalid.rs
Outdated
#[const_continue] | ||
break State::A; | ||
//~^ ERROR unlabeled `break` inside of a labeled block | ||
//~| ERROR mismatched types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix the error so that the only errors here are the interesting ones? (e.g. by doing _ = loop {...};
) or do you think this test is better with the type error?
7d0caef
to
3686dcc
Compare
This comment was marked as outdated.
This comment was marked as outdated.
3686dcc
to
7a2ab95
Compare
@rustbot ready |
@bors r+ rollup |
☔ The latest upstream changes (presumably #144740) made this pull request unmergeable. Please resolve the merge conflicts. |
7a2ab95
to
040f71e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with green CI
@bors r=WaffleLapkin |
…loop-match, r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue rust-lang#132306 fixes rust-lang#143119 fixes rust-lang#143165 Fixes several ICEs because a panic was reachable. `@rustbot` label +F-loop_match
Rollup of 10 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144738 (Remove the omit_gdb_pretty_printer_section attribute) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") r? `@ghost` `@rustbot` modify labels: rollup
…loop-match, r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue rust-lang#132306 fixes rust-lang#143119 fixes rust-lang#143165 Fixes several ICEs because a panic was reachable. ``@rustbot`` label +F-loop_match
Rollup of 11 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144478 (Improve formatting of doc code blocks) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) r? `@ghost` `@rustbot` modify labels: rollup
…loop-match, r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue rust-lang#132306 fixes rust-lang#143119 fixes rust-lang#143165 Fixes several ICEs because a panic was reachable. ```@rustbot``` label +F-loop_match
…loop-match, r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue rust-lang#132306 fixes rust-lang#143119 fixes rust-lang#143165 Fixes several ICEs because a panic was reachable. ````@rustbot```` label +F-loop_match
Rollup of 12 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #144478 (Improve formatting of doc code blocks) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) r? `@ghost` `@rustbot` modify labels: rollup
…loop-match, r=WaffleLapkin loop match: error on `#[const_continue]` outside `#[loop_match]` tracking issue rust-lang#132306 fixes rust-lang#143119 fixes rust-lang#143165 Fixes several ICEs because a panic was reachable. `````@rustbot````` label +F-loop_match
Rollup of 18 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143771 (Constify some more `Result` functions) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144185 (Document guarantees of poisoning) - #144395 (update fortanix tests) - #144478 (Improve formatting of doc code blocks) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) Failed merges: - #144805 (compiletest: Preliminary cleanup of `ProcRes` printing/unwinding) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 17 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143771 (Constify some more `Result` functions) - #144185 (Document guarantees of poisoning) - #144395 (update fortanix tests) - #144478 (Improve formatting of doc code blocks) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") - #144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - #144786 (Cleanup the definition of `group_type`) - #144796 (Add my previous commit name to .mailmap) - #144797 (Update safety comment for new_unchecked in niche_types) - #144803 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 17 pull requests Successful merges: - rust-lang/rust#132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - rust-lang/rust#143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - rust-lang/rust#143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - rust-lang/rust#143771 (Constify some more `Result` functions) - rust-lang/rust#144185 (Document guarantees of poisoning) - rust-lang/rust#144395 (update fortanix tests) - rust-lang/rust#144478 (Improve formatting of doc code blocks) - rust-lang/rust#144614 (Fortify RemoveUnneededDrops test.) - rust-lang/rust#144703 ([test][AIX] ignore extern_weak linkage test) - rust-lang/rust#144747 (compiletest: Improve diagnostics for line annotation mismatches 2) - rust-lang/rust#144756 (detect infinite recursion with tail calls in ctfe) - rust-lang/rust#144766 (Add human readable name "Cygwin") - rust-lang/rust#144782 (Properly pass path to staged `rustc` to `compiletest` self-tests) - rust-lang/rust#144786 (Cleanup the definition of `group_type`) - rust-lang/rust#144796 (Add my previous commit name to .mailmap) - rust-lang/rust#144797 (Update safety comment for new_unchecked in niche_types) - rust-lang/rust#144803 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
tracking issue #132306
fixes #143119
fixes #143165
Fixes several ICEs because a panic was reachable.
@rustbot label +F-loop_match