Add feature gate

This commit is contained in:
Deadbeef 2022-07-05 07:42:19 +00:00
parent b2cb42d6a7
commit 0537d301c5
8 changed files with 69 additions and 45 deletions

View file

@ -376,6 +376,8 @@ 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(...))]`.

View file

@ -401,7 +401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
if let hir::ExprKind::Lit(Spanned { node: ast::LitKind::Str(..), .. }) = lt.kind {
if self.tcx.features().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

@ -597,6 +597,7 @@ symbols! {
deref,
deref_method,
deref_mut,
deref_patterns,
deref_target,
derive,
derive_const,