diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index aefc89695587..e83975f56c44 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -2775,7 +2775,7 @@ fn maybe_lint_bare_trait(&mut self, span: Span, id: NodeId, is_global: bool) { .map(|snippet| snippet.starts_with("#[")) .unwrap_or(true); if !is_macro_callsite { - if self.sess.edition() < Edition::Edition2021 { + if span.edition() < Edition::Edition2021 { self.resolver.lint_buffer().buffer_lint_with_diagnostic( BARE_TRAIT_OBJECTS, id, diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 9f1efe980f67..379f41319f6a 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1704,7 +1704,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)> Some(start) => format!("&({}..={})", expr_to_string(&start), end), None => format!("&(..={})", end), }; - if cx.sess().edition() >= Edition::Edition2021 { + if join.edition() >= Edition::Edition2021 { let mut err = rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,); err.span_suggestion( @@ -1728,7 +1728,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)> } } else { let replace = "..=".to_owned(); - if cx.sess().edition() >= Edition::Edition2021 { + if join.edition() >= Edition::Edition2021 { let mut err = rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,); err.span_suggestion_short(