1
Fork 0

rename to string_deref_patterns

This commit is contained in:
Deadbeef 2022-11-11 14:31:07 +00:00
parent 64a17a09a8
commit bc51f8783c
9 changed files with 11 additions and 11 deletions

View file

@ -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.

View file

@ -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() {

View file

@ -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);

View file

@ -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,

View file

@ -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

View file

@ -1,6 +1,6 @@
// run-pass
// check-run-results
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]
fn main() {
test(Some(String::from("42")));

View file

@ -1,5 +1,5 @@
// check-pass
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]
fn main() {
match <_ as Default>::default() {

View file

@ -1,4 +1,4 @@
// gate-test-deref_patterns
// gate-test-string_deref_patterns
fn main() {
match String::new() {
"" | _ => {}

View file

@ -1,5 +1,5 @@
// check-pass
#![feature(deref_patterns)]
#![feature(string_deref_patterns)]
fn foo(s: &String) -> i32 {
match *s {