Skip to content

Commit bd898e3

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 869baea + fa282f4 commit bd898e3

File tree

269 files changed

+1705
-1658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+1705
-1658
lines changed

compiler/rustc_abi/src/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
758758
niche_variants,
759759
niche_start,
760760
},
761-
tag_field: 0,
761+
tag_field: FieldIdx::new(0),
762762
variants: IndexVec::new(),
763763
},
764764
fields: FieldsShape::Arbitrary {
@@ -1072,7 +1072,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
10721072
variants: Variants::Multiple {
10731073
tag,
10741074
tag_encoding: TagEncoding::Direct,
1075-
tag_field: 0,
1075+
tag_field: FieldIdx::new(0),
10761076
variants: IndexVec::new(),
10771077
},
10781078
fields: FieldsShape::Arbitrary {

compiler/rustc_abi/src/layout/coroutine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(super) fn layout<
158158
// Build a prefix layout, including "promoting" all ineligible
159159
// locals as part of the prefix. We compute the layout of all of
160160
// these fields at once to get optimal packing.
161-
let tag_index = prefix_layouts.len();
161+
let tag_index = prefix_layouts.next_index();
162162

163163
// `variant_fields` already accounts for the reserved variants, so no need to add them.
164164
let max_discr = (variant_fields.len() - 1) as u128;
@@ -187,7 +187,7 @@ pub(super) fn layout<
187187

188188
// "a" (`0..b_start`) and "b" (`b_start..`) correspond to
189189
// "outer" and "promoted" fields respectively.
190-
let b_start = FieldIdx::new(tag_index + 1);
190+
let b_start = tag_index.plus(1);
191191
let offsets_b = IndexVec::from_raw(offsets.raw.split_off(b_start.index()));
192192
let offsets_a = offsets;
193193

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
15731573
Multiple {
15741574
tag: Scalar,
15751575
tag_encoding: TagEncoding<VariantIdx>,
1576-
tag_field: usize,
1576+
tag_field: FieldIdx,
15771577
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
15781578
},
15791579
}

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ impl TokenTree {
5757
match (self, other) {
5858
(TokenTree::Token(token, _), TokenTree::Token(token2, _)) => token.kind == token2.kind,
5959
(TokenTree::Delimited(.., delim, tts), TokenTree::Delimited(.., delim2, tts2)) => {
60-
delim == delim2 && tts.eq_unspanned(tts2)
60+
delim == delim2
61+
&& tts.len() == tts2.len()
62+
&& tts.iter().zip(tts2.iter()).all(|(a, b)| a.eq_unspanned(b))
6163
}
6264
_ => false,
6365
}
@@ -694,18 +696,6 @@ impl TokenStream {
694696
TokenStreamIter::new(self)
695697
}
696698

697-
/// Compares two `TokenStream`s, checking equality without regarding span information.
698-
pub fn eq_unspanned(&self, other: &TokenStream) -> bool {
699-
let mut iter1 = self.iter();
700-
let mut iter2 = other.iter();
701-
for (tt1, tt2) in iter::zip(&mut iter1, &mut iter2) {
702-
if !tt1.eq_unspanned(tt2) {
703-
return false;
704-
}
705-
}
706-
iter1.next().is_none() && iter2.next().is_none()
707-
}
708-
709699
/// Create a token stream containing a single token with alone spacing. The
710700
/// spacing used for the final token in a constructed stream doesn't matter
711701
/// because it's never used. In practice we arbitrarily use

compiler/rustc_ast/src/visit.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ pub enum LifetimeCtxt {
121121
/// explicitly, you need to override each method. (And you also need
122122
/// to monitor future changes to `Visitor` in case a new method with a
123123
/// new default implementation gets introduced.)
124+
///
125+
/// Every `walk_*` method uses deconstruction to access fields of structs and
126+
/// enums. This will result in a compile error if a field is added, which makes
127+
/// it more likely the appropriate visit call will be added for it.
124128
pub trait Visitor<'ast>: Sized {
125129
/// The result type of the `visit_*` methods. Can be either `()`,
126130
/// or `ControlFlow<T>`.

compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn parse_unstable<'a>(
5353

5454
for param in list.mixed() {
5555
let param_span = param.span();
56-
if let Some(ident) = param.meta_item().and_then(|i| i.path_without_args().word()) {
56+
if let Some(ident) = param.meta_item().and_then(|i| i.path().word()) {
5757
res.push(ident.name);
5858
} else {
5959
cx.emit_err(session_diagnostics::ExpectsFeatures {

compiler/rustc_attr_parsing/src/attributes/deprecation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl SingleAttributeParser for DeprecationParser {
7979
return None;
8080
};
8181

82-
let ident_name = param.path_without_args().word_sym();
82+
let ident_name = param.path().word_sym();
8383

8484
match ident_name {
8585
Some(name @ sym::since) => {
@@ -102,7 +102,7 @@ impl SingleAttributeParser for DeprecationParser {
102102
_ => {
103103
cx.emit_err(session_diagnostics::UnknownMetaItem {
104104
span: param_span,
105-
item: param.path_without_args().to_string(),
105+
item: param.path().to_string(),
106106
expected: if features.deprecated_suggestion() {
107107
&["since", "note", "suggestion"]
108108
} else {

compiler/rustc_attr_parsing/src/attributes/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn parse_repr(cx: &AcceptContext<'_>, param: &MetaItemParser<'_>) -> Option<Repr
9696

9797
// FIXME(jdonszelmann): invert the parsing here to match on the word first and then the
9898
// structure.
99-
let (name, ident_span) = if let Some(ident) = param.path_without_args().word() {
99+
let (name, ident_span) = if let Some(ident) = param.path().word() {
100100
(Some(ident.name), ident.span)
101101
} else {
102102
(None, DUMMY_SP)

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn insert_value_into_option_or_error(
204204
if item.is_some() {
205205
cx.emit_err(session_diagnostics::MultipleItem {
206206
span: param.span(),
207-
item: param.path_without_args().to_string(),
207+
item: param.path().to_string(),
208208
});
209209
None
210210
} else if let Some(v) = param.args().name_value()
@@ -242,13 +242,13 @@ pub(crate) fn parse_stability(
242242
return None;
243243
};
244244

245-
match param.path_without_args().word_sym() {
245+
match param.path().word_sym() {
246246
Some(sym::feature) => insert_value_into_option_or_error(cx, &param, &mut feature)?,
247247
Some(sym::since) => insert_value_into_option_or_error(cx, &param, &mut since)?,
248248
_ => {
249249
cx.emit_err(session_diagnostics::UnknownMetaItem {
250250
span: param_span,
251-
item: param.path_without_args().to_string(),
251+
item: param.path().to_string(),
252252
expected: &["feature", "since"],
253253
});
254254
return None;
@@ -310,7 +310,7 @@ pub(crate) fn parse_unstability(
310310
return None;
311311
};
312312

313-
match param.path_without_args().word_sym() {
313+
match param.path().word_sym() {
314314
Some(sym::feature) => insert_value_into_option_or_error(cx, &param, &mut feature)?,
315315
Some(sym::reason) => insert_value_into_option_or_error(cx, &param, &mut reason)?,
316316
Some(sym::issue) => {
@@ -349,7 +349,7 @@ pub(crate) fn parse_unstability(
349349
_ => {
350350
cx.emit_err(session_diagnostics::UnknownMetaItem {
351351
span: param.span(),
352-
item: param.path_without_args().to_string(),
352+
item: param.path().to_string(),
353353
expected: &["feature", "reason", "issue", "soft", "implied_by"],
354354
});
355355
return None;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ impl<'sess> AttributeParser<'sess> {
264264
// }
265265
ast::AttrKind::Normal(n) => {
266266
let parser = MetaItemParser::from_attr(n, self.dcx());
267-
let (path, args) = parser.deconstruct();
267+
let path = parser.path();
268+
let args = parser.args();
268269
let parts = path.segments().map(|i| i.name).collect::<Vec<_>>();
269270

270271
if let Some(accept) = ATTRIBUTE_MAPPING.0.get(parts.as_slice()) {

0 commit comments

Comments
 (0)