Repository navigation
Fix as str suggestion in subpattern - #164997
Open
yashaggarwal85d wants to merge 2 commits into
Open
yashaggarwal85d wants to merge 2 commits into
yashaggarwal85d wants to merge 2 commits into
Conversation
Collaborator
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
|
Reopening after a conversation with the author |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
Author
|
Hi @TaKO8Ki, please have a look at the PR, Lemme know if any change is required |
Member
|
Please don’t ping reviewers like this. Many people working on Rust do so in their free time, and their time deserves respect. As rustbot notes, the expected review window is two weeks. If there’s no response after that, feel free to request a reassignment. |
TaKO8Ki
approved these changes
Nov 13, 2026
Member
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Nov 13, 2026
…ion-in-subpattern, r=TaKO8Ki
Fix as str suggestion in subpattern
The `.as_str()` help for a string literal pattern against a `String` was also shown when the literal sits inside a bigger pattern, e.g. `matches!(t, Enum::Value("str"))`, where it suggested `t.as_str()`. Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually the `String`.
Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes rust-lang#164973
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 13, 2026
…uwer Rollup of 14 pull requests Successful merges: - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present) - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`) - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow) - #165568 (rustdoc: Suggest corrections for reference label typos) - #165924 (rustc_codegen_gcc subtree update 2026-11-13) - #165927 (Remove `const_struct` from `rustc_codegen_ssa`) - #165928 (Replace most uses of `type_array` with `type_byte_array` in `rustc_codegen_llvm`) - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`) - #164997 (Fix as str suggestion in subpattern) - #165868 (Small changes to dyn compatibility) - #165879 (Add `#[rustc_test_entrypoint_marker]` back !) - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block) - #165914 (Use `trim_prefix` in bootstrap) - #165919 (tests: accept better behavior on underaligned accesses)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2026
…ion-in-subpattern, r=TaKO8Ki
Fix as str suggestion in subpattern
The `.as_str()` help for a string literal pattern against a `String` was also shown when the literal sits inside a bigger pattern, e.g. `matches!(t, Enum::Value("str"))`, where it suggested `t.as_str()`. Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually the `String`.
Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes rust-lang#164973
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 13, 2026
Rollup of 17 pull requests Successful merges: - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present) - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`) - #164808 (asm const ptr: move name generation to asm-specific logic) - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow) - #165475 (Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable) - #165568 (rustdoc: Suggest corrections for reference label typos) - #165924 (rustc_codegen_gcc subtree update 2026-11-13) - #165927 (Remove `const_struct` from `rustc_codegen_ssa`) - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`) - #164997 (Fix as str suggestion in subpattern) - #165825 (make `Complex<x87_f80>` ABI-compatible with C) - #165868 (Small changes to dyn compatibility) - #165879 (Add `#[rustc_test_entrypoint_marker]` back !) - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block) - #165914 (Use `trim_prefix` in bootstrap) - #165919 (tests: accept better behavior on underaligned accesses) - #165936 (Enhance documentation for try_clone File implementation)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 14, 2026
…ion-in-subpattern, r=TaKO8Ki
Fix as str suggestion in subpattern
The `.as_str()` help for a string literal pattern against a `String` was also shown when the literal sits inside a bigger pattern, e.g. `matches!(t, Enum::Value("str"))`, where it suggested `t.as_str()`. Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually the `String`.
Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes rust-lang#164973
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 14, 2026
Rollup of 16 pull requests Successful merges: - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present) - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`) - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow) - #165475 (Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable) - #165568 (rustdoc: Suggest corrections for reference label typos) - #165924 (rustc_codegen_gcc subtree update 2026-11-13) - #165927 (Remove `const_struct` from `rustc_codegen_ssa`) - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`) - #164997 (Fix as str suggestion in subpattern) - #165825 (make `Complex<x87_f80>` ABI-compatible with C) - #165868 (Small changes to dyn compatibility) - #165879 (Add `#[rustc_test_entrypoint_marker]` back !) - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block) - #165914 (Use `trim_prefix` in bootstrap) - #165919 (tests: accept better behavior on underaligned accesses) - #165936 (Enhance documentation for try_clone File implementation)
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Nov 14, 2026
…ion-in-subpattern, r=TaKO8Ki
Fix as str suggestion in subpattern
The `.as_str()` help for a string literal pattern against a `String` was also shown when the literal sits inside a bigger pattern, e.g. `matches!(t, Enum::Value("str"))`, where it suggested `t.as_str()`. Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually the `String`.
Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes rust-lang#164973
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Nov 14, 2026
…ion-in-subpattern, r=TaKO8Ki
Fix as str suggestion in subpattern
The `.as_str()` help for a string literal pattern against a `String` was also shown when the literal sits inside a bigger pattern, e.g. `matches!(t, Enum::Value("str"))`, where it suggested `t.as_str()`. Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually the `String`.
Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes rust-lang#164973
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
.as_str()help for a string literal pattern against aStringwas also shown when the literal sits inside a bigger pattern, e.g.matches!(t, Enum::Value("str")), where it suggestedt.as_str(). Now it's only suggested when the literal is the whole pattern, so the scrutinee is actually theString.Added a ui test with the case from the issue plus a nested match and tuple pattern.
Fixes #164973