authorbors <bors@rust-lang.org> 2025-05-18 12:05:55 UTC
committerbors <bors@rust-lang.org> 2025-05-18 12:05:55 UTC
logb53e5c9db04c89fa15c96f03ae2e0c538b598940
treef0b3e02e2c8a2eb9841d4e45272281b730c7f57c
parent7205fc537d0fe8c3c2560b313e54fcb91ab6f3d1
parentc7e2e88da00a47346b76629ca3f72bf3a49d2bbf

Auto merge of #141216 - fmease:rollup-pa5mvx3, r=fmease

Rollup of 8 pull requests Successful merges: - #140113 (Add per page TOC in the `rustc` book) - #140511 (Stabilize `#![feature(non_null_from_ref)]`) - #140924 (Make some `f32`/`f64` tests also run in const-context) - #140966 (Remove #![feature(let_chains)] from library and src/librustdoc) - #141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test) - #141071 (Enable [behind-upstream] triagebot option for rust-lang/rust) - #141132 (Use `crate::` prefix for root macro suggestions) - #141139 (Fix Rust for Linux ping group label) r? `@ghost` `@rustbot` modify labels: rollup

24 files changed, 479 insertions(+), 195 deletions(-)

compiler/rustc_pattern_analysis/src/lib.rs-1
......@@ -6,7 +6,6 @@
66#![allow(rustc::diagnostic_outside_of_impl)]
77#![allow(rustc::untranslatable_diagnostic)]
88#![allow(unused_crate_dependencies)]
9#![cfg_attr(all(feature = "rustc", bootstrap), feature(let_chains))]
109// tidy-alphabetical-end
1110
1211pub mod constructor;
compiler/rustc_resolve/src/diagnostics.rs+1-1
......@@ -2493,7 +2493,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24932493 let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else {
24942494 return None;
24952495 };
2496 let module_name = crate_module.kind.name().unwrap_or(kw::Empty);
2496 let module_name = crate_module.kind.name().unwrap_or(kw::Crate);
24972497 let import_snippet = match import.kind {
24982498 ImportKind::Single { source, target, .. } if source != target => {
24992499 format!("{source} as {target}")
compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs+1-6
......@@ -1,4 +1,4 @@
1use crate::spec::{FramePointer, LinkerFlavor, Lld, Target, TargetMetadata, base};
1use crate::spec::{FramePointer, Target, TargetMetadata, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
......@@ -11,11 +11,6 @@ pub(crate) fn target() -> Target {
1111 // and other services. It must point to the previous {x29, x30} pair on the stack."
1212 base.frame_pointer = FramePointer::NonLeaf;
1313
14 // MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see
15 // https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM.
16 // Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning.
17 base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/arm64hazardfree"]);
18
1914 Target {
2015 llvm_target: "aarch64-pc-windows-msvc".into(),
2116 metadata: TargetMetadata {
library/core/src/lib.rs-1
......@@ -111,7 +111,6 @@
111111#![feature(is_ascii_octdigit)]
112112#![feature(lazy_get)]
113113#![feature(link_cfg)]
114#![feature(non_null_from_ref)]
115114#![feature(offset_of_enum)]
116115#![feature(panic_internals)]
117116#![feature(ptr_alignment_type)]
library/core/src/ptr/non_null.rs+4-2
......@@ -262,7 +262,8 @@ impl<T: ?Sized> NonNull<T> {
262262 }
263263
264264 /// Converts a reference to a `NonNull` pointer.
265 #[unstable(feature = "non_null_from_ref", issue = "130823")]
265 #[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266 #[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266267 #[inline]
267268 pub const fn from_ref(r: &T) -> Self {
268269 // SAFETY: A reference cannot be null.
......@@ -270,7 +271,8 @@ impl<T: ?Sized> NonNull<T> {
270271 }
271272
272273 /// Converts a mutable reference to a `NonNull` pointer.
273 #[unstable(feature = "non_null_from_ref", issue = "130823")]
274 #[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
275 #[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
274276 #[inline]
275277 pub const fn from_mut(r: &mut T) -> Self {
276278 // SAFETY: A mutable reference cannot be null.
library/coretests/tests/num/mod.rs+189-143
......@@ -732,157 +732,157 @@ assume_usize_width! {
732732}
733733
734734macro_rules! test_float {
735 ($modname: ident, $fty: ty, $inf: expr, $neginf: expr, $nan: expr, $min: expr, $max: expr, $min_pos: expr, $max_exp:expr) => {
735 ($modname: ident, $fassert: ident, $fty: ty, $inf: expr, $neginf: expr, $nan: expr, $min: expr, $max: expr, $min_pos: expr, $max_exp:expr) => {
736736 mod $modname {
737737 #[test]
738738 fn min() {
739 assert_eq!((0.0 as $fty).min(0.0), 0.0);
740 assert!((0.0 as $fty).min(0.0).is_sign_positive());
741 assert_eq!((-0.0 as $fty).min(-0.0), -0.0);
742 assert!((-0.0 as $fty).min(-0.0).is_sign_negative());
743 assert_eq!((9.0 as $fty).min(9.0), 9.0);
744 assert_eq!((-9.0 as $fty).min(0.0), -9.0);
745 assert_eq!((0.0 as $fty).min(9.0), 0.0);
746 assert!((0.0 as $fty).min(9.0).is_sign_positive());
747 assert_eq!((-0.0 as $fty).min(9.0), -0.0);
748 assert!((-0.0 as $fty).min(9.0).is_sign_negative());
749 assert_eq!((-0.0 as $fty).min(-9.0), -9.0);
750 assert_eq!(($inf as $fty).min(9.0), 9.0);
751 assert_eq!((9.0 as $fty).min($inf), 9.0);
752 assert_eq!(($inf as $fty).min(-9.0), -9.0);
753 assert_eq!((-9.0 as $fty).min($inf), -9.0);
754 assert_eq!(($neginf as $fty).min(9.0), $neginf);
755 assert_eq!((9.0 as $fty).min($neginf), $neginf);
756 assert_eq!(($neginf as $fty).min(-9.0), $neginf);
757 assert_eq!((-9.0 as $fty).min($neginf), $neginf);
758 assert_eq!(($nan as $fty).min(9.0), 9.0);
759 assert_eq!(($nan as $fty).min(-9.0), -9.0);
760 assert_eq!((9.0 as $fty).min($nan), 9.0);
761 assert_eq!((-9.0 as $fty).min($nan), -9.0);
762 assert!(($nan as $fty).min($nan).is_nan());
739 $fassert!((0.0 as $fty).min(0.0), 0.0);
740 $fassert!((0.0 as $fty).min(0.0).is_sign_positive());
741 $fassert!((-0.0 as $fty).min(-0.0), -0.0);
742 $fassert!((-0.0 as $fty).min(-0.0).is_sign_negative());
743 $fassert!((9.0 as $fty).min(9.0), 9.0);
744 $fassert!((-9.0 as $fty).min(0.0), -9.0);
745 $fassert!((0.0 as $fty).min(9.0), 0.0);
746 $fassert!((0.0 as $fty).min(9.0).is_sign_positive());
747 $fassert!((-0.0 as $fty).min(9.0), -0.0);
748 $fassert!((-0.0 as $fty).min(9.0).is_sign_negative());
749 $fassert!((-0.0 as $fty).min(-9.0), -9.0);
750 $fassert!(($inf as $fty).min(9.0), 9.0);
751 $fassert!((9.0 as $fty).min($inf), 9.0);
752 $fassert!(($inf as $fty).min(-9.0), -9.0);
753 $fassert!((-9.0 as $fty).min($inf), -9.0);
754 $fassert!(($neginf as $fty).min(9.0), $neginf);
755 $fassert!((9.0 as $fty).min($neginf), $neginf);
756 $fassert!(($neginf as $fty).min(-9.0), $neginf);
757 $fassert!((-9.0 as $fty).min($neginf), $neginf);
758 $fassert!(($nan as $fty).min(9.0), 9.0);
759 $fassert!(($nan as $fty).min(-9.0), -9.0);
760 $fassert!((9.0 as $fty).min($nan), 9.0);
761 $fassert!((-9.0 as $fty).min($nan), -9.0);
762 $fassert!(($nan as $fty).min($nan).is_nan());
763763 }
764764 #[test]
765765 fn max() {
766 assert_eq!((0.0 as $fty).max(0.0), 0.0);
767 assert!((0.0 as $fty).max(0.0).is_sign_positive());
768 assert_eq!((-0.0 as $fty).max(-0.0), -0.0);
769 assert!((-0.0 as $fty).max(-0.0).is_sign_negative());
770 assert_eq!((9.0 as $fty).max(9.0), 9.0);
771 assert_eq!((-9.0 as $fty).max(0.0), 0.0);
772 assert!((-9.0 as $fty).max(0.0).is_sign_positive());
773 assert_eq!((-9.0 as $fty).max(-0.0), -0.0);
774 assert!((-9.0 as $fty).max(-0.0).is_sign_negative());
775 assert_eq!((0.0 as $fty).max(9.0), 9.0);
776 assert_eq!((0.0 as $fty).max(-9.0), 0.0);
777 assert!((0.0 as $fty).max(-9.0).is_sign_positive());
778 assert_eq!((-0.0 as $fty).max(-9.0), -0.0);
779 assert!((-0.0 as $fty).max(-9.0).is_sign_negative());
780 assert_eq!(($inf as $fty).max(9.0), $inf);
781 assert_eq!((9.0 as $fty).max($inf), $inf);
782 assert_eq!(($inf as $fty).max(-9.0), $inf);
783 assert_eq!((-9.0 as $fty).max($inf), $inf);
784 assert_eq!(($neginf as $fty).max(9.0), 9.0);
785 assert_eq!((9.0 as $fty).max($neginf), 9.0);
786 assert_eq!(($neginf as $fty).max(-9.0), -9.0);
787 assert_eq!((-9.0 as $fty).max($neginf), -9.0);
788 assert_eq!(($nan as $fty).max(9.0), 9.0);
789 assert_eq!(($nan as $fty).max(-9.0), -9.0);
790 assert_eq!((9.0 as $fty).max($nan), 9.0);
791 assert_eq!((-9.0 as $fty).max($nan), -9.0);
792 assert!(($nan as $fty).max($nan).is_nan());
766 $fassert!((0.0 as $fty).max(0.0), 0.0);
767 $fassert!((0.0 as $fty).max(0.0).is_sign_positive());
768 $fassert!((-0.0 as $fty).max(-0.0), -0.0);
769 $fassert!((-0.0 as $fty).max(-0.0).is_sign_negative());
770 $fassert!((9.0 as $fty).max(9.0), 9.0);
771 $fassert!((-9.0 as $fty).max(0.0), 0.0);
772 $fassert!((-9.0 as $fty).max(0.0).is_sign_positive());
773 $fassert!((-9.0 as $fty).max(-0.0), -0.0);
774 $fassert!((-9.0 as $fty).max(-0.0).is_sign_negative());
775 $fassert!((0.0 as $fty).max(9.0), 9.0);
776 $fassert!((0.0 as $fty).max(-9.0), 0.0);
777 $fassert!((0.0 as $fty).max(-9.0).is_sign_positive());
778 $fassert!((-0.0 as $fty).max(-9.0), -0.0);
779 $fassert!((-0.0 as $fty).max(-9.0).is_sign_negative());
780 $fassert!(($inf as $fty).max(9.0), $inf);
781 $fassert!((9.0 as $fty).max($inf), $inf);
782 $fassert!(($inf as $fty).max(-9.0), $inf);
783 $fassert!((-9.0 as $fty).max($inf), $inf);
784 $fassert!(($neginf as $fty).max(9.0), 9.0);
785 $fassert!((9.0 as $fty).max($neginf), 9.0);
786 $fassert!(($neginf as $fty).max(-9.0), -9.0);
787 $fassert!((-9.0 as $fty).max($neginf), -9.0);
788 $fassert!(($nan as $fty).max(9.0), 9.0);
789 $fassert!(($nan as $fty).max(-9.0), -9.0);
790 $fassert!((9.0 as $fty).max($nan), 9.0);
791 $fassert!((-9.0 as $fty).max($nan), -9.0);
792 $fassert!(($nan as $fty).max($nan).is_nan());
793793 }
794794 #[test]
795795 fn minimum() {
796 assert_eq!((0.0 as $fty).minimum(0.0), 0.0);
797 assert!((0.0 as $fty).minimum(0.0).is_sign_positive());
798 assert_eq!((-0.0 as $fty).minimum(0.0), -0.0);
799 assert!((-0.0 as $fty).minimum(0.0).is_sign_negative());
800 assert_eq!((-0.0 as $fty).minimum(-0.0), -0.0);
801 assert!((-0.0 as $fty).minimum(-0.0).is_sign_negative());
802 assert_eq!((9.0 as $fty).minimum(9.0), 9.0);
803 assert_eq!((-9.0 as $fty).minimum(0.0), -9.0);
804 assert_eq!((0.0 as $fty).minimum(9.0), 0.0);
805 assert!((0.0 as $fty).minimum(9.0).is_sign_positive());
806 assert_eq!((-0.0 as $fty).minimum(9.0), -0.0);
807 assert!((-0.0 as $fty).minimum(9.0).is_sign_negative());
808 assert_eq!((-0.0 as $fty).minimum(-9.0), -9.0);
809 assert_eq!(($inf as $fty).minimum(9.0), 9.0);
810 assert_eq!((9.0 as $fty).minimum($inf), 9.0);
811 assert_eq!(($inf as $fty).minimum(-9.0), -9.0);
812 assert_eq!((-9.0 as $fty).minimum($inf), -9.0);
813 assert_eq!(($neginf as $fty).minimum(9.0), $neginf);
814 assert_eq!((9.0 as $fty).minimum($neginf), $neginf);
815 assert_eq!(($neginf as $fty).minimum(-9.0), $neginf);
816 assert_eq!((-9.0 as $fty).minimum($neginf), $neginf);
817 assert!(($nan as $fty).minimum(9.0).is_nan());
818 assert!(($nan as $fty).minimum(-9.0).is_nan());
819 assert!((9.0 as $fty).minimum($nan).is_nan());
820 assert!((-9.0 as $fty).minimum($nan).is_nan());
821 assert!(($nan as $fty).minimum($nan).is_nan());
796 $fassert!((0.0 as $fty).minimum(0.0), 0.0);
797 $fassert!((0.0 as $fty).minimum(0.0).is_sign_positive());
798 $fassert!((-0.0 as $fty).minimum(0.0), -0.0);
799 $fassert!((-0.0 as $fty).minimum(0.0).is_sign_negative());
800 $fassert!((-0.0 as $fty).minimum(-0.0), -0.0);
801 $fassert!((-0.0 as $fty).minimum(-0.0).is_sign_negative());
802 $fassert!((9.0 as $fty).minimum(9.0), 9.0);
803 $fassert!((-9.0 as $fty).minimum(0.0), -9.0);
804 $fassert!((0.0 as $fty).minimum(9.0), 0.0);
805 $fassert!((0.0 as $fty).minimum(9.0).is_sign_positive());
806 $fassert!((-0.0 as $fty).minimum(9.0), -0.0);
807 $fassert!((-0.0 as $fty).minimum(9.0).is_sign_negative());
808 $fassert!((-0.0 as $fty).minimum(-9.0), -9.0);
809 $fassert!(($inf as $fty).minimum(9.0), 9.0);
810 $fassert!((9.0 as $fty).minimum($inf), 9.0);
811 $fassert!(($inf as $fty).minimum(-9.0), -9.0);
812 $fassert!((-9.0 as $fty).minimum($inf), -9.0);
813 $fassert!(($neginf as $fty).minimum(9.0), $neginf);
814 $fassert!((9.0 as $fty).minimum($neginf), $neginf);
815 $fassert!(($neginf as $fty).minimum(-9.0), $neginf);
816 $fassert!((-9.0 as $fty).minimum($neginf), $neginf);
817 $fassert!(($nan as $fty).minimum(9.0).is_nan());
818 $fassert!(($nan as $fty).minimum(-9.0).is_nan());
819 $fassert!((9.0 as $fty).minimum($nan).is_nan());
820 $fassert!((-9.0 as $fty).minimum($nan).is_nan());
821 $fassert!(($nan as $fty).minimum($nan).is_nan());
822822 }
823823 #[test]
824824 fn maximum() {
825 assert_eq!((0.0 as $fty).maximum(0.0), 0.0);
826 assert!((0.0 as $fty).maximum(0.0).is_sign_positive());
827 assert_eq!((-0.0 as $fty).maximum(0.0), 0.0);
828 assert!((-0.0 as $fty).maximum(0.0).is_sign_positive());
829 assert_eq!((-0.0 as $fty).maximum(-0.0), -0.0);
830 assert!((-0.0 as $fty).maximum(-0.0).is_sign_negative());
831 assert_eq!((9.0 as $fty).maximum(9.0), 9.0);
832 assert_eq!((-9.0 as $fty).maximum(0.0), 0.0);
833 assert!((-9.0 as $fty).maximum(0.0).is_sign_positive());
834 assert_eq!((-9.0 as $fty).maximum(-0.0), -0.0);
835 assert!((-9.0 as $fty).maximum(-0.0).is_sign_negative());
836 assert_eq!((0.0 as $fty).maximum(9.0), 9.0);
837 assert_eq!((0.0 as $fty).maximum(-9.0), 0.0);
838 assert!((0.0 as $fty).maximum(-9.0).is_sign_positive());
839 assert_eq!((-0.0 as $fty).maximum(-9.0), -0.0);
840 assert!((-0.0 as $fty).maximum(-9.0).is_sign_negative());
841 assert_eq!(($inf as $fty).maximum(9.0), $inf);
842 assert_eq!((9.0 as $fty).maximum($inf), $inf);
843 assert_eq!(($inf as $fty).maximum(-9.0), $inf);
844 assert_eq!((-9.0 as $fty).maximum($inf), $inf);
845 assert_eq!(($neginf as $fty).maximum(9.0), 9.0);
846 assert_eq!((9.0 as $fty).maximum($neginf), 9.0);
847 assert_eq!(($neginf as $fty).maximum(-9.0), -9.0);
848 assert_eq!((-9.0 as $fty).maximum($neginf), -9.0);
849 assert!(($nan as $fty).maximum(9.0).is_nan());
850 assert!(($nan as $fty).maximum(-9.0).is_nan());
851 assert!((9.0 as $fty).maximum($nan).is_nan());
852 assert!((-9.0 as $fty).maximum($nan).is_nan());
853 assert!(($nan as $fty).maximum($nan).is_nan());
825 $fassert!((0.0 as $fty).maximum(0.0), 0.0);
826 $fassert!((0.0 as $fty).maximum(0.0).is_sign_positive());
827 $fassert!((-0.0 as $fty).maximum(0.0), 0.0);
828 $fassert!((-0.0 as $fty).maximum(0.0).is_sign_positive());
829 $fassert!((-0.0 as $fty).maximum(-0.0), -0.0);
830 $fassert!((-0.0 as $fty).maximum(-0.0).is_sign_negative());
831 $fassert!((9.0 as $fty).maximum(9.0), 9.0);
832 $fassert!((-9.0 as $fty).maximum(0.0), 0.0);
833 $fassert!((-9.0 as $fty).maximum(0.0).is_sign_positive());
834 $fassert!((-9.0 as $fty).maximum(-0.0), -0.0);
835 $fassert!((-9.0 as $fty).maximum(-0.0).is_sign_negative());
836 $fassert!((0.0 as $fty).maximum(9.0), 9.0);
837 $fassert!((0.0 as $fty).maximum(-9.0), 0.0);
838 $fassert!((0.0 as $fty).maximum(-9.0).is_sign_positive());
839 $fassert!((-0.0 as $fty).maximum(-9.0), -0.0);
840 $fassert!((-0.0 as $fty).maximum(-9.0).is_sign_negative());
841 $fassert!(($inf as $fty).maximum(9.0), $inf);
842 $fassert!((9.0 as $fty).maximum($inf), $inf);
843 $fassert!(($inf as $fty).maximum(-9.0), $inf);
844 $fassert!((-9.0 as $fty).maximum($inf), $inf);
845 $fassert!(($neginf as $fty).maximum(9.0), 9.0);
846 $fassert!((9.0 as $fty).maximum($neginf), 9.0);
847 $fassert!(($neginf as $fty).maximum(-9.0), -9.0);
848 $fassert!((-9.0 as $fty).maximum($neginf), -9.0);
849 $fassert!(($nan as $fty).maximum(9.0).is_nan());
850 $fassert!(($nan as $fty).maximum(-9.0).is_nan());
851 $fassert!((9.0 as $fty).maximum($nan).is_nan());
852 $fassert!((-9.0 as $fty).maximum($nan).is_nan());
853 $fassert!(($nan as $fty).maximum($nan).is_nan());
854854 }
855855 #[test]
856856 fn midpoint() {
857 assert_eq!((0.5 as $fty).midpoint(0.5), 0.5);
858 assert_eq!((0.5 as $fty).midpoint(2.5), 1.5);
859 assert_eq!((3.0 as $fty).midpoint(4.0), 3.5);
860 assert_eq!((-3.0 as $fty).midpoint(4.0), 0.5);
861 assert_eq!((3.0 as $fty).midpoint(-4.0), -0.5);
862 assert_eq!((-3.0 as $fty).midpoint(-4.0), -3.5);
863 assert_eq!((0.0 as $fty).midpoint(0.0), 0.0);
864 assert_eq!((-0.0 as $fty).midpoint(-0.0), -0.0);
865 assert_eq!((-5.0 as $fty).midpoint(5.0), 0.0);
866 assert_eq!(($max as $fty).midpoint($min), 0.0);
867 assert_eq!(($min as $fty).midpoint($max), -0.0);
868 assert_eq!(($max as $fty).midpoint($min_pos), $max / 2.);
869 assert_eq!((-$max as $fty).midpoint($min_pos), -$max / 2.);
870 assert_eq!(($max as $fty).midpoint(-$min_pos), $max / 2.);
871 assert_eq!((-$max as $fty).midpoint(-$min_pos), -$max / 2.);
872 assert_eq!(($min_pos as $fty).midpoint($max), $max / 2.);
873 assert_eq!(($min_pos as $fty).midpoint(-$max), -$max / 2.);
874 assert_eq!((-$min_pos as $fty).midpoint($max), $max / 2.);
875 assert_eq!((-$min_pos as $fty).midpoint(-$max), -$max / 2.);
876 assert_eq!(($max as $fty).midpoint($max), $max);
877 assert_eq!(($min_pos as $fty).midpoint($min_pos), $min_pos);
878 assert_eq!((-$min_pos as $fty).midpoint(-$min_pos), -$min_pos);
879 assert_eq!(($max as $fty).midpoint(5.0), $max / 2.0 + 2.5);
880 assert_eq!(($max as $fty).midpoint(-5.0), $max / 2.0 - 2.5);
881 assert_eq!(($inf as $fty).midpoint($inf), $inf);
882 assert_eq!(($neginf as $fty).midpoint($neginf), $neginf);
883 assert!(($nan as $fty).midpoint(1.0).is_nan());
884 assert!((1.0 as $fty).midpoint($nan).is_nan());
885 assert!(($nan as $fty).midpoint($nan).is_nan());
857 $fassert!((0.5 as $fty).midpoint(0.5), 0.5);
858 $fassert!((0.5 as $fty).midpoint(2.5), 1.5);
859 $fassert!((3.0 as $fty).midpoint(4.0), 3.5);
860 $fassert!((-3.0 as $fty).midpoint(4.0), 0.5);
861 $fassert!((3.0 as $fty).midpoint(-4.0), -0.5);
862 $fassert!((-3.0 as $fty).midpoint(-4.0), -3.5);
863 $fassert!((0.0 as $fty).midpoint(0.0), 0.0);
864 $fassert!((-0.0 as $fty).midpoint(-0.0), -0.0);
865 $fassert!((-5.0 as $fty).midpoint(5.0), 0.0);
866 $fassert!(($max as $fty).midpoint($min), 0.0);
867 $fassert!(($min as $fty).midpoint($max), -0.0);
868 $fassert!(($max as $fty).midpoint($min_pos), $max / 2.);
869 $fassert!((-$max as $fty).midpoint($min_pos), -$max / 2.);
870 $fassert!(($max as $fty).midpoint(-$min_pos), $max / 2.);
871 $fassert!((-$max as $fty).midpoint(-$min_pos), -$max / 2.);
872 $fassert!(($min_pos as $fty).midpoint($max), $max / 2.);
873 $fassert!(($min_pos as $fty).midpoint(-$max), -$max / 2.);
874 $fassert!((-$min_pos as $fty).midpoint($max), $max / 2.);
875 $fassert!((-$min_pos as $fty).midpoint(-$max), -$max / 2.);
876 $fassert!(($max as $fty).midpoint($max), $max);
877 $fassert!(($min_pos as $fty).midpoint($min_pos), $min_pos);
878 $fassert!((-$min_pos as $fty).midpoint(-$min_pos), -$min_pos);
879 $fassert!(($max as $fty).midpoint(5.0), $max / 2.0 + 2.5);
880 $fassert!(($max as $fty).midpoint(-5.0), $max / 2.0 - 2.5);
881 $fassert!(($inf as $fty).midpoint($inf), $inf);
882 $fassert!(($neginf as $fty).midpoint($neginf), $neginf);
883 $fassert!(($nan as $fty).midpoint(1.0).is_nan());
884 $fassert!((1.0 as $fty).midpoint($nan).is_nan());
885 $fassert!(($nan as $fty).midpoint($nan).is_nan());
886886
887887 // test if large differences in magnitude are still correctly computed.
888888 // NOTE: that because of how small x and y are, x + y can never overflow
......@@ -907,19 +907,19 @@ macro_rules! test_float {
907907 }
908908 #[test]
909909 fn rem_euclid() {
910 let a: $fty = 42.0;
911 assert!($inf.rem_euclid(a).is_nan());
912 assert_eq!(a.rem_euclid($inf), a);
913 assert!(a.rem_euclid($nan).is_nan());
910 // FIXME: Use $fassert when rem_euclid becomes const
911 assert!($inf.rem_euclid((42.0 as $fty)).is_nan());
912 assert_eq!((42.0 as $fty).rem_euclid($inf), (42.0 as $fty));
913 assert!((42.0 as $fty).rem_euclid($nan).is_nan());
914914 assert!($inf.rem_euclid($inf).is_nan());
915915 assert!($inf.rem_euclid($nan).is_nan());
916916 assert!($nan.rem_euclid($inf).is_nan());
917917 }
918918 #[test]
919919 fn div_euclid() {
920 let a: $fty = 42.0;
921 assert_eq!(a.div_euclid($inf), 0.0);
922 assert!(a.div_euclid($nan).is_nan());
920 // FIXME: Use $fassert when div_euclid becomes const
921 assert_eq!((42.0 as $fty).div_euclid($inf), 0.0);
922 assert!((42.0 as $fty).div_euclid($nan).is_nan());
923923 assert!($inf.div_euclid($inf).is_nan());
924924 assert!($inf.div_euclid($nan).is_nan());
925925 assert!($nan.div_euclid($inf).is_nan());
......@@ -928,8 +928,41 @@ macro_rules! test_float {
928928 };
929929}
930930
931// Custom assert macro that distribute between assert! and assert_eq! in a non-const context
932macro_rules! float_assert {
933 ($b:expr) => {
934 assert!($b);
935 };
936 ($left:expr, $right:expr) => {
937 assert_eq!($left, $right);
938 };
939}
940
941// Custom assert macro that only uses assert! in a const context
942macro_rules! float_const_assert {
943 ($b:expr) => {
944 assert!(const { $b });
945 };
946 ($left:expr, $right:expr) => {
947 assert!(const { $left == $right });
948 };
949}
950
931951test_float!(
932952 f32,
953 float_assert,
954 f32,
955 f32::INFINITY,
956 f32::NEG_INFINITY,
957 f32::NAN,
958 f32::MIN,
959 f32::MAX,
960 f32::MIN_POSITIVE,
961 f32::MAX_EXP
962);
963test_float!(
964 f32_const,
965 float_const_assert,
933966 f32,
934967 f32::INFINITY,
935968 f32::NEG_INFINITY,
......@@ -941,6 +974,19 @@ test_float!(
941974);
942975test_float!(
943976 f64,
977 float_assert,
978 f64,
979 f64::INFINITY,
980 f64::NEG_INFINITY,
981 f64::NAN,
982 f64::MIN,
983 f64::MAX,
984 f64::MIN_POSITIVE,
985 f64::MAX_EXP
986);
987test_float!(
988 f64_const,
989 float_const_assert,
944990 f64,
945991 f64::INFINITY,
946992 f64::NEG_INFINITY,
library/std/src/lib.rs-1
......@@ -305,7 +305,6 @@
305305#![feature(iter_advance_by)]
306306#![feature(iter_next_chunk)]
307307#![feature(lang_items)]
308#![feature(let_chains)]
309308#![feature(link_cfg)]
310309#![feature(linkage)]
311310#![feature(macro_metavar_expr_concat)]
src/doc/rustc-dev-guide/src/notification-groups/rust-for-linux.md+2-2
......@@ -1,9 +1,9 @@
11# Rust for Linux notification group
22
3**Github Label:** [O-rfl] <br>
3**Github Label:** [A-rust-for-linux] <br>
44**Ping command:** `@rustbot ping rfl`
55
6[O-rfl]: https://github.com/rust-lang/rust/labels/O-rfl
6[A-rust-for-linux]: https://github.com/rust-lang/rust/labels/A-rust-for-linux
77
88This list will be used to notify [Rust for Linux (RfL)][rfl] maintainers
99when the compiler or the standard library changes in a way that would
src/doc/rustc/book.toml+2
......@@ -6,6 +6,8 @@ title = "The rustc book"
66[output.html]
77git-repository-url = "https://github.com/rust-lang/rust/tree/master/src/doc/rustc"
88edit-url-template = "https://github.com/rust-lang/rust/edit/master/src/doc/rustc/{path}"
9additional-css = ["theme/pagetoc.css"]
10additional-js = ["theme/pagetoc.js"]
911
1012[output.html.search]
1113use-boolean-and = true
src/doc/rustc/theme/pagetoc.css created+84
......@@ -0,0 +1,84 @@
1/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) */
2
3:root {
4 --toc-width: 270px;
5 --center-content-toc-shift: calc(-1 * var(--toc-width) / 2);
6}
7
8.nav-chapters {
9 /* adjust width of buttons that bring to the previous or the next page */
10 min-width: 50px;
11}
12
13@media only screen {
14 @media (max-width: 1179px) {
15 .sidebar-hidden #sidetoc {
16 display: none;
17 }
18 }
19
20 @media (max-width: 1439px) {
21 .sidebar-visible #sidetoc {
22 display: none;
23 }
24 }
25
26 @media (1180px <= width <= 1439px) {
27 .sidebar-hidden main {
28 position: relative;
29 left: var(--center-content-toc-shift);
30 }
31 }
32
33 @media (1440px <= width <= 1700px) {
34 .sidebar-visible main {
35 position: relative;
36 left: var(--center-content-toc-shift);
37 }
38 }
39
40 #sidetoc {
41 margin-left: calc(100% + 20px);
42 }
43 #pagetoc {
44 position: fixed;
45 /* adjust TOC width */
46 width: var(--toc-width);
47 height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
48 overflow: auto;
49 }
50 #pagetoc a {
51 border-left: 1px solid var(--sidebar-bg);
52 color: var(--sidebar-fg) !important;
53 display: block;
54 padding-bottom: 5px;
55 padding-top: 5px;
56 padding-left: 10px;
57 text-align: left;
58 text-decoration: none;
59 }
60 #pagetoc a:hover,
61 #pagetoc a.active {
62 background: var(--sidebar-bg);
63 color: var(--sidebar-active) !important;
64 }
65 #pagetoc .active {
66 background: var(--sidebar-bg);
67 color: var(--sidebar-active);
68 }
69 #pagetoc .pagetoc-H2 {
70 padding-left: 20px;
71 }
72 #pagetoc .pagetoc-H3 {
73 padding-left: 40px;
74 }
75 #pagetoc .pagetoc-H4 {
76 padding-left: 60px;
77 }
78}
79
80@media print {
81 #sidetoc {
82 display: none;
83 }
84}
src/doc/rustc/theme/pagetoc.js created+104
......@@ -0,0 +1,104 @@
1// Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL)
2
3let activeHref = location.href;
4function updatePageToc(elem = undefined) {
5 let selectedPageTocElem = elem;
6 const pagetoc = document.getElementById("pagetoc");
7
8 function getRect(element) {
9 return element.getBoundingClientRect();
10 }
11
12 function overflowTop(container, element) {
13 return getRect(container).top - getRect(element).top;
14 }
15
16 function overflowBottom(container, element) {
17 return getRect(container).bottom - getRect(element).bottom;
18 }
19
20 // We've not selected a heading to highlight, and the URL needs updating
21 // so we need to find a heading based on the URL
22 if (selectedPageTocElem === undefined && location.href !== activeHref) {
23 activeHref = location.href;
24 for (const pageTocElement of pagetoc.children) {
25 if (pageTocElement.href === activeHref) {
26 selectedPageTocElem = pageTocElement;
27 }
28 }
29 }
30
31 // We still don't have a selected heading, let's try and find the most
32 // suitable heading based on the scroll position
33 if (selectedPageTocElem === undefined) {
34 const margin = window.innerHeight / 3;
35
36 const headers = document.getElementsByClassName("header");
37 for (let i = 0; i < headers.length; i++) {
38 const header = headers[i];
39 if (selectedPageTocElem === undefined && getRect(header).top >= 0) {
40 if (getRect(header).top < margin) {
41 selectedPageTocElem = header;
42 } else {
43 selectedPageTocElem = headers[Math.max(0, i - 1)];
44 }
45 }
46 // a very long last section's heading is over the screen
47 if (selectedPageTocElem === undefined && i === headers.length - 1) {
48 selectedPageTocElem = header;
49 }
50 }
51 }
52
53 // Remove the active flag from all pagetoc elements
54 for (const pageTocElement of pagetoc.children) {
55 pageTocElement.classList.remove("active");
56 }
57
58 // If we have a selected heading, set it to active and scroll to it
59 if (selectedPageTocElem !== undefined) {
60 for (const pageTocElement of pagetoc.children) {
61 if (selectedPageTocElem.href.localeCompare(pageTocElement.href) === 0) {
62 pageTocElement.classList.add("active");
63 if (overflowTop(pagetoc, pageTocElement) > 0) {
64 pagetoc.scrollTop = pageTocElement.offsetTop;
65 }
66 if (overflowBottom(pagetoc, pageTocElement) < 0) {
67 pagetoc.scrollTop -= overflowBottom(pagetoc, pageTocElement);
68 }
69 }
70 }
71 }
72}
73
74if (document.getElementById("sidetoc") === null &&
75 document.getElementsByClassName("header").length > 0) {
76 // The sidetoc element doesn't exist yet, let's create it
77
78 // Create the empty sidetoc and pagetoc elements
79 const sidetoc = document.createElement("div");
80 const pagetoc = document.createElement("div");
81 sidetoc.id = "sidetoc";
82 pagetoc.id = "pagetoc";
83 sidetoc.appendChild(pagetoc);
84
85 // And append them to the current DOM
86 const main = document.querySelector('main');
87 main.insertBefore(sidetoc, main.firstChild);
88
89 // Populate sidebar on load
90 window.addEventListener("load", () => {
91 for (const header of document.getElementsByClassName("header")) {
92 const link = document.createElement("a");
93 link.innerHTML = header.innerHTML;
94 link.href = header.hash;
95 link.classList.add("pagetoc-" + header.parentElement.tagName);
96 document.getElementById("pagetoc").appendChild(link);
97 link.onclick = () => updatePageToc(link);
98 }
99 updatePageToc();
100 });
101
102 // Update page table of contents selected heading on scroll
103 window.addEventListener("scroll", () => updatePageToc());
104}
src/librustdoc/lib.rs-1
......@@ -11,7 +11,6 @@
1111#![feature(if_let_guard)]
1212#![feature(impl_trait_in_assoc_type)]
1313#![feature(iter_intersperse)]
14#![feature(let_chains)]
1514#![feature(never_type)]
1615#![feature(round_char_boundary)]
1716#![feature(test)]
tests/run-make/core-no-oom-handling/rmake.rs+1-1
......@@ -6,7 +6,7 @@ use run_make_support::{rustc, source_root};
66
77fn main() {
88 rustc()
9 .edition("2021")
9 .edition("2024")
1010 .arg("-Dwarnings")
1111 .crate_type("rlib")
1212 .input(source_root().join("library/core/src/lib.rs"))
tests/run-make/llvm-location-discriminator-limit-dummy-span/rmake.rs+7
......@@ -11,6 +11,13 @@
1111//@ needs-dynamic-linking
1212//@ only-nightly (requires unstable rustc flag)
1313
14// This test trips a check in the MSVC linker for an outdated processor:
15// "LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419)"
16// Until MSVC removes this check:
17// https://developercommunity.microsoft.com/t/Remove-checking-for-and-fixing-Cortex-A/10905134
18// we'll need to disable this test on Arm64 Windows.
19//@ ignore-aarch64-pc-windows-msvc
20
1421#![deny(warnings)]
1522
1623use run_make_support::{dynamic_lib_name, rfs, rust_lib_name, rustc};
tests/ui/imports/issue-99695-b.fixed+1-1
......@@ -11,7 +11,7 @@ mod m {
1111 pub struct other_item;
1212 }
1313
14 use ::nu;
14 use crate::nu;
1515pub use self::p::{other_item as _};
1616 //~^ ERROR unresolved import `self::p::nu` [E0432]
1717 //~| HELP a macro with this name exists at the root of the crate
tests/ui/imports/issue-99695-b.stderr+1-1
......@@ -7,7 +7,7 @@ LL | pub use self::p::{nu, other_item as _};
77 = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
88help: a macro with this name exists at the root of the crate
99 |
10LL ~ use ::nu;
10LL ~ use crate::nu;
1111LL ~ pub use self::p::{other_item as _};
1212 |
1313
tests/ui/imports/issue-99695.edition_2015.fixed created+21
......@@ -0,0 +1,21 @@
1//@ run-rustfix
2//@ revisions: edition_2015 edition_2018
3//@ [edition_2015] edition: 2015
4//@ [edition_2018] edition: 2018
5
6#![allow(unused, nonstandard_style)]
7mod m {
8 #[macro_export]
9 macro_rules! nu {
10 {} => {};
11 }
12
13 pub struct other_item;
14
15 use crate::nu;
16pub use self::{other_item as _};
17 //~^ ERROR unresolved import `self::nu` [E0432]
18 //~| HELP a macro with this name exists at the root of the crate
19}
20
21fn main() {}
tests/ui/imports/issue-99695.edition_2015.stderr created+16
......@@ -0,0 +1,16 @@
1error[E0432]: unresolved import `self::nu`
2 --> $DIR/issue-99695.rs:15:20
3 |
4LL | pub use self::{nu, other_item as _};
5 | ^^ no `nu` in `m`
6 |
7 = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
8help: a macro with this name exists at the root of the crate
9 |
10LL ~ use crate::nu;
11LL ~ pub use self::{other_item as _};
12 |
13
14error: aborting due to 1 previous error
15
16For more information about this error, try `rustc --explain E0432`.
tests/ui/imports/issue-99695.edition_2018.fixed created+21
......@@ -0,0 +1,21 @@
1//@ run-rustfix
2//@ revisions: edition_2015 edition_2018
3//@ [edition_2015] edition: 2015
4//@ [edition_2018] edition: 2018
5
6#![allow(unused, nonstandard_style)]
7mod m {
8 #[macro_export]
9 macro_rules! nu {
10 {} => {};
11 }
12
13 pub struct other_item;
14
15 use crate::nu;
16pub use self::{other_item as _};
17 //~^ ERROR unresolved import `self::nu` [E0432]
18 //~| HELP a macro with this name exists at the root of the crate
19}
20
21fn main() {}
tests/ui/imports/issue-99695.edition_2018.stderr created+16
......@@ -0,0 +1,16 @@
1error[E0432]: unresolved import `self::nu`
2 --> $DIR/issue-99695.rs:15:20
3 |
4LL | pub use self::{nu, other_item as _};
5 | ^^ no `nu` in `m`
6 |
7 = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
8help: a macro with this name exists at the root of the crate
9 |
10LL ~ use crate::nu;
11LL ~ pub use self::{other_item as _};
12 |
13
14error: aborting due to 1 previous error
15
16For more information about this error, try `rustc --explain E0432`.
tests/ui/imports/issue-99695.fixed deleted-17
......@@ -1,17 +0,0 @@
1//@ run-rustfix
2#![allow(unused, nonstandard_style)]
3mod m {
4 #[macro_export]
5 macro_rules! nu {
6 {} => {};
7 }
8
9 pub struct other_item;
10
11 use ::nu;
12pub use self::{other_item as _};
13 //~^ ERROR unresolved import `self::nu` [E0432]
14 //~| HELP a macro with this name exists at the root of the crate
15}
16
17fn main() {}
tests/ui/imports/issue-99695.rs+4
......@@ -1,4 +1,8 @@
11//@ run-rustfix
2//@ revisions: edition_2015 edition_2018
3//@ [edition_2015] edition: 2015
4//@ [edition_2018] edition: 2018
5
26#![allow(unused, nonstandard_style)]
37mod m {
48 #[macro_export]
tests/ui/imports/issue-99695.stderr deleted-16
......@@ -1,16 +0,0 @@
1error[E0432]: unresolved import `self::nu`
2 --> $DIR/issue-99695.rs:11:20
3 |
4LL | pub use self::{nu, other_item as _};
5 | ^^ no `nu` in `m`
6 |
7 = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
8help: a macro with this name exists at the root of the crate
9 |
10LL ~ use ::nu;
11LL ~ pub use self::{other_item as _};
12 |
13
14error: aborting due to 1 previous error
15
16For more information about this error, try `rustc --explain E0432`.
triagebot.toml+4-1
......@@ -133,7 +133,7 @@ In case it's useful, here are some [instructions] for tackling these sorts of is
133133
134134[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/rust-for-linux.html
135135"""
136label = "O-rfl"
136label = "A-rust-for-linux"
137137
138138[ping.wasm]
139139alias = ["webassembly"]
......@@ -1424,3 +1424,6 @@ compiletest = [
14241424# Enable `@rustbot note` functionality
14251425# Documentation at: https://forge.rust-lang.org/triagebot/note.html
14261426[note]
1427
1428[behind-upstream]
1429days-threshold = 14