diff options
| author | bors <bors@rust-lang.org> | 2022-11-14 06:30:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-14 06:30:18 +0000 |
| commit | 96ddd32c4bfb1d78f0cd03eb068b1710a8cebeef (patch) | |
| tree | 8fb6205431371f9923ca9eac04bbcbc0ce4c2e55 /compiler/rustc_parse/src/parser/attr_wrapper.rs | |
| parent | f90a4ff26c9743abf612f015c4398d7158b646b6 (diff) | |
| parent | 4fdd944af46e074807f132d46135f2945b57d1b0 (diff) | |
| download | rust-96ddd32c4bfb1d78f0cd03eb068b1710a8cebeef.tar.gz rust-96ddd32c4bfb1d78f0cd03eb068b1710a8cebeef.zip | |
Auto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth
Rollup of 9 pull requests Successful merges: - #103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0) - #103744 (Upgrade cc for working is_flag_supported on cross-compiles) - #104105 (llvm: dwo only emitted when object code emitted) - #104158 (Return .efi extension for EFI executable) - #104181 (Add a few known-bug tests) - #104266 (Regression test for coercion of mut-ref to dyn-star) - #104300 (Document `Path::parent` behavior around relative paths) - #104304 (Enable profiler in dist-s390x-linux) - #104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/attr_wrapper.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr_wrapper.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index 1b16ecb5ec2..c8160548763 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -5,7 +5,8 @@ use rustc_ast::tokenstream::{AttrTokenTree, DelimSpan, LazyAttrTokenStream, Spac use rustc_ast::{self as ast}; use rustc_ast::{AttrVec, Attribute, HasAttrs, HasTokens}; use rustc_errors::PResult; -use rustc_span::{sym, Span}; +use rustc_session::parse::ParseSess; +use rustc_span::{sym, Span, DUMMY_SP}; use std::convert::TryInto; use std::ops::Range; @@ -39,8 +40,13 @@ impl AttrWrapper { pub fn empty() -> AttrWrapper { AttrWrapper { attrs: AttrVec::new(), start_pos: usize::MAX } } - // FIXME: Delay span bug here? - pub(crate) fn take_for_recovery(self) -> AttrVec { + + pub(crate) fn take_for_recovery(self, sess: &ParseSess) -> AttrVec { + sess.span_diagnostic.delay_span_bug( + self.attrs.get(0).map(|attr| attr.span).unwrap_or(DUMMY_SP), + "AttrVec is taken for recovery but no error is produced", + ); + self.attrs } |
