Skip to content

Commit

Permalink
rename to string_deref_patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Nov 18, 2022
1 parent 64a17a0 commit bc51f87
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(...))]`.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ symbols! {
deref,
deref_method,
deref_mut,
deref_patterns,
deref_target,
derive,
derive_const,
Expand Down Expand Up @@ -1406,6 +1405,7 @@ symbols! {
str_trim_end,
str_trim_start,
strict_provenance,
string_deref_patterns,
stringify,
struct_field_attributes,
struct_inherit,
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/deref-patterns/string.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/deref-patterns/basic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
// check-run-results
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]

fn main() {
test(Some(String::from("42")));
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/deref-patterns/default-infer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-pass
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]

fn main() {
match <_ as Default>::default() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/deref-patterns/gate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// gate-test-deref_patterns
// gate-test-string_deref_patterns
fn main() {
match String::new() {
"" | _ => {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/deref-patterns/refs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-pass
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]

fn foo(s: &String) -> i32 {
match *s {
Expand Down

0 comments on commit bc51f87

Please sign in to comment.