Skip to content

Commit 02b1be1

Browse files
committed
Auto merge of #130348 - Zalathar:rollup-5d0b7a9, r=Zalathar
Rollup of 4 pull requests Successful merges: - #130053 (fix doc comments for Peekable::next_if(_eq)) - #130267 (small_data_threshold.rs: Adapt to LLVM head changes) - #130311 ((fix) conflicting negative impl marker) - #130334 (Fix `SDKROOT` ignore on macOS) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f9567d0 + 73f684f commit 02b1be1

File tree

7 files changed

+41
-6
lines changed

7 files changed

+41
-6
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3044,7 +3044,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
30443044
"iphonesimulator"
30453045
if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("MacOSX.platform") => {
30463046
}
3047-
"macosx10.15"
3047+
"macosx"
30483048
if sdkroot.contains("iPhoneOS.platform")
30493049
|| sdkroot.contains("iPhoneSimulator.platform") => {}
30503050
"watchos"

compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti
344344

345345
write!(
346346
w,
347-
" {} for {}",
347+
" {}{} for {}",
348+
tcx.impl_polarity(impl_def_id).as_str(),
348349
trait_ref.print_only_trait_path(),
349350
tcx.type_of(impl_def_id).instantiate_identity()
350351
)

compiler/rustc_type_ir/src/predicate.rs

+11
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ impl fmt::Display for ImplPolarity {
196196
}
197197
}
198198

199+
impl ImplPolarity {
200+
/// The polarity marker in front of the impl trait ref if applicable.
201+
pub fn as_str(self) -> &'static str {
202+
match self {
203+
Self::Positive => "",
204+
Self::Negative => "!",
205+
Self::Reservation => "",
206+
}
207+
}
208+
}
209+
199210
/// Polarity for a trait predicate. May either be negative or positive.
200211
/// Distinguished from [`ImplPolarity`] since we never compute goals with
201212
/// "reservation" level.

library/core/src/iter/adapters/peekable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl<I: Iterator> Peekable<I> {
269269
/// let mut iter = (0..5).peekable();
270270
/// // The first item of the iterator is 0; consume it.
271271
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
272-
/// // The next item returned is now 1, so `consume` will return `false`.
272+
/// // The next item returned is now 1, so `next_if` will return `None`.
273273
/// assert_eq!(iter.next_if(|&x| x == 0), None);
274274
/// // `next_if` saves the value of the next item if it was not equal to `expected`.
275275
/// assert_eq!(iter.next(), Some(1));
@@ -304,7 +304,7 @@ impl<I: Iterator> Peekable<I> {
304304
/// let mut iter = (0..5).peekable();
305305
/// // The first item of the iterator is 0; consume it.
306306
/// assert_eq!(iter.next_if_eq(&0), Some(0));
307-
/// // The next item returned is now 1, so `consume` will return `false`.
307+
/// // The next item returned is now 1, so `next_if` will return `None`.
308308
/// assert_eq!(iter.next_if_eq(&0), None);
309309
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
310310
/// assert_eq!(iter.next(), Some(1));

tests/assembly/small_data_threshold.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static mut Z: u64 = 0;
5858
// Currently, only MIPS and RISCV successfully put any objects in the small data
5959
// sections so the U/V/W/X tests are skipped on Hexagon and M68K
6060

61-
//@ RISCV: .section .sdata,
61+
//@ RISCV: .section .sdata
6262
//@ RISCV-NOT: .section
6363
//@ RISCV: U:
6464
//@ RISCV: .section .sbss
@@ -71,7 +71,7 @@ static mut Z: u64 = 0;
7171
//@ RISCV-NOT: .section
7272
//@ RISCV: X:
7373

74-
//@ MIPS: .section .sdata,
74+
//@ MIPS: .section .sdata
7575
//@ MIPS-NOT: .section
7676
//@ MIPS: U:
7777
//@ MIPS: .section .sbss
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(negative_impls)]
2+
//@ edition: 2021
3+
// Test to ensure we are printing the polarity of the impl trait ref
4+
// when printing out conflicting trait impls
5+
6+
struct MyType;
7+
8+
impl !Clone for &mut MyType {}
9+
//~^ ERROR conflicting implementations of trait `Clone` for type `&mut MyType`
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0119]: conflicting implementations of trait `Clone` for type `&mut MyType`
2+
--> $DIR/coherence-conflicting-repeated-negative-trait-impl-70849.rs:8:1
3+
|
4+
LL | impl !Clone for &mut MyType {}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: conflicting implementation in crate `core`:
8+
- impl<T> !Clone for &mut T
9+
where T: ?Sized;
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)