Skip to content

Commit 0882ad5

Browse files
committed
Rename AstValidator::session as AstValidator::sess.
Because `sess` is the standard name used everywhere else.
1 parent 711c91d commit 0882ad5

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl TraitOrTraitImpl {
6363
}
6464

6565
struct AstValidator<'a> {
66-
session: &'a Session,
66+
sess: &'a Session,
6767
features: &'a Features,
6868

6969
/// The span of the `extern` in an `extern { ... }` block, if any.
@@ -267,7 +267,7 @@ impl<'a> AstValidator<'a> {
267267
}
268268

269269
fn dcx(&self) -> DiagCtxtHandle<'a> {
270-
self.session.dcx()
270+
self.sess.dcx()
271271
}
272272

273273
fn visibility_not_permitted(&self, vis: &Visibility, note: errors::VisibilityNotPermittedNote) {
@@ -359,7 +359,7 @@ impl<'a> AstValidator<'a> {
359359
in_impl: matches!(parent, TraitOrTraitImpl::TraitImpl { .. }),
360360
const_context_label: parent_constness,
361361
remove_const_sugg: (
362-
self.session.source_map().span_extend_while_whitespace(span),
362+
self.sess.source_map().span_extend_while_whitespace(span),
363363
match parent_constness {
364364
Some(_) => rustc_errors::Applicability::MachineApplicable,
365365
None => rustc_errors::Applicability::MaybeIncorrect,
@@ -472,15 +472,15 @@ impl<'a> AstValidator<'a> {
472472

473473
fn check_defaultness(&self, span: Span, defaultness: Defaultness) {
474474
if let Defaultness::Default(def_span) = defaultness {
475-
let span = self.session.source_map().guess_head_span(span);
475+
let span = self.sess.source_map().guess_head_span(span);
476476
self.dcx().emit_err(errors::ForbiddenDefault { span, def_span });
477477
}
478478
}
479479

480480
/// If `sp` ends with a semicolon, returns it as a `Span`
481481
/// Otherwise, returns `sp.shrink_to_hi()`
482482
fn ending_semi_or_hi(&self, sp: Span) -> Span {
483-
let source_map = self.session.source_map();
483+
let source_map = self.sess.source_map();
484484
let end = source_map.end_point(sp);
485485

486486
if source_map.span_to_snippet(end).is_ok_and(|s| s == ";") {
@@ -552,7 +552,7 @@ impl<'a> AstValidator<'a> {
552552
}
553553

554554
fn current_extern_span(&self) -> Span {
555-
self.session.source_map().guess_head_span(self.extern_mod.unwrap())
555+
self.sess.source_map().guess_head_span(self.extern_mod.unwrap())
556556
}
557557

558558
/// An `fn` in `extern { ... }` cannot have qualifiers, e.g. `async fn`.
@@ -648,7 +648,7 @@ impl<'a> AstValidator<'a> {
648648
if ident.name.as_str().is_ascii() {
649649
return;
650650
}
651-
let span = self.session.source_map().guess_head_span(item_span);
651+
let span = self.sess.source_map().guess_head_span(item_span);
652652
self.dcx().emit_err(errors::NoMangleAscii { span });
653653
}
654654

@@ -753,7 +753,7 @@ impl<'a> AstValidator<'a> {
753753
self.dcx().emit_err(errors::PatternFnPointer { span });
754754
});
755755
if let Extern::Implicit(_) = bfty.ext {
756-
let sig_span = self.session.source_map().next_point(ty.span.shrink_to_lo());
756+
let sig_span = self.sess.source_map().next_point(ty.span.shrink_to_lo());
757757
self.maybe_lint_missing_abi(sig_span, ty.id);
758758
}
759759
}
@@ -795,7 +795,7 @@ impl<'a> AstValidator<'a> {
795795
// FIXME(davidtwco): This is a hack to detect macros which produce spans of the
796796
// call site which do not have a macro backtrace. See #61963.
797797
if self
798-
.session
798+
.sess
799799
.source_map()
800800
.span_to_snippet(span)
801801
.is_ok_and(|snippet| !snippet.starts_with("#["))
@@ -885,7 +885,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
885885

886886
impl<'a> Visitor<'a> for AstValidator<'a> {
887887
fn visit_attribute(&mut self, attr: &Attribute) {
888-
validate_attr::check_attr(&self.session.psess, attr);
888+
validate_attr::check_attr(&self.sess.psess, attr);
889889
}
890890

891891
fn visit_ty(&mut self, ty: &'a Ty) {
@@ -1192,7 +1192,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11921192
} else if where_clauses.after.has_where_token {
11931193
self.dcx().emit_err(errors::WhereClauseAfterTypeAlias {
11941194
span: where_clauses.after.span,
1195-
help: self.session.is_nightly_build(),
1195+
help: self.sess.is_nightly_build(),
11961196
});
11971197
}
11981198
}
@@ -1328,7 +1328,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
13281328
(BoundKind::SuperTraits, BoundConstness::Never, BoundPolarity::Maybe(_))
13291329
if !self.features.more_maybe_bounds =>
13301330
{
1331-
self.session
1331+
self.sess
13321332
.create_feature_err(
13331333
errors::OptionalTraitSupertrait {
13341334
span: trait_ref.span,
@@ -1341,7 +1341,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
13411341
(BoundKind::TraitObject, BoundConstness::Never, BoundPolarity::Maybe(_))
13421342
if !self.features.more_maybe_bounds =>
13431343
{
1344-
self.session
1344+
self.sess
13451345
.create_feature_err(
13461346
errors::OptionalTraitObject { span: trait_ref.span },
13471347
sym::more_maybe_bounds,
@@ -1752,13 +1752,13 @@ fn deny_equality_constraints(
17521752
}
17531753

17541754
pub fn check_crate(
1755-
session: &Session,
1755+
sess: &Session,
17561756
features: &Features,
17571757
krate: &Crate,
17581758
lints: &mut LintBuffer,
17591759
) -> bool {
17601760
let mut validator = AstValidator {
1761-
session,
1761+
sess,
17621762
features,
17631763
extern_mod: None,
17641764
outer_trait_or_trait_impl: None,

0 commit comments

Comments
 (0)