Skip to content

Commit 9cd92f4

Browse files
committed
Auto merge of #164940 - JonathanBrouwer:rollup-rCORLRu, r=JonathanBrouwer
Rollup of 6 pull requests Successful merges: - #164617 (tools: remote-test-server: Fix UEFI crash return code) - #164549 (feat!: change return type of `TryFromIntError::kind`) - #164893 (Add diagnostic items for env::vars / env::vars_os) - #164897 (Add regression test for CoerceShared impl with unnormalizable target) - #164908 (Add regression test for self referential inherent associated type ICE) - #164925 (Cleanup `rustdoc-html` tests)
2 parents 8592206 + 89b66c2 commit 9cd92f4

16 files changed

Lines changed: 121 additions & 49 deletions

‎library/core/src/num/error.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ impl TryFromIntError {
1212
/// Outputs the detailed cause of converting an integer failing.
1313
#[must_use]
1414
#[unstable(feature = "try_from_int_error_kind", issue = "153978")]
15-
pub const fn kind(&self) -> &IntErrorKind {
16-
&self.0
15+
pub const fn kind(&self) -> IntErrorKind {
16+
self.0
1717
}
1818
}
1919

‎library/coretests/tests/nonzero.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ fn test_nonzero_from_int_on_success() {
285285

286286
#[test]
287287
fn test_nonzero_from_int_on_err() {
288-
assert_eq!(NonZero::<u8>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
289-
assert_eq!(NonZero::<u32>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
288+
assert_eq!(NonZero::<u8>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
289+
assert_eq!(NonZero::<u32>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
290290

291-
assert_eq!(NonZero::<i8>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
292-
assert_eq!(NonZero::<i32>::try_from(0).unwrap_err().kind(), &IntErrorKind::Zero);
291+
assert_eq!(NonZero::<i8>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
292+
assert_eq!(NonZero::<i32>::try_from(0).unwrap_err().kind(), IntErrorKind::Zero);
293293
}
294294

295295
#[test]

‎library/coretests/tests/num/mod.rs‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,14 @@ macro_rules! test_impl_try_from_integer_to_bool {
388388
let zero: $source = 0;
389389
let one: $source = 1;
390390
let two: $source = 2;
391-
assert_eq!(bool::try_from(max).unwrap_err().kind(), &IntErrorKind::PosOverflow);
391+
assert_eq!(bool::try_from(max).unwrap_err().kind(), IntErrorKind::PosOverflow);
392392
if min != 0 {
393-
assert_eq!(bool::try_from(min).unwrap_err().kind(), &IntErrorKind::NegOverflow);
394-
assert_eq!(
395-
bool::try_from(zero - 1).unwrap_err().kind(),
396-
&IntErrorKind::NegOverflow
397-
);
393+
assert_eq!(bool::try_from(min).unwrap_err().kind(), IntErrorKind::NegOverflow);
394+
assert_eq!(bool::try_from(zero - 1).unwrap_err().kind(), IntErrorKind::NegOverflow);
398395
}
399396
assert_eq!(bool::try_from(zero).unwrap(), false);
400397
assert_eq!(bool::try_from(one).unwrap(), true);
401-
assert_eq!(bool::try_from(two).unwrap_err().kind(), &IntErrorKind::PosOverflow);
398+
assert_eq!(bool::try_from(two).unwrap_err().kind(), IntErrorKind::PosOverflow);
402399
}
403400
};
404401
}
@@ -540,12 +537,12 @@ macro_rules! test_impl_try_from_signed_to_unsigned_upper_ok {
540537
assert_eq!(<$target as TryFrom<$source>>::try_from(max).unwrap(), max as $target);
541538
assert_eq!(
542539
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
543-
&IntErrorKind::NegOverflow
540+
IntErrorKind::NegOverflow
544541
);
545542
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
546543
assert_eq!(
547544
<$target as TryFrom<$source>>::try_from(neg_one).unwrap_err().kind(),
548-
&IntErrorKind::NegOverflow
545+
IntErrorKind::NegOverflow
549546
);
550547
}
551548
};
@@ -609,7 +606,7 @@ macro_rules! test_impl_try_from_unsigned_to_signed_upper_err {
609606
let zero: $source = 0;
610607
assert_eq!(
611608
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
612-
&IntErrorKind::PosOverflow
609+
IntErrorKind::PosOverflow
613610
);
614611
assert_eq!(<$target as TryFrom<$source>>::try_from(min).unwrap(), min as $target);
615612
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
@@ -675,12 +672,12 @@ macro_rules! test_impl_try_from_same_sign_err {
675672
let t_min = <$target>::MIN;
676673
assert_eq!(
677674
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
678-
&IntErrorKind::PosOverflow
675+
IntErrorKind::PosOverflow
679676
);
680677
if min != 0 {
681678
assert_eq!(
682679
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
683-
&IntErrorKind::NegOverflow
680+
IntErrorKind::NegOverflow
684681
);
685682
}
686683
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
@@ -770,11 +767,11 @@ macro_rules! test_impl_try_from_signed_to_unsigned_err {
770767
let t_min = <$target>::MIN;
771768
assert_eq!(
772769
<$target as TryFrom<$source>>::try_from(max).unwrap_err().kind(),
773-
&IntErrorKind::PosOverflow
770+
IntErrorKind::PosOverflow
774771
);
775772
assert_eq!(
776773
<$target as TryFrom<$source>>::try_from(min).unwrap_err().kind(),
777-
&IntErrorKind::NegOverflow
774+
IntErrorKind::NegOverflow
778775
);
779776
assert_eq!(<$target as TryFrom<$source>>::try_from(zero).unwrap(), zero as $target);
780777
assert_eq!(

‎library/std/src/env.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ impl !Sync for VarsOs {}
132132
/// [`env::vars_os()`]: vars_os
133133
#[must_use]
134134
#[stable(feature = "env", since = "1.0.0")]
135+
#[cfg_attr(not(test), rustc_diagnostic_item = "env_vars")]
135136
pub fn vars() -> Vars {
136137
Vars { inner: vars_os() }
137138
}
@@ -157,6 +158,7 @@ pub fn vars() -> Vars {
157158
/// ```
158159
#[must_use]
159160
#[stable(feature = "env", since = "1.0.0")]
161+
#[cfg_attr(not(test), rustc_diagnostic_item = "env_vars_os")]
160162
pub fn vars_os() -> VarsOs {
161163
VarsOs { inner: env_imp::env() }
162164
}

‎src/tools/remote-test-server/src/main.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,13 @@ fn get_status_code(status: &ExitStatus) -> (u8, i32) {
337337
}
338338
}
339339

340-
#[cfg(any(windows, target_os = "motor", target_os = "uefi"))]
340+
#[cfg(target_os = "uefi")]
341+
fn get_status_code(status: &ExitStatus) -> (u8, i32) {
342+
let status = status.code().unwrap();
343+
if (status & i32::MIN) != 0 { (1, status & !i32::MIN) } else { (0, status) }
344+
}
345+
346+
#[cfg(any(windows, target_os = "motor"))]
341347
fn get_status_code(status: &ExitStatus) -> (u8, i32) {
342348
(0, status.code().unwrap())
343349
}

‎tests/rustdoc-html/impossible-default.rs‎

Lines changed: 0 additions & 28 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)