Skip to content

Commit d13e543

Browse files
committed
Auto merge of #141995 - chenyukang:rollup-a7om2tn, r=chenyukang
Rollup of 6 pull requests Successful merges: - #141250 (add s390x z17 target features) - #141570 (Fix incorrect eq_unspanned in TokenStream) - #141893 (remove `f16: From<u16>`) - #141924 (Lightly tweak docs for BTree{Map,Set}::extract_if) - #141959 (Add more missing 2015 edition directives) - #141960 (Use non-2015 edition paths in tests that do not test for their resolution) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 792fc2b + 8e285fc commit d13e543

File tree

103 files changed

+419
-370
lines changed

Some content is hidden

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

103 files changed

+419
-370
lines changed

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_codegen_llvm/src/llvm_util.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
282282
}
283283
// Filter out features that are not supported by the current LLVM version
284284
("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,
285+
(
286+
"s390x",
287+
"message-security-assist-extension12"
288+
| "concurrent-functions"
289+
| "miscellaneous-extensions-4"
290+
| "vector-enhancements-3"
291+
| "vector-packed-decimal-enhancement-3",
292+
) if get_version().0 < 20 => None,
285293
// Enable the evex512 target feature if an avx512 target feature is enabled.
286294
("x86", s) if s.starts_with("avx512") => Some(LLVMFeature::with_dependencies(
287295
s,

compiler/rustc_parse/src/parser/tokenstream/tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ fn sp(a: u32, b: u32) -> Span {
1414
Span::with_root_ctxt(BytePos(a), BytePos(b))
1515
}
1616

17+
fn cmp_token_stream(a: &TokenStream, b: &TokenStream) -> bool {
18+
a.len() == b.len() && a.iter().zip(b.iter()).all(|(x, y)| x.eq_unspanned(y))
19+
}
20+
1721
#[test]
1822
fn test_concat() {
1923
create_default_session_globals_then(|| {
@@ -25,7 +29,7 @@ fn test_concat() {
2529
eq_res.push_stream(test_snd);
2630
assert_eq!(test_res.iter().count(), 5);
2731
assert_eq!(eq_res.iter().count(), 5);
28-
assert_eq!(test_res.eq_unspanned(&eq_res), true);
32+
assert_eq!(cmp_token_stream(&test_res, &eq_res), true);
2933
})
3034
}
3135

@@ -104,7 +108,7 @@ fn test_dotdotdot() {
104108
stream.push_tree(TokenTree::token_joint(token::Dot, sp(0, 1)));
105109
stream.push_tree(TokenTree::token_joint(token::Dot, sp(1, 2)));
106110
stream.push_tree(TokenTree::token_alone(token::Dot, sp(2, 3)));
107-
assert!(stream.eq_unspanned(&string_to_ts("...")));
111+
assert!(cmp_token_stream(&stream, &string_to_ts("...")));
108112
assert_eq!(stream.iter().count(), 1);
109113
})
110114
}

compiler/rustc_target/src/target_features.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -710,29 +710,35 @@ static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
710710
// tidy-alphabetical-end
711711
];
712712

713+
#[rustfmt::skip]
713714
const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
714715
// tidy-alphabetical-start
715716
("backchain", Unstable(sym::s390x_target_feature), &[]),
717+
("concurrent-functions", Unstable(sym::s390x_target_feature), &[]),
716718
("deflate-conversion", Unstable(sym::s390x_target_feature), &[]),
717719
("enhanced-sort", Unstable(sym::s390x_target_feature), &[]),
718720
("guarded-storage", Unstable(sym::s390x_target_feature), &[]),
719721
("high-word", Unstable(sym::s390x_target_feature), &[]),
722+
// LLVM does not define message-security-assist-extension versions 1, 2, 6, 10 and 11.
723+
("message-security-assist-extension12", Unstable(sym::s390x_target_feature), &[]),
724+
("message-security-assist-extension3", Unstable(sym::s390x_target_feature), &[]),
725+
("message-security-assist-extension4", Unstable(sym::s390x_target_feature), &[]),
726+
("message-security-assist-extension5", Unstable(sym::s390x_target_feature), &[]),
727+
("message-security-assist-extension8", Unstable(sym::s390x_target_feature), &["message-security-assist-extension3"]),
728+
("message-security-assist-extension9", Unstable(sym::s390x_target_feature), &["message-security-assist-extension3", "message-security-assist-extension4"]),
729+
("miscellaneous-extensions-2", Unstable(sym::s390x_target_feature), &[]),
730+
("miscellaneous-extensions-3", Unstable(sym::s390x_target_feature), &[]),
731+
("miscellaneous-extensions-4", Unstable(sym::s390x_target_feature), &[]),
720732
("nnp-assist", Unstable(sym::s390x_target_feature), &["vector"]),
721733
("transactional-execution", Unstable(sym::s390x_target_feature), &[]),
722734
("vector", Unstable(sym::s390x_target_feature), &[]),
723735
("vector-enhancements-1", Unstable(sym::s390x_target_feature), &["vector"]),
724736
("vector-enhancements-2", Unstable(sym::s390x_target_feature), &["vector-enhancements-1"]),
737+
("vector-enhancements-3", Unstable(sym::s390x_target_feature), &["vector-enhancements-2"]),
725738
("vector-packed-decimal", Unstable(sym::s390x_target_feature), &["vector"]),
726-
(
727-
"vector-packed-decimal-enhancement",
728-
Unstable(sym::s390x_target_feature),
729-
&["vector-packed-decimal"],
730-
),
731-
(
732-
"vector-packed-decimal-enhancement-2",
733-
Unstable(sym::s390x_target_feature),
734-
&["vector-packed-decimal-enhancement"],
735-
),
739+
("vector-packed-decimal-enhancement", Unstable(sym::s390x_target_feature), &["vector-packed-decimal"]),
740+
("vector-packed-decimal-enhancement-2", Unstable(sym::s390x_target_feature), &["vector-packed-decimal-enhancement"]),
741+
("vector-packed-decimal-enhancement-3", Unstable(sym::s390x_target_feature), &["vector-packed-decimal-enhancement-2"]),
736742
// tidy-alphabetical-end
737743
];
738744

library/alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,18 +1416,18 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
14161416
///
14171417
/// # Examples
14181418
///
1419-
/// Splitting a map into even and odd keys, reusing the original map:
1420-
///
14211419
/// ```
14221420
/// #![feature(btree_extract_if)]
14231421
/// use std::collections::BTreeMap;
14241422
///
1423+
/// // Splitting a map into even and odd keys, reusing the original map:
14251424
/// let mut map: BTreeMap<i32, i32> = (0..8).map(|x| (x, x)).collect();
14261425
/// let evens: BTreeMap<_, _> = map.extract_if(.., |k, _v| k % 2 == 0).collect();
14271426
/// let odds = map;
14281427
/// assert_eq!(evens.keys().copied().collect::<Vec<_>>(), [0, 2, 4, 6]);
14291428
/// assert_eq!(odds.keys().copied().collect::<Vec<_>>(), [1, 3, 5, 7]);
14301429
///
1430+
/// // Splitting a map into low and high halves, reusing the original map:
14311431
/// let mut map: BTreeMap<i32, i32> = (0..8).map(|x| (x, x)).collect();
14321432
/// let low: BTreeMap<_, _> = map.extract_if(0..4, |_k, _v| true).collect();
14331433
/// let high = map;

library/alloc/src/collections/btree/set.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,21 +1201,21 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
12011201
/// [`retain`]: BTreeSet::retain
12021202
/// # Examples
12031203
///
1204-
/// Splitting a set into even and odd values, reusing the original set:
1205-
///
12061204
/// ```
12071205
/// #![feature(btree_extract_if)]
12081206
/// use std::collections::BTreeSet;
12091207
///
1208+
/// // Splitting a set into even and odd values, reusing the original set:
12101209
/// let mut set: BTreeSet<i32> = (0..8).collect();
12111210
/// let evens: BTreeSet<_> = set.extract_if(.., |v| v % 2 == 0).collect();
12121211
/// let odds = set;
12131212
/// assert_eq!(evens.into_iter().collect::<Vec<_>>(), vec![0, 2, 4, 6]);
12141213
/// assert_eq!(odds.into_iter().collect::<Vec<_>>(), vec![1, 3, 5, 7]);
12151214
///
1216-
/// let mut map: BTreeSet<i32> = (0..8).collect();
1217-
/// let low: BTreeSet<_> = map.extract_if(0..4, |_v| true).collect();
1218-
/// let high = map;
1215+
/// // Splitting a set into low and high halves, reusing the original set:
1216+
/// let mut set: BTreeSet<i32> = (0..8).collect();
1217+
/// let low: BTreeSet<_> = set.extract_if(0..4, |_v| true).collect();
1218+
/// let high = set;
12191219
/// assert_eq!(low.into_iter().collect::<Vec<_>>(), [0, 1, 2, 3]);
12201220
/// assert_eq!(high.into_iter().collect::<Vec<_>>(), [4, 5, 6, 7]);
12211221
/// ```

library/core/src/convert/num.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ impl_from!(u8 => f16, #[stable(feature = "lossless_float_conv", since = "1.6.0")
175175
impl_from!(u8 => f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
176176
impl_from!(u8 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
177177
impl_from!(u8 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
178-
impl_from!(u16 => f16, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
179178
impl_from!(u16 => f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
180179
impl_from!(u16 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
181180
impl_from!(u16 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);

src/tools/clippy/clippy_utils/src/ast_utils/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,5 +960,7 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
960960
}
961961

962962
pub fn eq_delim_args(l: &DelimArgs, r: &DelimArgs) -> bool {
963-
l.delim == r.delim && l.tokens.eq_unspanned(&r.tokens)
963+
l.delim == r.delim
964+
&& l.tokens.len() == r.tokens.len()
965+
&& l.tokens.iter().zip(r.tokens.iter()).all(|(a, b)| a.eq_unspanned(b))
964966
}

tests/ui/check-cfg/target_feature.stderr

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
6262
`c`
6363
`cache`
6464
`cmpxchg16b`
65+
`concurrent-functions`
6566
`crc`
6667
`crt-static`
6768
`cssc`
@@ -159,6 +160,15 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
159160
`lzcnt`
160161
`m`
161162
`mclass`
163+
`message-security-assist-extension12`
164+
`message-security-assist-extension3`
165+
`message-security-assist-extension4`
166+
`message-security-assist-extension5`
167+
`message-security-assist-extension8`
168+
`message-security-assist-extension9`
169+
`miscellaneous-extensions-2`
170+
`miscellaneous-extensions-3`
171+
`miscellaneous-extensions-4`
162172
`mops`
163173
`movbe`
164174
`movrs`
@@ -287,9 +297,11 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
287297
`vector`
288298
`vector-enhancements-1`
289299
`vector-enhancements-2`
300+
`vector-enhancements-3`
290301
`vector-packed-decimal`
291302
`vector-packed-decimal-enhancement`
292303
`vector-packed-decimal-enhancement-2`
304+
`vector-packed-decimal-enhancement-3`
293305
`vfp2`
294306
`vfp3`
295307
`vfp4`

tests/ui/issues/issue-10806.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-pass
23
#![allow(unused_imports)]
34

0 commit comments

Comments
 (0)