stabilize if_let_rescope
This commit is contained in:
parent
be01dabfef
commit
6d569f769c
20 changed files with 30 additions and 84 deletions
|
@ -224,6 +224,8 @@ declare_features! (
|
|||
(accepted, i128_type, "1.26.0", Some(35118)),
|
||||
/// Allows the use of `if let` expressions.
|
||||
(accepted, if_let, "1.0.0", None),
|
||||
/// Rescoping temporaries in `if let` to align with Rust 2024.
|
||||
(accepted, if_let_rescope, "CURRENT_RUSTC_VERSION", Some(124085)),
|
||||
/// Allows top level or-patterns (`p | q`) in `if let` and `while let`.
|
||||
(accepted, if_while_or_patterns, "1.33.0", Some(48215)),
|
||||
/// Allows lifetime elision in `impl` headers. For example:
|
||||
|
|
|
@ -482,8 +482,6 @@ declare_features! (
|
|||
(unstable, half_open_range_patterns_in_slices, "1.66.0", Some(67264)),
|
||||
/// Allows `if let` guard in match arms.
|
||||
(unstable, if_let_guard, "1.47.0", Some(51114)),
|
||||
/// Rescoping temporaries in `if let` to align with Rust 2024.
|
||||
(unstable, if_let_rescope, "1.83.0", Some(124085)),
|
||||
/// Allows `impl Trait` to be used inside associated types (RFC 2515).
|
||||
(unstable, impl_trait_in_assoc_type, "1.70.0", Some(63063)),
|
||||
/// Allows `impl Trait` as output type in `Fn` traits in return position of functions.
|
||||
|
|
|
@ -466,8 +466,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
|||
|
||||
hir::ExprKind::If(cond, then, Some(otherwise)) => {
|
||||
let expr_cx = visitor.cx;
|
||||
let data = if expr.span.at_least_rust_2024() && visitor.tcx.features().if_let_rescope()
|
||||
{
|
||||
let data = if expr.span.at_least_rust_2024() {
|
||||
ScopeData::IfThenRescope
|
||||
} else {
|
||||
ScopeData::IfThen
|
||||
|
@ -482,8 +481,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
|||
|
||||
hir::ExprKind::If(cond, then, None) => {
|
||||
let expr_cx = visitor.cx;
|
||||
let data = if expr.span.at_least_rust_2024() && visitor.tcx.features().if_let_rescope()
|
||||
{
|
||||
let data = if expr.span.at_least_rust_2024() {
|
||||
ScopeData::IfThenRescope
|
||||
} else {
|
||||
ScopeData::IfThen
|
||||
|
|
|
@ -24,7 +24,6 @@ declare_lint! {
|
|||
/// ### Example
|
||||
///
|
||||
/// ```rust,edition2021
|
||||
/// #![feature(if_let_rescope)]
|
||||
/// #![warn(if_let_rescope)]
|
||||
/// #![allow(unused_variables)]
|
||||
///
|
||||
|
@ -243,7 +242,7 @@ impl_lint_pass!(
|
|||
|
||||
impl<'tcx> LateLintPass<'tcx> for IfLetRescope {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
|
||||
if expr.span.edition().at_least_rust_2024() || !cx.tcx.features().if_let_rescope() {
|
||||
if expr.span.edition().at_least_rust_2024() {
|
||||
return;
|
||||
}
|
||||
if let (Level::Allow, _) = cx.tcx.lint_level_at_node(IF_LET_RESCOPE, expr.hir_id) {
|
||||
|
|
|
@ -777,7 +777,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
if_then_scope: region::Scope {
|
||||
id: then.hir_id.local_id,
|
||||
data: {
|
||||
if expr.span.at_least_rust_2024() && tcx.features().if_let_rescope() {
|
||||
if expr.span.at_least_rust_2024() {
|
||||
region::ScopeData::IfThenRescope
|
||||
} else {
|
||||
region::ScopeData::IfThen
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue