Change how edition is determined

This commit is contained in:
Ryan Levick 2021-04-07 18:20:23 +02:00
parent a2b1347bbb
commit d7b226398e
2 changed files with 3 additions and 3 deletions

View File

@ -2775,7 +2775,7 @@ fn maybe_lint_bare_trait(&mut self, span: Span, id: NodeId, is_global: bool) {
.map(|snippet| snippet.starts_with("#[")) .map(|snippet| snippet.starts_with("#["))
.unwrap_or(true); .unwrap_or(true);
if !is_macro_callsite { if !is_macro_callsite {
if self.sess.edition() < Edition::Edition2021 { if span.edition() < Edition::Edition2021 {
self.resolver.lint_buffer().buffer_lint_with_diagnostic( self.resolver.lint_buffer().buffer_lint_with_diagnostic(
BARE_TRAIT_OBJECTS, BARE_TRAIT_OBJECTS,
id, id,

View File

@ -1704,7 +1704,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)>
Some(start) => format!("&({}..={})", expr_to_string(&start), end), Some(start) => format!("&({}..={})", expr_to_string(&start), end),
None => format!("&(..={})", end), None => format!("&(..={})", end),
}; };
if cx.sess().edition() >= Edition::Edition2021 { if join.edition() >= Edition::Edition2021 {
let mut err = let mut err =
rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,); rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
err.span_suggestion( err.span_suggestion(
@ -1728,7 +1728,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)>
} }
} else { } else {
let replace = "..=".to_owned(); let replace = "..=".to_owned();
if cx.sess().edition() >= Edition::Edition2021 { if join.edition() >= Edition::Edition2021 {
let mut err = let mut err =
rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,); rustc_errors::struct_span_err!(cx.sess, pat.span, E0783, "{}", msg,);
err.span_suggestion_short( err.span_suggestion_short(