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

tests/ui/issues/issue-12729.rs

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

tests/ui/issues/issue-13105.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23

34
trait Foo {

tests/ui/issues/issue-13775.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23

34
trait Foo {

tests/ui/issues/issue-15774.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

34
#![deny(warnings)]

tests/ui/issues/issue-20427.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mod reuse {
5959

6060
pub fn check<u16>() {
6161
assert_eq!(size_of::<u8>(), 8);
62-
assert_eq!(size_of::<::u64>(), 0);
62+
assert_eq!(size_of::<crate::u64>(), 0);
6363
assert_eq!(size_of::<i16>(), 3 * size_of::<*const ()>());
6464
assert_eq!(size_of::<u16>(), 0);
6565
}

tests/ui/issues/issue-28983.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ impl Test for u32 {
77

88
pub mod export {
99
#[no_mangle]
10-
pub extern "C" fn issue_28983(t: <u32 as ::Test>::T) -> i32 { t*3 }
10+
pub extern "C" fn issue_28983(t: <u32 as crate::Test>::T) -> i32 { t*3 }
1111
}
1212

1313
// to test both exporting and importing functions, import

tests/ui/issues/issue-31776.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct S;
88

99
mod m {
1010
fn f() {
11-
impl ::S {
11+
impl crate::S {
1212
pub fn s(&self) {}
1313
}
1414
}
@@ -24,7 +24,7 @@ pub struct S1;
2424
fn f() {
2525
pub struct Z;
2626

27-
impl ::Tr for ::S1 {
27+
impl crate::Tr for crate::S1 {
2828
type A = Z; // Private-in-public error unless `struct Z` is pub
2929
}
3030
}
@@ -43,7 +43,7 @@ mod m1 {
4343
pub field: u8
4444
}
4545

46-
impl ::Tr1 for ::S2 {
46+
impl crate::Tr1 for crate::S2 {
4747
type A = Z;
4848
fn pull(&self) -> Self::A { Z{field: 10} }
4949
}

tests/ui/issues/issue-32797.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod bar {
77

88
pub use baz::*;
99
mod baz {
10-
pub use main as f;
10+
pub use crate::main as f;
1111
}
1212

1313
pub fn main() {}

tests/ui/issues/issue-34074.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23
// Make sure several unnamed function parameters don't conflict with each other
34

tests/ui/issues/issue-41053.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl Iterator for Foo {
1111
type Item = Box<dyn Trait>;
1212
fn next(&mut self) -> Option<Box<dyn Trait>> {
1313
extern crate issue_41053;
14-
impl ::Trait for issue_41053::Test {
14+
impl crate::Trait for issue_41053::Test {
1515
fn foo(&self) {}
1616
}
1717
Some(Box::new(issue_41053::Test))

tests/ui/issues/issue-47364.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ pub enum IResult<I,O> {
1818
Incomplete(u32, u64)
1919
}
2020

21-
pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
22-
::IResult::Done(0, 0)
21+
pub fn multispace<T: Copy>(input: T) -> crate::IResult<i8, i8> {
22+
crate::IResult::Done(0, 0)
2323
}
2424

2525
mod nom_sql {
26-
fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
27-
let X = match ::multispace(i) {
28-
::IResult::Done(..) => ::IResult::Done(i, None::<String>),
29-
_ => ::IResult::Error(::Err::NodePosition(0)),
26+
fn where_clause(i: &[u8]) -> crate::IResult<&[u8], Option<String>> {
27+
let X = match crate::multispace(i) {
28+
crate::IResult::Done(..) => crate::IResult::Done(i, None::<String>),
29+
_ => crate::IResult::Error(crate::Err::NodePosition(0)),
3030
};
3131
match X {
32-
::IResult::Done(_, _) => ::IResult::Done(i, None),
32+
crate::IResult::Done(_, _) => crate::IResult::Done(i, None),
3333
_ => X
3434
}
3535
}
@@ -39,16 +39,16 @@ mod nom_sql {
3939
match {
4040
where_clause(i)
4141
} {
42-
::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
43-
::IResult::Error(_) => ::IResult::Done(i, None),
44-
_ => ::IResult::Incomplete(0, 0),
42+
crate::IResult::Done(_, o) => crate::IResult::Done(i, Some(o)),
43+
crate::IResult::Error(_) => crate::IResult::Done(i, None),
44+
_ => crate::IResult::Incomplete(0, 0),
4545
}
4646
} {
47-
::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
47+
crate::IResult::Done(z, _) => crate::IResult::Done(z, None::<String>),
4848
_ => return ()
4949
};
5050
match Y {
51-
::IResult::Done(x, _) => {
51+
crate::IResult::Done(x, _) => {
5252
let bytes = b"; ";
5353
let len = x.len();
5454
bytes[len];

tests/ui/issues/issue-50187.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ mod macro_ns {
1313
}
1414

1515
mod merge2 {
16-
pub use type_ns::A;
17-
pub use value_ns::A;
16+
pub use crate::type_ns::A;
17+
pub use crate::value_ns::A;
1818
}
1919
mod merge3 {
20-
pub use type_ns::A;
21-
pub use value_ns::A;
22-
pub use macro_ns::A;
20+
pub use crate::type_ns::A;
21+
pub use crate::value_ns::A;
22+
pub use crate::macro_ns::A;
2323
}
2424

2525
mod use2 {
26-
pub use merge2::A;
26+
pub use crate::merge2::A;
2727
}
2828
mod use3 {
29-
pub use merge3::A;
29+
pub use crate::merge3::A;
3030
}
3131

3232
fn main() {

tests/ui/issues/issue-50571.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23

34
#![allow(dead_code)]

tests/ui/issues/issue-50571.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23

34
#![allow(dead_code)]

0 commit comments

Comments
 (0)