mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
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
This commit is contained in:
commit
02b1be16c6
@ -3044,7 +3044,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
|
|||||||
"iphonesimulator"
|
"iphonesimulator"
|
||||||
if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("MacOSX.platform") => {
|
if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("MacOSX.platform") => {
|
||||||
}
|
}
|
||||||
"macosx10.15"
|
"macosx"
|
||||||
if sdkroot.contains("iPhoneOS.platform")
|
if sdkroot.contains("iPhoneOS.platform")
|
||||||
|| sdkroot.contains("iPhoneSimulator.platform") => {}
|
|| sdkroot.contains("iPhoneSimulator.platform") => {}
|
||||||
"watchos"
|
"watchos"
|
||||||
|
@ -344,7 +344,8 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti
|
|||||||
|
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
" {} for {}",
|
" {}{} for {}",
|
||||||
|
tcx.impl_polarity(impl_def_id).as_str(),
|
||||||
trait_ref.print_only_trait_path(),
|
trait_ref.print_only_trait_path(),
|
||||||
tcx.type_of(impl_def_id).instantiate_identity()
|
tcx.type_of(impl_def_id).instantiate_identity()
|
||||||
)
|
)
|
||||||
|
@ -196,6 +196,17 @@ impl fmt::Display for ImplPolarity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ImplPolarity {
|
||||||
|
/// The polarity marker in front of the impl trait ref if applicable.
|
||||||
|
pub fn as_str(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Positive => "",
|
||||||
|
Self::Negative => "!",
|
||||||
|
Self::Reservation => "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Polarity for a trait predicate. May either be negative or positive.
|
/// Polarity for a trait predicate. May either be negative or positive.
|
||||||
/// Distinguished from [`ImplPolarity`] since we never compute goals with
|
/// Distinguished from [`ImplPolarity`] since we never compute goals with
|
||||||
/// "reservation" level.
|
/// "reservation" level.
|
||||||
|
@ -269,7 +269,7 @@ impl<I: Iterator> Peekable<I> {
|
|||||||
/// let mut iter = (0..5).peekable();
|
/// let mut iter = (0..5).peekable();
|
||||||
/// // The first item of the iterator is 0; consume it.
|
/// // The first item of the iterator is 0; consume it.
|
||||||
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
|
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
|
||||||
/// // The next item returned is now 1, so `consume` will return `false`.
|
/// // The next item returned is now 1, so `next_if` will return `None`.
|
||||||
/// assert_eq!(iter.next_if(|&x| x == 0), None);
|
/// assert_eq!(iter.next_if(|&x| x == 0), None);
|
||||||
/// // `next_if` saves the value of the next item if it was not equal to `expected`.
|
/// // `next_if` saves the value of the next item if it was not equal to `expected`.
|
||||||
/// assert_eq!(iter.next(), Some(1));
|
/// assert_eq!(iter.next(), Some(1));
|
||||||
@ -304,7 +304,7 @@ impl<I: Iterator> Peekable<I> {
|
|||||||
/// let mut iter = (0..5).peekable();
|
/// let mut iter = (0..5).peekable();
|
||||||
/// // The first item of the iterator is 0; consume it.
|
/// // The first item of the iterator is 0; consume it.
|
||||||
/// assert_eq!(iter.next_if_eq(&0), Some(0));
|
/// assert_eq!(iter.next_if_eq(&0), Some(0));
|
||||||
/// // The next item returned is now 1, so `consume` will return `false`.
|
/// // The next item returned is now 1, so `next_if` will return `None`.
|
||||||
/// assert_eq!(iter.next_if_eq(&0), None);
|
/// assert_eq!(iter.next_if_eq(&0), None);
|
||||||
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
|
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
|
||||||
/// assert_eq!(iter.next(), Some(1));
|
/// assert_eq!(iter.next(), Some(1));
|
||||||
|
@ -58,7 +58,7 @@ static mut Z: u64 = 0;
|
|||||||
// Currently, only MIPS and RISCV successfully put any objects in the small data
|
// Currently, only MIPS and RISCV successfully put any objects in the small data
|
||||||
// sections so the U/V/W/X tests are skipped on Hexagon and M68K
|
// sections so the U/V/W/X tests are skipped on Hexagon and M68K
|
||||||
|
|
||||||
//@ RISCV: .section .sdata,
|
//@ RISCV: .section .sdata
|
||||||
//@ RISCV-NOT: .section
|
//@ RISCV-NOT: .section
|
||||||
//@ RISCV: U:
|
//@ RISCV: U:
|
||||||
//@ RISCV: .section .sbss
|
//@ RISCV: .section .sbss
|
||||||
@ -71,7 +71,7 @@ static mut Z: u64 = 0;
|
|||||||
//@ RISCV-NOT: .section
|
//@ RISCV-NOT: .section
|
||||||
//@ RISCV: X:
|
//@ RISCV: X:
|
||||||
|
|
||||||
//@ MIPS: .section .sdata,
|
//@ MIPS: .section .sdata
|
||||||
//@ MIPS-NOT: .section
|
//@ MIPS-NOT: .section
|
||||||
//@ MIPS: U:
|
//@ MIPS: U:
|
||||||
//@ MIPS: .section .sbss
|
//@ MIPS: .section .sbss
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
#![feature(negative_impls)]
|
||||||
|
//@ edition: 2021
|
||||||
|
// Test to ensure we are printing the polarity of the impl trait ref
|
||||||
|
// when printing out conflicting trait impls
|
||||||
|
|
||||||
|
struct MyType;
|
||||||
|
|
||||||
|
impl !Clone for &mut MyType {}
|
||||||
|
//~^ ERROR conflicting implementations of trait `Clone` for type `&mut MyType`
|
||||||
|
fn main() {}
|
@ -0,0 +1,13 @@
|
|||||||
|
error[E0119]: conflicting implementations of trait `Clone` for type `&mut MyType`
|
||||||
|
--> $DIR/coherence-conflicting-repeated-negative-trait-impl-70849.rs:8:1
|
||||||
|
|
|
||||||
|
LL | impl !Clone for &mut MyType {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: conflicting implementation in crate `core`:
|
||||||
|
- impl<T> !Clone for &mut T
|
||||||
|
where T: ?Sized;
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0119`.
|
Loading…
Reference in New Issue
Block a user