Skip to content

Commit 9a4c105

Browse files
committed
Just store a span instead of the whole item
1 parent a91f7d7 commit 9a4c105

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct AstValidator<'a> {
8181
features: &'a Features,
8282

8383
/// The span of the `extern` in an `extern { ... }` block, if any.
84-
extern_mod: Option<&'a Item>,
84+
extern_mod: Option<Span>,
8585

8686
outer_trait_or_trait_impl: Option<TraitOrTraitImpl<'a>>,
8787

@@ -579,7 +579,7 @@ impl<'a> AstValidator<'a> {
579579
}
580580

581581
fn current_extern_span(&self) -> Span {
582-
self.session.source_map().guess_head_span(self.extern_mod.unwrap().span)
582+
self.session.source_map().guess_head_span(self.extern_mod.unwrap())
583583
}
584584

585585
/// An `fn` in `extern { ... }` cannot have qualifiers, e.g. `async fn`.
@@ -1080,7 +1080,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
10801080
}
10811081
ItemKind::ForeignMod(ForeignMod { abi, safety, .. }) => {
10821082
self.with_in_extern_mod(*safety, |this| {
1083-
let old_item = mem::replace(&mut this.extern_mod, Some(item));
1083+
let old_item = mem::replace(&mut this.extern_mod, Some(item.span));
10841084
this.visibility_not_permitted(
10851085
&item.vis,
10861086
errors::VisibilityNotPermittedNote::IndividualForeignItems,

0 commit comments

Comments
 (0)