From bc51f8783cdbee5a1ed121f017ec7360d9be9124 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Fri, 11 Nov 2022 14:31:07 +0000 Subject: [PATCH] rename to `string_deref_patterns` --- compiler/rustc_feature/src/active.rs | 4 ++-- compiler/rustc_hir_typeck/src/pat.rs | 2 +- compiler/rustc_mir_build/src/build/matches/test.rs | 4 ++-- compiler/rustc_span/src/symbol.rs | 2 +- src/test/mir-opt/deref-patterns/string.rs | 2 +- src/test/ui/deref-patterns/basic.rs | 2 +- src/test/ui/deref-patterns/default-infer.rs | 2 +- src/test/ui/deref-patterns/gate.rs | 2 +- src/test/ui/deref-patterns/refs.rs | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 3a1db1193b3dd..ae49a76a08783 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -376,8 +376,6 @@ declare_features! ( (active, deprecated_safe, "1.61.0", Some(94978), None), /// Allows having using `suggestion` in the `#[deprecated]` attribute. (active, deprecated_suggestion, "1.61.0", Some(94785), None), - /// Allows patterns to dereference values to match them. - (active, deref_patterns, "1.64.0", Some(87121), None), /// Tells rustdoc to automatically generate `#[doc(cfg(...))]`. (active, doc_auto_cfg, "1.58.0", Some(43781), None), /// Allows `#[doc(cfg(...))]`. @@ -508,6 +506,8 @@ declare_features! ( (active, stmt_expr_attributes, "1.6.0", Some(15701), None), /// Allows lints part of the strict provenance effort. (active, strict_provenance, "1.61.0", Some(95228), None), + /// Allows string patterns to dereference values to match them. + (active, string_deref_patterns, "CURRENT_RUSTC_VERSION", Some(87121), None), /// Allows the use of `#[target_feature]` on safe functions. (active, target_feature_11, "1.45.0", Some(69098), None), /// Allows using `#[thread_local]` on `static` items. diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index b20949bcbd54a..4e3194501dc35 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -401,7 +401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - if self.tcx.features().deref_patterns && let hir::ExprKind::Lit(Spanned { node: ast::LitKind::Str(..), .. }) = lt.kind { + if self.tcx.features().string_deref_patterns && let hir::ExprKind::Lit(Spanned { node: ast::LitKind::Str(..), .. }) = lt.kind { let tcx = self.tcx; let expected = self.resolve_vars_if_possible(expected); pat_ty = match expected.kind() { diff --git a/compiler/rustc_mir_build/src/build/matches/test.rs b/compiler/rustc_mir_build/src/build/matches/test.rs index e6c01b72b1bfe..af0d7879c576a 100644 --- a/compiler/rustc_mir_build/src/build/matches/test.rs +++ b/compiler/rustc_mir_build/src/build/matches/test.rs @@ -242,8 +242,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { TestKind::Eq { value, ty } => { let tcx = self.tcx; if let ty::Adt(def, _) = ty.kind() && Some(def.did()) == tcx.lang_items().string() { - if !tcx.features().deref_patterns { - bug!("matching on `String` went through without enabling deref_patterns"); + if !tcx.features().string_deref_patterns { + bug!("matching on `String` went through without enabling string_deref_patterns"); } let re_erased = tcx.lifetimes.re_erased; let ref_string = self.temp(tcx.mk_imm_ref(re_erased, ty), test.span); diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index a06e613b82f46..ec393ce5030fd 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -597,7 +597,6 @@ symbols! { deref, deref_method, deref_mut, - deref_patterns, deref_target, derive, derive_const, @@ -1406,6 +1405,7 @@ symbols! { str_trim_end, str_trim_start, strict_provenance, + string_deref_patterns, stringify, struct_field_attributes, struct_inherit, diff --git a/src/test/mir-opt/deref-patterns/string.rs b/src/test/mir-opt/deref-patterns/string.rs index 2557f75b267a6..3a99c44aa0e18 100644 --- a/src/test/mir-opt/deref-patterns/string.rs +++ b/src/test/mir-opt/deref-patterns/string.rs @@ -1,6 +1,6 @@ // compile-flags: -Z mir-opt-level=0 -C panic=abort -#![feature(deref_patterns)] +#![feature(string_deref_patterns)] #![crate_type = "lib"] // EMIT_MIR string.foo.PreCodegen.after.mir diff --git a/src/test/ui/deref-patterns/basic.rs b/src/test/ui/deref-patterns/basic.rs index e03f2455954f8..249716040a177 100644 --- a/src/test/ui/deref-patterns/basic.rs +++ b/src/test/ui/deref-patterns/basic.rs @@ -1,6 +1,6 @@ // run-pass // check-run-results -#![feature(deref_patterns)] +#![feature(string_deref_patterns)] fn main() { test(Some(String::from("42"))); diff --git a/src/test/ui/deref-patterns/default-infer.rs b/src/test/ui/deref-patterns/default-infer.rs index b7155b7efffee..050b847305b16 100644 --- a/src/test/ui/deref-patterns/default-infer.rs +++ b/src/test/ui/deref-patterns/default-infer.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(deref_patterns)] +#![feature(string_deref_patterns)] fn main() { match <_ as Default>::default() { diff --git a/src/test/ui/deref-patterns/gate.rs b/src/test/ui/deref-patterns/gate.rs index 90d0448e94a5f..ff50e30dea8c8 100644 --- a/src/test/ui/deref-patterns/gate.rs +++ b/src/test/ui/deref-patterns/gate.rs @@ -1,4 +1,4 @@ -// gate-test-deref_patterns +// gate-test-string_deref_patterns fn main() { match String::new() { "" | _ => {} diff --git a/src/test/ui/deref-patterns/refs.rs b/src/test/ui/deref-patterns/refs.rs index 6dac46c05fd08..97e260d2752bb 100644 --- a/src/test/ui/deref-patterns/refs.rs +++ b/src/test/ui/deref-patterns/refs.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(deref_patterns)] +#![feature(string_deref_patterns)] fn foo(s: &String) -> i32 { match *s {