diff options
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/async_closures.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/tail_expr_drop_order.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/types.rs | 10 | 
4 files changed, 17 insertions, 16 deletions
| diff --git a/compiler/rustc_lint/src/async_closures.rs b/compiler/rustc_lint/src/async_closures.rs index 33cc5738262..2a821b71103 100644 --- a/compiler/rustc_lint/src/async_closures.rs +++ b/compiler/rustc_lint/src/async_closures.rs @@ -12,6 +12,7 @@ declare_lint! { /// ### Example /// /// ```rust + /// #![feature(async_closure)] /// #![warn(closure_returning_async_block)] /// let c = |x: &str| async {}; /// ``` diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index e49b102cb39..a2ccb93347a 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -267,16 +267,16 @@ pub(crate) struct MacroExprFragment2024 { pub suggestion: Span, } -pub(crate) struct BuiltinTypeAliasBounds<'a, 'hir> { +pub(crate) struct BuiltinTypeAliasBounds<'hir> { pub in_where_clause: bool, pub label: Span, pub enable_feat_help: bool, pub suggestions: Vec<(Span, String)>, pub preds: &'hir [hir::WherePredicate<'hir>], - pub ty: Option<&'a hir::Ty<'hir>>, + pub ty: Option<&'hir hir::Ty<'hir>>, } -impl<'a> LintDiagnostic<'a, ()> for BuiltinTypeAliasBounds<'_, '_> { +impl<'a> LintDiagnostic<'a, ()> for BuiltinTypeAliasBounds<'_> { fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) { diag.primary_message(if self.in_where_clause { fluent::lint_builtin_type_alias_bounds_where_clause diff --git a/compiler/rustc_lint/src/tail_expr_drop_order.rs b/compiler/rustc_lint/src/tail_expr_drop_order.rs index f9ecc8c9806..91f3e2e3bb6 100644 --- a/compiler/rustc_lint/src/tail_expr_drop_order.rs +++ b/compiler/rustc_lint/src/tail_expr_drop_order.rs @@ -143,18 +143,18 @@ impl<'tcx> LateLintPass<'tcx> for TailExprDropOrder { } } -struct LintVisitor<'tcx, 'a> { +struct LintVisitor<'a, 'tcx> { cx: &'a LateContext<'tcx>, // We only record locals that have significant drops locals: Vec<Span>, } -struct LocalCollector<'tcx, 'a> { +struct LocalCollector<'a, 'tcx> { cx: &'a LateContext<'tcx>, locals: &'a mut Vec<Span>, } -impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> { +impl<'a, 'tcx> Visitor<'tcx> for LocalCollector<'a, 'tcx> { type Result = (); fn visit_pat(&mut self, pat: &'tcx Pat<'tcx>) { if let PatKind::Binding(_binding_mode, id, ident, pat) = pat.kind { @@ -171,7 +171,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> { } } -impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> { +impl<'a, 'tcx> Visitor<'tcx> for LintVisitor<'a, 'tcx> { fn visit_block(&mut self, block: &'tcx Block<'tcx>) { let mut locals = <_>::default(); swap(&mut locals, &mut self.locals); @@ -183,7 +183,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> { } } -impl<'tcx, 'a> LintVisitor<'tcx, 'a> { +impl<'a, 'tcx> LintVisitor<'a, 'tcx> { fn check_block_inner(&mut self, block: &Block<'tcx>) { if !block.span.at_least_rust_2024() { // We only lint for Edition 2024 onwards @@ -205,13 +205,13 @@ impl<'tcx, 'a> LintVisitor<'tcx, 'a> { } } -struct LintTailExpr<'tcx, 'a> { +struct LintTailExpr<'a, 'tcx> { cx: &'a LateContext<'tcx>, is_root_tail_expr: bool, locals: &'a [Span], } -impl<'tcx, 'a> LintTailExpr<'tcx, 'a> { +impl<'a, 'tcx> LintTailExpr<'a, 'tcx> { fn expr_eventually_point_into_local(mut expr: &Expr<'tcx>) -> bool { loop { match expr.kind { @@ -239,7 +239,7 @@ impl<'tcx, 'a> LintTailExpr<'tcx, 'a> { } } -impl<'tcx, 'a> Visitor<'tcx> for LintTailExpr<'tcx, 'a> { +impl<'a, 'tcx> Visitor<'tcx> for LintTailExpr<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { if self.is_root_tail_expr { self.is_root_tail_expr = false; diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index b5e501b92f0..900c496e033 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1713,13 +1713,13 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { hir_ty: &hir::Ty<'tcx>, ty: Ty<'tcx>, ) -> Vec<(Ty<'tcx>, Span)> { - struct FnPtrFinder<'parent, 'a, 'tcx> { - visitor: &'parent ImproperCTypesVisitor<'a, 'tcx>, + struct FnPtrFinder<'a, 'b, 'tcx> { + visitor: &'a ImproperCTypesVisitor<'b, 'tcx>, spans: Vec<Span>, tys: Vec<Ty<'tcx>>, } - impl<'parent, 'a, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'parent, 'a, 'tcx> { + impl<'a, 'b, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'a, 'b, 'tcx> { fn visit_ty(&mut self, ty: &'_ hir::Ty<'_>) { debug!(?ty); if let hir::TyKind::BareFn(hir::BareFnTy { abi, .. }) = ty.kind @@ -1732,7 +1732,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } - impl<'vis, 'a, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'vis, 'a, 'tcx> { + impl<'a, 'b, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'a, 'b, 'tcx> { type Result = ControlFlow<Ty<'tcx>>; fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result { @@ -1746,7 +1746,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } - let mut visitor = FnPtrFinder { visitor: &*self, spans: Vec::new(), tys: Vec::new() }; + let mut visitor = FnPtrFinder { visitor: self, spans: Vec::new(), tys: Vec::new() }; ty.visit_with(&mut visitor); hir::intravisit::Visitor::visit_ty(&mut visitor, hir_ty); | 
