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("#["))
.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,

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),
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(