diff --git a/.mailmap b/.mailmap index 9366ef383fc6d..ac221fa3a60e4 100644 --- a/.mailmap +++ b/.mailmap @@ -129,6 +129,7 @@ Jakub Adam Wieczorek Jakub Adam Wieczorek Jakub Adam Wieczorek James Deng +James Hinshelwood James Miller James Perry Jason Fager diff --git a/RELEASES.md b/RELEASES.md index fc0a5d35f30f3..460c78b14d138 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -95,19 +95,14 @@ and related tools. [87467]: https://github.com/rust-lang/rust/pull/87467/ [87704]: https://github.com/rust-lang/rust/pull/87704/ [88041]: https://github.com/rust-lang/rust/pull/88041/ -[88300]: https://github.com/rust-lang/rust/pull/88300/ [88447]: https://github.com/rust-lang/rust/pull/88447/ [88601]: https://github.com/rust-lang/rust/pull/88601/ -[88624]: https://github.com/rust-lang/rust/pull/88624/ [89062]: https://github.com/rust-lang/rust/pull/89062/ [89174]: https://github.com/rust-lang/rust/pull/89174/ -[89542]: https://github.com/rust-lang/rust/pull/89542/ [89551]: https://github.com/rust-lang/rust/pull/89551/ [89558]: https://github.com/rust-lang/rust/pull/89558/ [89580]: https://github.com/rust-lang/rust/pull/89580/ [89652]: https://github.com/rust-lang/rust/pull/89652/ -[89677]: https://github.com/rust-lang/rust/pull/89677/ -[89951]: https://github.com/rust-lang/rust/pull/89951/ [90041]: https://github.com/rust-lang/rust/pull/90041/ [90058]: https://github.com/rust-lang/rust/pull/90058/ [90104]: https://github.com/rust-lang/rust/pull/90104/ @@ -123,11 +118,9 @@ and related tools. [90733]: https://github.com/rust-lang/rust/pull/90733/ [90833]: https://github.com/rust-lang/rust/pull/90833/ [90846]: https://github.com/rust-lang/rust/pull/90846/ -[90896]: https://github.com/rust-lang/rust/pull/90896/ [91026]: https://github.com/rust-lang/rust/pull/91026/ [91207]: https://github.com/rust-lang/rust/pull/91207/ [91255]: https://github.com/rust-lang/rust/pull/91255/ -[91301]: https://github.com/rust-lang/rust/pull/91301/ [cargo/10082]: https://github.com/rust-lang/cargo/pull/10082/ [cargo/10107]: https://github.com/rust-lang/cargo/pull/10107/ [`Metadata::is_symlink`]: https://doc.rust-lang.org/stable/std/fs/struct.Metadata.html#method.is_symlink @@ -137,28 +130,7 @@ and related tools. [`Result::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_unchecked [`Result::unwrap_err_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_err_unchecked [`File::options`]: https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.options -[`unix::process::ExitStatusExt::core_dumped`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.core_dumped -[`unix::process::ExitStatusExt::stopped_signal`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.stopped_signal -[`unix::process::ExitStatusExt::continued`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.continued -[`unix::process::ExitStatusExt::into_raw`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.into_raw [`Duration::new`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.new -[`Duration::checked_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_add -[`Duration::saturating_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_add -[`Duration::checked_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_sub -[`Duration::saturating_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_sub -[`Duration::checked_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_mul -[`Duration::saturating_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_mul -[`Duration::checked_div`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_div -[`Duration::as_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f64 -[`Duration::as_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f32 -[`Duration::from_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f64 -[`Duration::from_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f32 -[`Duration::mul_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f64 -[`Duration::mul_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f32 -[`Duration::div_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f64 -[`Duration::div_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f32 -[`Duration::div_duration_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f64 -[`Duration::div_duration_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f32 Version 1.57.0 (2021-12-02) ========================== @@ -240,7 +212,6 @@ and related tools. [86191]: https://github.com/rust-lang/rust/pull/86191/ [87220]: https://github.com/rust-lang/rust/pull/87220/ [87260]: https://github.com/rust-lang/rust/pull/87260/ -[88243]: https://github.com/rust-lang/rust/pull/88243/ [88321]: https://github.com/rust-lang/rust/pull/88321/ [88529]: https://github.com/rust-lang/rust/pull/88529/ [88690]: https://github.com/rust-lang/rust/pull/88690/ @@ -396,8 +367,6 @@ and related tools. as well as rustdoc. [`std::os::unix::fs::chroot`]: https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chroot.html -[`Iterator::intersperse`]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.intersperse -[`Iterator::intersperse_with`]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.intersperse [`UnsafeCell::raw_get`]: https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html#method.raw_get [`BufWriter::into_parts`]: https://doc.rust-lang.org/stable/std/io/struct.BufWriter.html#method.into_parts [`core::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}`]: https://github.com/rust-lang/rust/pull/84662 @@ -419,12 +388,7 @@ and related tools. [rust#86183]: https://github.com/rust-lang/rust/pull/86183 [rust#87385]: https://github.com/rust-lang/rust/pull/87385 [rust#88100]: https://github.com/rust-lang/rust/pull/88100 -[rust#86860]: https://github.com/rust-lang/rust/pull/86860 -[rust#84039]: https://github.com/rust-lang/rust/pull/84039 -[rust#86492]: https://github.com/rust-lang/rust/pull/86492 -[rust#88363]: https://github.com/rust-lang/rust/pull/88363 [rust#85305]: https://github.com/rust-lang/rust/pull/85305 -[rust#87832]: https://github.com/rust-lang/rust/pull/87832 [rust#88069]: https://github.com/rust-lang/rust/pull/88069 [rust#87472]: https://github.com/rust-lang/rust/pull/87472 [rust#87699]: https://github.com/rust-lang/rust/pull/87699 @@ -435,31 +399,12 @@ and related tools. [rust#87580]: https://github.com/rust-lang/rust/pull/87580 [rust#83342]: https://github.com/rust-lang/rust/pull/83342 [rust#83093]: https://github.com/rust-lang/rust/pull/83093 -[rust#88177]: https://github.com/rust-lang/rust/pull/88177 -[rust#88548]: https://github.com/rust-lang/rust/pull/88548 -[rust#88551]: https://github.com/rust-lang/rust/pull/88551 -[rust#88299]: https://github.com/rust-lang/rust/pull/88299 -[rust#88220]: https://github.com/rust-lang/rust/pull/88220 [rust#85835]: https://github.com/rust-lang/rust/pull/85835 -[rust#86879]: https://github.com/rust-lang/rust/pull/86879 [rust#86744]: https://github.com/rust-lang/rust/pull/86744 -[rust#84662]: https://github.com/rust-lang/rust/pull/84662 -[rust#86593]: https://github.com/rust-lang/rust/pull/86593 -[rust#81050]: https://github.com/rust-lang/rust/pull/81050 [rust#81363]: https://github.com/rust-lang/rust/pull/81363 [rust#84111]: https://github.com/rust-lang/rust/pull/84111 [rust#85769]: https://github.com/rust-lang/rust/pull/85769#issuecomment-854363720 -[rust#88490]: https://github.com/rust-lang/rust/pull/88490 -[rust#88269]: https://github.com/rust-lang/rust/pull/88269 -[rust#84176]: https://github.com/rust-lang/rust/pull/84176 [rust#88399]: https://github.com/rust-lang/rust/pull/88399 -[rust#88227]: https://github.com/rust-lang/rust/pull/88227 -[rust#88200]: https://github.com/rust-lang/rust/pull/88200 -[rust#82776]: https://github.com/rust-lang/rust/pull/82776 -[rust#88077]: https://github.com/rust-lang/rust/pull/88077 -[rust#87728]: https://github.com/rust-lang/rust/pull/87728 -[rust#87050]: https://github.com/rust-lang/rust/pull/87050 -[rust#87619]: https://github.com/rust-lang/rust/pull/87619 [rust#81825]: https://github.com/rust-lang/rust/pull/81825#issuecomment-808406918 [rust#88019]: https://github.com/rust-lang/rust/pull/88019 [rust#87666]: https://github.com/rust-lang/rust/pull/87666 @@ -565,20 +510,14 @@ Compatibility Notes [86294]: https://github.com/rust-lang/rust/pull/86294 [86858]: https://github.com/rust-lang/rust/pull/86858 [86761]: https://github.com/rust-lang/rust/pull/86761 -[85769]: https://github.com/rust-lang/rust/pull/85769 [85746]: https://github.com/rust-lang/rust/pull/85746 -[85305]: https://github.com/rust-lang/rust/pull/85305 [85270]: https://github.com/rust-lang/rust/pull/85270 -[84111]: https://github.com/rust-lang/rust/pull/84111 [83918]: https://github.com/rust-lang/rust/pull/83918 [79965]: https://github.com/rust-lang/rust/pull/79965 -[87370]: https://github.com/rust-lang/rust/pull/87370 -[87298]: https://github.com/rust-lang/rust/pull/87298 [cargo/9663]: https://github.com/rust-lang/cargo/pull/9663 [cargo/9675]: https://github.com/rust-lang/cargo/pull/9675 [cargo/9550]: https://github.com/rust-lang/cargo/pull/9550 [cargo/9680]: https://github.com/rust-lang/cargo/pull/9680 -[cargo/9663]: https://github.com/rust-lang/cargo/pull/9663 [`array::map`]: https://doc.rust-lang.org/stable/std/primitive.array.html#method.map [`Bound::cloned`]: https://doc.rust-lang.org/stable/std/ops/enum.Bound.html#method.cloned [`Drain::as_str`]: https://doc.rust-lang.org/stable/std/string/struct.Drain.html#method.as_str @@ -587,7 +526,6 @@ Compatibility Notes [`MaybeUninit::assume_init_mut`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_mut [`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref [`MaybeUninit::write`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write -[`Seek::rewind`]: https://doc.rust-lang.org/stable/std/io/trait.Seek.html#method.rewind [`ops::ControlFlow`]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html [`str::from_utf8_unchecked`]: https://doc.rust-lang.org/stable/std/str/fn.from_utf8_unchecked.html [`x86::_bittest`]: https://doc.rust-lang.org/stable/core/arch/x86/fn._bittest.html @@ -691,7 +629,6 @@ Compatibility Notes [85574]: https://github.com/rust-lang/rust/issues/85574 [86831]: https://github.com/rust-lang/rust/issues/86831 [86063]: https://github.com/rust-lang/rust/issues/86063 -[86831]: https://github.com/rust-lang/rust/issues/86831 [79608]: https://github.com/rust-lang/rust/pull/79608 [84988]: https://github.com/rust-lang/rust/pull/84988 [84701]: https://github.com/rust-lang/rust/pull/84701 @@ -893,7 +830,6 @@ related tools. [`Ordering::is_le`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_le [`Ordering::is_lt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_lt [`Ordering::is_ne`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ne -[`OsStr::eq_ignore_ascii_case`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.eq_ignore_ascii_case [`OsStr::is_ascii`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.is_ascii [`OsStr::make_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_lowercase [`OsStr::make_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_uppercase @@ -1224,7 +1160,6 @@ Internal Only [80053]: https://github.com/rust-lang/rust/pull/80053 [79502]: https://github.com/rust-lang/rust/pull/79502 [75180]: https://github.com/rust-lang/rust/pull/75180 -[79135]: https://github.com/rust-lang/rust/pull/79135 [81521]: https://github.com/rust-lang/rust/pull/81521 [80968]: https://github.com/rust-lang/rust/pull/80968 [80959]: https://github.com/rust-lang/rust/pull/80959 @@ -1538,7 +1473,6 @@ related tools. [`slice::select_nth_unstable`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable [`slice::select_nth_unstable_by`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by [`slice::select_nth_unstable_by_key`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by_key -[`hint::spin_loop`]: https://doc.rust-lang.org/stable/std/hint/fn.spin_loop.html [`Poll::is_ready`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_ready [`Poll::is_pending`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_pending [rustdoc-ws-post]: https://blog.guillaume-gomez.fr/articles/2020-11-11+New+doc+comment+handling+in+rustdoc @@ -1785,8 +1719,6 @@ Internal Only [74869]: https://github.com/rust-lang/rust/pull/74869/ [73858]: https://github.com/rust-lang/rust/pull/73858/ [75716]: https://github.com/rust-lang/rust/pull/75716/ -[75908]: https://github.com/rust-lang/rust/pull/75908/ -[75516]: https://github.com/rust-lang/rust/pull/75516/ [75560]: https://github.com/rust-lang/rust/pull/75560/ [75568]: https://github.com/rust-lang/rust/pull/75568/ [75366]: https://github.com/rust-lang/rust/pull/75366/ @@ -1801,7 +1733,6 @@ Internal Only [73583]: https://github.com/rust-lang/rust/pull/73583/ [73084]: https://github.com/rust-lang/rust/pull/73084/ [73197]: https://github.com/rust-lang/rust/pull/73197/ -[72488]: https://github.com/rust-lang/rust/pull/72488/ [cargo/8456]: https://github.com/rust-lang/cargo/pull/8456/ [cargo/8478]: https://github.com/rust-lang/cargo/pull/8478/ [cargo/8485]: https://github.com/rust-lang/cargo/pull/8485/ @@ -1812,7 +1743,6 @@ Internal Only [`RangeInclusive::is_empty`]: https://doc.rust-lang.org/nightly/std/ops/struct.RangeInclusive.html#method.is_empty [`Result::as_deref_mut`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref_mut [`Result::as_deref`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref -[`TypeId::of`]: https://doc.rust-lang.org/nightly/std/any/struct.TypeId.html#method.of [`Vec::leak`]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.leak [`f32::TAU`]: https://doc.rust-lang.org/nightly/std/f32/consts/constant.TAU.html [`f64::TAU`]: https://doc.rust-lang.org/nightly/std/f64/consts/constant.TAU.html @@ -2796,7 +2726,6 @@ Compatibility Notes [63803]: https://github.com/rust-lang/rust/pull/63803/ [cargo/7450]: https://github.com/rust-lang/cargo/pull/7450/ [cargo/7507]: https://github.com/rust-lang/cargo/pull/7507/ -[cargo/7525]: https://github.com/rust-lang/cargo/pull/7525/ [cargo/7333]: https://github.com/rust-lang/cargo/pull/7333/ [(rfc 2008)]: https://rust-lang.github.io/rfcs/2008-non-exhaustive.html [`f32::to_be_bytes`]: https://doc.rust-lang.org/std/primitive.f32.html#method.to_be_bytes @@ -2929,13 +2858,6 @@ Compatibility Notes [63786]: https://github.com/rust-lang/rust/pull/63786/ [63827]: https://github.com/rust-lang/rust/pull/63827/ [63834]: https://github.com/rust-lang/rust/pull/63834/ -[63927]: https://github.com/rust-lang/rust/pull/63927/ -[63933]: https://github.com/rust-lang/rust/pull/63933/ -[63934]: https://github.com/rust-lang/rust/pull/63934/ -[63938]: https://github.com/rust-lang/rust/pull/63938/ -[63940]: https://github.com/rust-lang/rust/pull/63940/ -[63941]: https://github.com/rust-lang/rust/pull/63941/ -[63945]: https://github.com/rust-lang/rust/pull/63945/ [64010]: https://github.com/rust-lang/rust/pull/64010/ [64028]: https://github.com/rust-lang/rust/pull/64028/ [64334]: https://github.com/rust-lang/rust/pull/64334/ @@ -3164,7 +3086,6 @@ Compatibility Notes [`Cell::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells [`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back [`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor -[`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded [`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits [`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits [`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits @@ -3663,7 +3584,6 @@ Compatibility Notes - [Libtest no longer creates a new thread for each test when `--test-threads=1`. It also runs the tests in deterministic order][56243] -[55982]: https://github.com/rust-lang/rust/pull/55982/ [56243]: https://github.com/rust-lang/rust/pull/56243 [56303]: https://github.com/rust-lang/rust/pull/56303/ [56351]: https://github.com/rust-lang/rust/pull/56351/ @@ -4063,7 +3983,6 @@ Cargo [52813]: https://github.com/rust-lang/rust/pull/52813/ [53218]: https://github.com/rust-lang/rust/pull/53218/ -[53555]: https://github.com/rust-lang/rust/issues/53555/ [54057]: https://github.com/rust-lang/rust/pull/54057/ [54240]: https://github.com/rust-lang/rust/pull/54240/ [54430]: https://github.com/rust-lang/rust/pull/54430/ @@ -4185,7 +4104,6 @@ Misc [53044]: https://github.com/rust-lang/rust/pull/53044/ [53165]: https://github.com/rust-lang/rust/pull/53165/ [53611]: https://github.com/rust-lang/rust/pull/53611/ -[53213]: https://github.com/rust-lang/rust/pull/53213/ [53236]: https://github.com/rust-lang/rust/pull/53236/ [53272]: https://github.com/rust-lang/rust/pull/53272/ [53370]: https://github.com/rust-lang/rust/pull/53370/ @@ -4193,7 +4111,6 @@ Misc [53774]: https://github.com/rust-lang/rust/pull/53774/ [53822]: https://github.com/rust-lang/rust/pull/53822/ [54057]: https://github.com/rust-lang/rust/pull/54057/ -[54146]: https://github.com/rust-lang/rust/pull/54146/ [54404]: https://github.com/rust-lang/rust/pull/54404/ [cargo/5877]: https://github.com/rust-lang/cargo/pull/5877/ [cargo/5878]: https://github.com/rust-lang/cargo/pull/5878/ @@ -4301,12 +4218,10 @@ Compatibility Notes [52330]: https://github.com/rust-lang/rust/pull/52330/ [52354]: https://github.com/rust-lang/rust/pull/52354/ [52402]: https://github.com/rust-lang/rust/pull/52402/ -[52103]: https://github.com/rust-lang/rust/pull/52103/ [52197]: https://github.com/rust-lang/rust/pull/52197/ [51807]: https://github.com/rust-lang/rust/pull/51807/ [51899]: https://github.com/rust-lang/rust/pull/51899/ [51912]: https://github.com/rust-lang/rust/pull/51912/ -[51511]: https://github.com/rust-lang/rust/pull/51511/ [51619]: https://github.com/rust-lang/rust/pull/51619/ [51656]: https://github.com/rust-lang/rust/pull/51656/ [51178]: https://github.com/rust-lang/rust/pull/51178/ @@ -4446,7 +4361,6 @@ Compatibility Notes [50855]: https://github.com/rust-lang/rust/pull/50855/ [51050]: https://github.com/rust-lang/rust/pull/51050/ [51196]: https://github.com/rust-lang/rust/pull/51196/ -[51200]: https://github.com/rust-lang/rust/pull/51200/ [51241]: https://github.com/rust-lang/rust/pull/51241/ [51276]: https://github.com/rust-lang/rust/pull/51276/ [51298]: https://github.com/rust-lang/rust/pull/51298/ @@ -4627,15 +4541,12 @@ Compatibility Notes [49664]: https://github.com/rust-lang/rust/pull/49664/ [49699]: https://github.com/rust-lang/rust/pull/49699/ [49707]: https://github.com/rust-lang/rust/pull/49707/ -[49719]: https://github.com/rust-lang/rust/pull/49719/ [49896]: https://github.com/rust-lang/rust/pull/49896/ [49968]: https://github.com/rust-lang/rust/pull/49968/ [50163]: https://github.com/rust-lang/rust/pull/50163 [50177]: https://github.com/rust-lang/rust/pull/50177/ [50378]: https://github.com/rust-lang/rust/pull/50378/ -[50398]: https://github.com/rust-lang/rust/pull/50398/ [50423]: https://github.com/rust-lang/rust/pull/50423/ -[cargo/5203]: https://github.com/rust-lang/cargo/pull/5203/ [cargo/5335]: https://github.com/rust-lang/cargo/pull/5335/ [cargo/5359]: https://github.com/rust-lang/cargo/pull/5359/ [cargo/5360]: https://github.com/rust-lang/cargo/pull/5360/ @@ -4837,7 +4748,6 @@ Compatibility Notes [47813]: https://github.com/rust-lang/rust/pull/47813 [48056]: https://github.com/rust-lang/rust/pull/48056 [48125]: https://github.com/rust-lang/rust/pull/48125 -[48166]: https://github.com/rust-lang/rust/pull/48166 [48235]: https://github.com/rust-lang/rust/pull/48235 [48274]: https://github.com/rust-lang/rust/pull/48274 [48281]: https://github.com/rust-lang/rust/pull/48281 @@ -4854,10 +4764,7 @@ Compatibility Notes [48978]: https://github.com/rust-lang/rust/pull/48978 [49101]: https://github.com/rust-lang/rust/pull/49101 [49109]: https://github.com/rust-lang/rust/pull/49109 -[49121]: https://github.com/rust-lang/rust/pull/49121 [49162]: https://github.com/rust-lang/rust/pull/49162 -[49184]: https://github.com/rust-lang/rust/pull/49184 -[49234]: https://github.com/rust-lang/rust/pull/49234 [49255]: https://github.com/rust-lang/rust/pull/49255 [49299]: https://github.com/rust-lang/rust/pull/49299 [49305]: https://github.com/rust-lang/rust/pull/49305 @@ -5104,7 +5011,6 @@ Compatibility Notes [44884]: https://github.com/rust-lang/rust/pull/44884 [45198]: https://github.com/rust-lang/rust/pull/45198 [45506]: https://github.com/rust-lang/rust/pull/45506 -[45904]: https://github.com/rust-lang/rust/pull/45904 [45990]: https://github.com/rust-lang/rust/pull/45990 [46012]: https://github.com/rust-lang/rust/pull/46012 [46077]: https://github.com/rust-lang/rust/pull/46077 @@ -5116,7 +5022,6 @@ Compatibility Notes [46671]: https://github.com/rust-lang/rust/pull/46671 [46713]: https://github.com/rust-lang/rust/pull/46713 [46735]: https://github.com/rust-lang/rust/pull/46735 -[46749]: https://github.com/rust-lang/rust/pull/46749 [46760]: https://github.com/rust-lang/rust/pull/46760 [46798]: https://github.com/rust-lang/rust/pull/46798 [46828]: https://github.com/rust-lang/rust/pull/46828 @@ -5287,7 +5192,6 @@ Compatibility Notes [42526]: https://github.com/rust-lang/rust/pull/42526 -[43017]: https://github.com/rust-lang/rust/pull/43017 [43716]: https://github.com/rust-lang/rust/pull/43716 [43949]: https://github.com/rust-lang/rust/pull/43949 [44015]: https://github.com/rust-lang/rust/pull/44015 @@ -5517,8 +5421,6 @@ Cargo - [Added `--no-fail-fast` flag to cargo to run all benchmarks regardless of failure.][cargo/4248] - [Changed the convention around which file is the crate root.][cargo/4259] -- [The `include`/`exclude` property in `Cargo.toml` now accepts gitignore paths - instead of glob patterns][cargo/4270]. Glob patterns are now deprecated. Compatibility Notes ------------------- @@ -5561,7 +5463,6 @@ Compatibility Notes [cargo/4229]: https://github.com/rust-lang/cargo/pull/4229 [cargo/4248]: https://github.com/rust-lang/cargo/pull/4248 [cargo/4259]: https://github.com/rust-lang/cargo/pull/4259 -[cargo/4270]: https://github.com/rust-lang/cargo/pull/4270 [`CStr::into_c_string`]: https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.into_c_string [`CString::as_c_str`]: https://doc.rust-lang.org/std/ffi/struct.CString.html#method.as_c_str [`CString::into_boxed_c_str`]: https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str @@ -5854,7 +5755,6 @@ Misc ---- - [rustdoc can now use pulldown-cmark with the `--enable-commonmark` flag][40338] -- [Added rust-windbg script for better debugging on Windows][39983] - [Rust now uses the official cross compiler for NetBSD][40612] - [rustdoc now accepts `#` at the start of files][40828] - [Fixed jemalloc support for musl][41168] @@ -5889,7 +5789,6 @@ Compatibility Notes [38165]: https://github.com/rust-lang/rust/pull/38165 [39799]: https://github.com/rust-lang/rust/pull/39799 [39891]: https://github.com/rust-lang/rust/pull/39891 -[39983]: https://github.com/rust-lang/rust/pull/39983 [40043]: https://github.com/rust-lang/rust/pull/40043 [40241]: https://github.com/rust-lang/rust/pull/40241 [40338]: https://github.com/rust-lang/rust/pull/40338 @@ -6185,7 +6084,6 @@ Compatibility Notes [cargo/3691]: https://github.com/rust-lang/cargo/pull/3691 [cargo/3699]: https://github.com/rust-lang/cargo/pull/3699 [cargo/3731]: https://github.com/rust-lang/cargo/pull/3731 -[mdbook]: https://crates.io/crates/mdbook [ubook]: https://doc.rust-lang.org/unstable-book/ @@ -6256,7 +6154,7 @@ Libraries * [Ctrl-Z returns from `Stdin.read()` when reading from the console on Windows][38274] * [std: Fix partial writes in `LineWriter`][38062] -* [std: Clamp max read/write sizes on Unix][38062] +* [std: Clamp max read/write sizes on Unix][38622] * [Use more specific panic message for `&str` slicing errors][38066] * [`TcpListener::set_only_v6` is deprecated][38304]. This functionality cannot be achieved in std currently. @@ -6322,7 +6220,7 @@ Compatibility Notes [38006]: https://github.com/rust-lang/rust/pull/38006 [38051]: https://github.com/rust-lang/rust/pull/38051 [38062]: https://github.com/rust-lang/rust/pull/38062 -[38062]: https://github.com/rust-lang/rust/pull/38622 +[38622]: https://github.com/rust-lang/rust/pull/38622 [38066]: https://github.com/rust-lang/rust/pull/38066 [38069]: https://github.com/rust-lang/rust/pull/38069 [38131]: https://github.com/rust-lang/rust/pull/38131 @@ -6330,7 +6228,6 @@ Compatibility Notes [38274]: https://github.com/rust-lang/rust/pull/38274 [38304]: https://github.com/rust-lang/rust/pull/38304 [38313]: https://github.com/rust-lang/rust/pull/38313 -[38314]: https://github.com/rust-lang/rust/pull/38314 [38327]: https://github.com/rust-lang/rust/pull/38327 [38401]: https://github.com/rust-lang/rust/pull/38401 [38413]: https://github.com/rust-lang/rust/pull/38413 @@ -6380,7 +6277,6 @@ Compatibility Notes [cargo/3546]: https://github.com/rust-lang/cargo/pull/3546 [cargo/3557]: https://github.com/rust-lang/cargo/pull/3557 [cargo/3604]: https://github.com/rust-lang/cargo/pull/3604 -[RFC 1623]: https://github.com/rust-lang/rfcs/blob/master/text/1623-static.md Version 1.15.1 (2017-02-09) @@ -6595,7 +6491,6 @@ Compatibility Notes [38192]: https://github.com/rust-lang/rust/pull/38192 [38279]: https://github.com/rust-lang/rust/pull/38279 [38835]: https://github.com/rust-lang/rust/pull/38835 -[RFC 1492]: https://github.com/rust-lang/rfcs/blob/master/text/1492-dotdot-in-patterns.md [RFC 1506]: https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md [RFC 1560]: https://github.com/rust-lang/rfcs/blob/master/text/1560-name-resolution.md [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md @@ -6784,7 +6679,6 @@ Compatibility Notes [1.14wasm]: https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 [36430]: https://github.com/rust-lang/rust/pull/36430 [36595]: https://github.com/rust-lang/rust/pull/36595 -[36595]: https://github.com/rust-lang/rust/pull/36595 [36692]: https://github.com/rust-lang/rust/pull/36692 [36767]: https://github.com/rust-lang/rust/pull/36767 [36794]: https://github.com/rust-lang/rust/pull/36794 @@ -7012,7 +6906,6 @@ Compatibility Notes [34623]: https://github.com/rust-lang/rust/pull/34623 [34923]: https://github.com/rust-lang/rust/pull/34923 [34942]: https://github.com/rust-lang/rust/pull/34942 -[34982]: https://github.com/rust-lang/rust/pull/34982 [35021]: https://github.com/rust-lang/rust/pull/35021 [35048]: https://github.com/rust-lang/rust/pull/35048 [35074]: https://github.com/rust-lang/rust/pull/35074 @@ -7069,7 +6962,6 @@ Compatibility Notes [36586]: https://github.com/rust-lang/rust/pull/36586 [36592]: https://github.com/rust-lang/rust/pull/36592 [36631]: https://github.com/rust-lang/rust/pull/36631 -[36639]: https://github.com/rust-lang/rust/pull/36639 [36721]: https://github.com/rust-lang/rust/pull/36721 [36727]: https://github.com/rust-lang/rust/pull/36727 [36730]: https://github.com/rust-lang/rust/pull/36730 @@ -7101,7 +6993,6 @@ Compatibility Notes [cargo/3205]: https://github.com/rust-lang/cargo/pull/3205 [cargo/3241]: https://github.com/rust-lang/cargo/pull/3241 [cargo/3242]: https://github.com/rust-lang/cargo/pull/3242 -[rustup]: https://www.rustup.rs [`checked_abs`]: https://doc.rust-lang.org/std/primitive.i32.html#method.checked_abs [`wrapping_abs`]: https://doc.rust-lang.org/std/primitive.i32.html#method.wrapping_abs [`overflowing_abs`]: https://doc.rust-lang.org/std/primitive.i32.html#method.overflowing_abs @@ -8019,7 +7910,7 @@ Cargo targets can be specified together. [RFC 1361]. * [The environment variables `CARGO_TARGET_ROOT`, `RUSTC`, and `RUSTDOC` take precedence over the `build.target-dir`, - `build.rustc`, and `build.rustdoc` configuration values][1.8cv]. + `build.rustc`, and `build.rustdoc` configuration values][1.8cfv]. * [The child process tree is killed on Windows when Cargo is killed][1.8ck]. * [The `build.target` configuration value sets the target platform, @@ -8069,7 +7960,7 @@ Compatibility Notes [1.8ck]: https://github.com/rust-lang/cargo/pull/2370 [1.8ct]: https://github.com/rust-lang/cargo/pull/2335 [1.8cu]: https://github.com/rust-lang/rust/pull/31390 -[1.8cv]: https://github.com/rust-lang/cargo/issues/2365 +[1.8cfv]: https://github.com/rust-lang/cargo/issues/2365 [1.8cv]: https://github.com/rust-lang/rust/pull/30998 [1.8h]: https://github.com/rust-lang/rust/pull/31460 [1.8l]: https://github.com/rust-lang/rust/pull/31668 @@ -8992,13 +8883,13 @@ Misc * The compiler gained many new extended error descriptions, which can be accessed with the `--explain` flag. * The `dropck` pass, which checks that destructors can't access - destroyed values, [has been rewritten][dropck]. This fixes some + destroyed values, [has been rewritten][27261]. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build. * `rustc` now uses [LLVM to write archive files where possible][ar]. Eventually this will eliminate the compiler's dependency on the ar utility. -* Rust has [preliminary support for i686 FreeBSD][fb] (it has long +* Rust has [preliminary support for i686 FreeBSD][26959] (it has long supported FreeBSD on x86_64). * The [`unused_mut`][lum], [`unconditional_recursion`][lur], [`improper_ctypes`][lic], and [`negate_unsigned`][lnu] lints are @@ -9037,7 +8928,7 @@ Misc [ar]: https://github.com/rust-lang/rust/pull/26926 [b14]: https://static.rust-lang.org/dist/rust-beta-x86_64-pc-windows-msvc.msi [dms]: https://github.com/rust-lang/rust/pull/26241 -[dropck]: https://github.com/rust-lang/rust/pull/27261 +[27261]: https://github.com/rust-lang/rust/pull/27261 [dropckrfc]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md [ds]: https://github.com/rust-lang/rust/pull/26818 [dst1]: http://doc.rust-lang.org/nightly/std/mem/fn.size_of_val.html @@ -9045,9 +8936,8 @@ Misc [dst3]: https://github.com/rust-lang/rust/pull/27351 [e]: https://github.com/rust-lang/rust/pull/24793 [f]: https://github.com/rust-lang/rust/pull/26588 -[fb]: https://github.com/rust-lang/rust/pull/26959 +[26959]: https://github.com/rust-lang/rust/pull/26959 [fl]: https://github.com/rust-lang/rust-installer/pull/41 -[hs]: http://doc.rust-lang.org/nightly/std/hash/trait.Hash.html#method.hash_slice [ie]: http://doc.rust-lang.org/nightly/std/io/struct.Error.html [iec]: http://doc.rust-lang.org/nightly/std/io/struct.Error.html#method.cause [iegm]: http://doc.rust-lang.org/nightly/std/io/struct.Error.html#method.get_mut @@ -9318,7 +9208,7 @@ Misc to rustc. * [Android executables are always position independent][pie]. * [The `drop_with_repr_extern` lint warns about mixing `repr(C)` - with `Drop`][drop]. + with `Drop`][24935]. [`str::split_whitespace`]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_whitespace [`FromRawFd`]: https://doc.rust-lang.org/nightly/std/os/unix/io/trait.FromRawFd.html @@ -9348,7 +9238,7 @@ Misc [`BinaryHeap`]: https://doc.rust-lang.org/nightly/std/collections/struct.BinaryHeap.html [ll]: https://github.com/rust-lang/rust/pull/26022 [`split_off`]: https://doc.rust-lang.org/nightly/collections/linked_list/struct.LinkedList.html#method.split_off -[drop]: https://github.com/rust-lang/rust/pull/24935 +[24935]: https://github.com/rust-lang/rust/pull/24935 Version 1.0.0 (2015-05-15) ======================== @@ -9401,7 +9291,7 @@ Language property: generic code cannot behave differently for different type arguments except in minor ways. * The `unsafe_destructor` feature is now deprecated in favor of the - [new `dropck`][dropck]. This change is a major reduction in unsafe + [new `dropck`][rfc769]. This change is a major reduction in unsafe code. Libraries @@ -9409,7 +9299,7 @@ Libraries * The `thread_local` module [has been renamed to `std::thread`][th]. * The methods of `IteratorExt` [have been moved to the `Iterator` - trait itself][ie]. + trait itself][23300]. * Several traits that implement Rust's conventions for type conversions, `AsMut`, `AsRef`, `From`, and `Into` have been [centralized in the `std::convert` module][con]. @@ -9428,7 +9318,7 @@ Libraries * [In method resolution, object methods are resolved before inherent methods][meth]. * [`String::from_str` has been deprecated in favor of the `From` impl, - `String::from`][sf]. + `String::from`][24517]. * [`io::Error` implements `Sync`][ios]. * [The `words` method on `&str` has been replaced with `split_whitespace`][sw], to avoid answering the tricky question, 'what is @@ -9476,7 +9366,7 @@ Misc [con]: https://github.com/rust-lang/rust/pull/23875 [cr]: https://github.com/rust-lang/rust/pull/23419 [fe]: https://github.com/rust-lang/rust/pull/23879 -[ie]: https://github.com/rust-lang/rust/pull/23300 +[23300]: https://github.com/rust-lang/rust/pull/23300 [inv]: https://github.com/rust-lang/rust/pull/23938 [ios]: https://github.com/rust-lang/rust/pull/24133 [lex]: https://github.com/rust-lang/rfcs/blob/master/text/0879-small-base-lexing.md @@ -9484,7 +9374,7 @@ Misc [meth]: https://github.com/rust-lang/rust/pull/24056 [pat]: https://github.com/rust-lang/rfcs/blob/master/text/0528-string-patterns.md [po]: https://github.com/rust-lang/rust/pull/24270 -[sf]: https://github.com/rust-lang/rust/pull/24517 +[24517]: https://github.com/rust-lang/rust/pull/24517 [slp]: https://github.com/rust-lang/rust/pull/23949 [spl]: https://github.com/rust-lang/rfcs/blob/master/text/0979-align-splitn-with-other-languages.md [sw]: https://github.com/rust-lang/rfcs/blob/master/text/1054-str-words.md @@ -9502,7 +9392,7 @@ Misc [conversion]: https://github.com/rust-lang/rfcs/pull/529 [num-traits]: https://github.com/rust-lang/rust/pull/23549 [index-value]: https://github.com/rust-lang/rust/pull/23601 -[dropck]: https://github.com/rust-lang/rfcs/pull/769 +[rfc769]: https://github.com/rust-lang/rfcs/pull/769 [ci-compare]: https://gist.github.com/brson/a30a77836fbec057cbee [fn-inherit]: https://github.com/rust-lang/rust/pull/23282 [fn-blanket]: https://github.com/rust-lang/rust/pull/23895 diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 2fb5a0f9faf82..5703a72c686e5 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -1,6 +1,7 @@ //! A helper class for dealing with static archives -use std::ffi::{CStr, CString}; +use std::env; +use std::ffi::{CStr, CString, OsString}; use std::io; use std::mem; use std::path::{Path, PathBuf}; @@ -158,54 +159,127 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> { output_path.with_extension("lib") }; - // we've checked for \0 characters in the library name already - let dll_name_z = CString::new(lib_name).unwrap(); - // All import names are Rust identifiers and therefore cannot contain \0 characters. - // FIXME: when support for #[link_name] implemented, ensure that import.name values don't - // have any \0 characters - let import_name_and_ordinal_vector: Vec<(CString, Option)> = dll_imports + let mingw_gnu_toolchain = self.config.sess.target.llvm_target.ends_with("pc-windows-gnu"); + + let import_name_and_ordinal_vector: Vec<(String, Option)> = dll_imports .iter() .map(|import: &DllImport| { if self.config.sess.target.arch == "x86" { - (LlvmArchiveBuilder::i686_decorated_name(import), import.ordinal) + ( + LlvmArchiveBuilder::i686_decorated_name(import, mingw_gnu_toolchain), + import.ordinal, + ) } else { - (CString::new(import.name.to_string()).unwrap(), import.ordinal) + (import.name.to_string(), import.ordinal) } }) .collect(); - let output_path_z = rustc_fs_util::path_to_c_string(&output_path); + if mingw_gnu_toolchain { + // The binutils linker used on -windows-gnu targets cannot read the import + // libraries generated by LLVM: in our attempts, the linker produced an .EXE + // that loaded but crashed with an AV upon calling one of the imported + // functions. Therefore, use binutils to create the import library instead, + // by writing a .DEF file to the temp dir and calling binutils's dlltool. + let def_file_path = + tmpdir.as_ref().join(format!("{}_imports", lib_name)).with_extension("def"); + + let def_file_content = format!( + "EXPORTS\n{}", + import_name_and_ordinal_vector + .into_iter() + .map(|(name, ordinal)| { + match ordinal { + Some(n) => format!("{} @{} NONAME", name, n), + None => name, + } + }) + .collect::>() + .join("\n") + ); - tracing::trace!("invoking LLVMRustWriteImportLibrary"); - tracing::trace!(" dll_name {:#?}", dll_name_z); - tracing::trace!(" output_path {}", output_path.display()); - tracing::trace!( - " import names: {}", - dll_imports.iter().map(|import| import.name.to_string()).collect::>().join(", "), - ); + match std::fs::write(&def_file_path, def_file_content) { + Ok(_) => {} + Err(e) => { + self.config.sess.fatal(&format!("Error writing .DEF file: {}", e)); + } + }; - let ffi_exports: Vec = import_name_and_ordinal_vector - .iter() - .map(|(name_z, ordinal)| LLVMRustCOFFShortExport::new(name_z.as_ptr(), *ordinal)) - .collect(); - let result = unsafe { - crate::llvm::LLVMRustWriteImportLibrary( - dll_name_z.as_ptr(), - output_path_z.as_ptr(), - ffi_exports.as_ptr(), - ffi_exports.len(), - llvm_machine_type(&self.config.sess.target.arch) as u16, - !self.config.sess.target.is_like_msvc, - ) - }; + let dlltool = find_binutils_dlltool(self.config.sess); + let result = std::process::Command::new(dlltool) + .args([ + "-d", + def_file_path.to_str().unwrap(), + "-D", + lib_name, + "-l", + output_path.to_str().unwrap(), + ]) + .output(); + + match result { + Err(e) => { + self.config.sess.fatal(&format!("Error calling dlltool: {}", e.to_string())); + } + Ok(output) if !output.status.success() => self.config.sess.fatal(&format!( + "Dlltool could not create import library: {}\n{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + )), + _ => {} + } + } else { + // we've checked for \0 characters in the library name already + let dll_name_z = CString::new(lib_name).unwrap(); + + let output_path_z = rustc_fs_util::path_to_c_string(&output_path); + + tracing::trace!("invoking LLVMRustWriteImportLibrary"); + tracing::trace!(" dll_name {:#?}", dll_name_z); + tracing::trace!(" output_path {}", output_path.display()); + tracing::trace!( + " import names: {}", + dll_imports + .iter() + .map(|import| import.name.to_string()) + .collect::>() + .join(", "), + ); - if result == crate::llvm::LLVMRustResult::Failure { - self.config.sess.fatal(&format!( - "Error creating import library for {}: {}", - lib_name, - llvm::last_error().unwrap_or("unknown LLVM error".to_string()) - )); - } + // All import names are Rust identifiers and therefore cannot contain \0 characters. + // FIXME: when support for #[link_name] is implemented, ensure that the import names + // still don't contain any \0 characters. Also need to check that the names don't + // contain substrings like " @" or "NONAME" that are keywords or otherwise reserved + // in definition files. + let cstring_import_name_and_ordinal_vector: Vec<(CString, Option)> = + import_name_and_ordinal_vector + .into_iter() + .map(|(name, ordinal)| (CString::new(name).unwrap(), ordinal)) + .collect(); + + let ffi_exports: Vec = cstring_import_name_and_ordinal_vector + .iter() + .map(|(name_z, ordinal)| LLVMRustCOFFShortExport::new(name_z.as_ptr(), *ordinal)) + .collect(); + let result = unsafe { + crate::llvm::LLVMRustWriteImportLibrary( + dll_name_z.as_ptr(), + output_path_z.as_ptr(), + ffi_exports.as_ptr(), + ffi_exports.len(), + llvm_machine_type(&self.config.sess.target.arch) as u16, + !self.config.sess.target.is_like_msvc, + ) + }; + + if result == crate::llvm::LLVMRustResult::Failure { + self.config.sess.fatal(&format!( + "Error creating import library for {}: {}", + lib_name, + llvm::last_error().unwrap_or("unknown LLVM error".to_string()) + )); + } + }; self.add_archive(&output_path, |_| false).unwrap_or_else(|e| { self.config.sess.fatal(&format!( @@ -332,22 +406,61 @@ impl<'a> LlvmArchiveBuilder<'a> { } } - fn i686_decorated_name(import: &DllImport) -> CString { + fn i686_decorated_name(import: &DllImport, mingw: bool) -> String { let name = import.name; - // We verified during construction that `name` does not contain any NULL characters, so the - // conversion to CString is guaranteed to succeed. - CString::new(match import.calling_convention { - DllCallingConvention::C => format!("_{}", name), - DllCallingConvention::Stdcall(arg_list_size) => format!("_{}@{}", name, arg_list_size), + let prefix = if mingw { "" } else { "_" }; + + match import.calling_convention { + DllCallingConvention::C => format!("{}{}", prefix, name), + DllCallingConvention::Stdcall(arg_list_size) => { + format!("{}{}@{}", prefix, name, arg_list_size) + } DllCallingConvention::Fastcall(arg_list_size) => format!("@{}@{}", name, arg_list_size), DllCallingConvention::Vectorcall(arg_list_size) => { format!("{}@@{}", name, arg_list_size) } - }) - .unwrap() + } } } fn string_to_io_error(s: String) -> io::Error { io::Error::new(io::ErrorKind::Other, format!("bad archive: {}", s)) } + +fn find_binutils_dlltool(sess: &Session) -> OsString { + assert!(sess.target.options.is_like_windows && !sess.target.options.is_like_msvc); + if let Some(dlltool_path) = &sess.opts.debugging_opts.dlltool { + return dlltool_path.clone().into_os_string(); + } + + let mut tool_name: OsString = if sess.host.arch != sess.target.arch { + // We are cross-compiling, so we need the tool with the prefix matching our target + if sess.target.arch == "x86" { + "i686-w64-mingw32-dlltool" + } else { + "x86_64-w64-mingw32-dlltool" + } + } else { + // We are not cross-compiling, so we just want `dlltool` + "dlltool" + } + .into(); + + if sess.host.options.is_like_windows { + // If we're compiling on Windows, add the .exe suffix + tool_name.push(".exe"); + } + + // NOTE: it's not clear how useful it is to explicitly search PATH. + for dir in env::split_paths(&env::var_os("PATH").unwrap_or_default()) { + let full_path = dir.join(&tool_name); + if full_path.is_file() { + return full_path.into_os_string(); + } + } + + // The user didn't specify the location of the dlltool binary, and we weren't able + // to find the appropriate one on the PATH. Just return the name of the tool + // and let the invocation fail with a hopefully useful error message. + tool_name +} diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index f03d8eea40bb3..76f4df6ec2da8 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -293,10 +293,6 @@ impl GenericArg<'_> { } } - pub fn is_const(&self) -> bool { - matches!(self, GenericArg::Const(_)) - } - pub fn is_synthetic(&self) -> bool { matches!(self, GenericArg::Lifetime(lifetime) if lifetime.name.ident() == Ident::empty()) } @@ -318,6 +314,13 @@ impl GenericArg<'_> { GenericArg::Infer(_) => ast::ParamKindOrd::Infer, } } + + pub fn is_ty_or_const(&self) -> bool { + match self { + GenericArg::Lifetime(_) => false, + GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => true, + } + } } #[derive(Debug, HashStable_Generic)] diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index 8f5d6c85097cb..65443fd88d733 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -152,7 +152,7 @@ impl<'tcx> Elaborator<'tcx> { obligation.cause.clone(), ) }); - debug!("super_predicates: data={:?}", data); + debug!(?data, ?obligations, "super_predicates"); // Only keep those bounds that we haven't already seen. // This is necessary to prevent infinite recursion in some diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 816e770f01252..0e27a82b2b13b 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -646,6 +646,7 @@ fn test_debugging_options_tracking_hash() { untracked!(borrowck, String::from("other")); untracked!(deduplicate_diagnostics, false); untracked!(dep_tasks, true); + untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe"))); untracked!(dont_buffer_diagnostics, true); untracked!(dump_dep_graph, true); untracked!(dump_mir, Some(String::from("abc"))); diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 639d2e617c77a..13cd8e4a046b0 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -274,11 +274,6 @@ impl Collector<'_> { span, "`#[link(...)]` with `kind = \"raw-dylib\"` only supported on Windows", ); - } else if !self.tcx.sess.target.options.is_like_msvc { - self.tcx.sess.span_warn( - span, - "`#[link(...)]` with `kind = \"raw-dylib\"` not supported on windows-gnu", - ); } if lib_name.as_str().contains('\0') { diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 1c3a01e2cfadf..0bd96f8f865fc 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -31,6 +31,13 @@ impl GenericParamDefKind { GenericParamDefKind::Const { .. } => ast::ParamKindOrd::Const, } } + + pub fn is_ty_or_const(&self) -> bool { + match self { + GenericParamDefKind::Lifetime => false, + GenericParamDefKind::Type { .. } | GenericParamDefKind::Const { .. } => true, + } + } } #[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)] diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 94127a144dfef..7b5905fddc9e5 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -188,6 +188,11 @@ pub trait Printer<'tcx>: Sized { own_params.start = 1; } + // If we're in verbose mode, then print default-equal args too + if self.tcx().sess.verbose() { + return &substs[own_params]; + } + // Don't print args that are the defaults of their respective parameters. own_params.end -= generics .params diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 350386f8d9317..b2ae6e6fae6fd 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1784,10 +1784,11 @@ impl<'tcx, F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> { self = print_prefix(self)?; // Don't print `'_` if there's no unerased regions. - let print_regions = args.iter().any(|arg| match arg.unpack() { - GenericArgKind::Lifetime(r) => *r != ty::ReErased, - _ => false, - }); + let print_regions = self.tcx.sess.verbose() + || args.iter().any(|arg| match arg.unpack() { + GenericArgKind::Lifetime(r) => *r != ty::ReErased, + _ => false, + }); let args = args.iter().cloned().filter(|arg| match arg.unpack() { GenericArgKind::Lifetime(_) => print_regions, _ => true, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 0b9623d1c7d6f..c48d8d689c10e 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1161,6 +1161,8 @@ options! { dep_tasks: bool = (false, parse_bool, [UNTRACKED], "print tasks that execute and the color their dep node gets (requires debug build) \ (default: no)"), + dlltool: Option = (None, parse_opt_pathbuf, [UNTRACKED], + "import library generation tool (windows-gnu only)"), dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED], "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \ (default: no)"), diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 035bc9b00c930..577b96f3a400b 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1225,6 +1225,10 @@ fn assemble_candidates_from_object_ty<'cx, 'tcx>( ); } +#[tracing::instrument( + level = "debug", + skip(selcx, candidate_set, ctor, env_predicates, potentially_unnormalized_candidates) +)] fn assemble_candidates_from_predicates<'cx, 'tcx>( selcx: &mut SelectionContext<'cx, 'tcx>, obligation: &ProjectionTyObligation<'tcx>, @@ -1233,8 +1237,6 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>( env_predicates: impl Iterator>, potentially_unnormalized_candidates: bool, ) { - debug!(?obligation, "assemble_candidates_from_predicates"); - let infcx = selcx.infcx(); for predicate in env_predicates { debug!(?predicate); @@ -1270,13 +1272,12 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>( } } +#[tracing::instrument(level = "debug", skip(selcx, obligation, candidate_set))] fn assemble_candidates_from_impls<'cx, 'tcx>( selcx: &mut SelectionContext<'cx, 'tcx>, obligation: &ProjectionTyObligation<'tcx>, candidate_set: &mut ProjectionTyCandidateSet<'tcx>, ) { - debug!("assemble_candidates_from_impls"); - // If we are resolving `>::Item == Type`, // start out by selecting the predicate `T as TraitRef<...>`: let poly_trait_ref = ty::Binder::dummy(obligation.predicate.trait_ref(selcx.tcx())); diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 017f47d4357fb..b573c4b43906c 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -173,6 +173,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { let needs_infer = stack.obligation.predicate.has_infer_types_or_consts(); + let sized_predicate = self.tcx().lang_items().sized_trait() + == Some(stack.obligation.predicate.skip_binder().def_id()); + // If there are STILL multiple candidates, we can further // reduce the list by dropping duplicates -- including // resolving specializations. @@ -181,6 +184,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { while i < candidates.len() { let is_dup = (0..candidates.len()).filter(|&j| i != j).any(|j| { self.candidate_should_be_dropped_in_favor_of( + sized_predicate, &candidates[i], &candidates[j], needs_infer, @@ -338,13 +342,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(candidates) } + #[tracing::instrument(level = "debug", skip(self, candidates))] fn assemble_candidates_from_projected_tys( &mut self, obligation: &TraitObligation<'tcx>, candidates: &mut SelectionCandidateSet<'tcx>, ) { - debug!(?obligation, "assemble_candidates_from_projected_tys"); - // Before we go into the whole placeholder thing, just // quickly check if the self-type is a projection at all. match obligation.predicate.skip_binder().trait_ref.self_ty().kind() { @@ -369,12 +372,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// supplied to find out whether it is listed among them. /// /// Never affects the inference environment. + #[tracing::instrument(level = "debug", skip(self, stack, candidates))] fn assemble_candidates_from_caller_bounds<'o>( &mut self, stack: &TraitObligationStack<'o, 'tcx>, candidates: &mut SelectionCandidateSet<'tcx>, ) -> Result<(), SelectionError<'tcx>> { - debug!(?stack.obligation, "assemble_candidates_from_caller_bounds"); + debug!(?stack.obligation); let all_bounds = stack .obligation @@ -876,6 +880,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { }; } + #[tracing::instrument(level = "debug", skip(self, obligation, candidates))] fn assemble_candidates_for_trait_alias( &mut self, obligation: &TraitObligation<'tcx>, @@ -883,7 +888,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ) { // Okay to skip binder here because the tests we do below do not involve bound regions. let self_ty = obligation.self_ty().skip_binder(); - debug!(?self_ty, "assemble_candidates_for_trait_alias"); + debug!(?self_ty); let def_id = obligation.predicate.def_id(); @@ -894,6 +899,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// Assembles the trait which are built-in to the language itself: /// `Copy`, `Clone` and `Sized`. + #[tracing::instrument(level = "debug", skip(self, candidates))] fn assemble_builtin_bound_candidates( &mut self, conditions: BuiltinImplConditions<'tcx>, @@ -901,14 +907,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ) { match conditions { BuiltinImplConditions::Where(nested) => { - debug!(?nested, "builtin_bound"); candidates .vec .push(BuiltinCandidate { has_nested: !nested.skip_binder().is_empty() }); } BuiltinImplConditions::None => {} BuiltinImplConditions::Ambiguous => { - debug!("assemble_builtin_bound_candidates: ambiguous builtin"); candidates.ambiguous = true; } } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index bb3b3203a7c20..32518ffb07153 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -201,6 +201,7 @@ struct EvaluatedCandidate<'tcx> { } /// When does the builtin impl for `T: Trait` apply? +#[derive(Debug)] enum BuiltinImplConditions<'tcx> { /// The impl is conditional on `T1, T2, ...: Trait`. Where(ty::Binder<'tcx, Vec>>), @@ -344,7 +345,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } Err(e) => Err(e), Ok(candidate) => { - debug!(?candidate); + debug!(?candidate, "confirmed"); Ok(Some(candidate)) } } @@ -1523,6 +1524,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// See the comment for "SelectionCandidate" for more details. fn candidate_should_be_dropped_in_favor_of( &mut self, + sized_predicate: bool, victim: &EvaluatedCandidate<'tcx>, other: &EvaluatedCandidate<'tcx>, needs_infer: bool, @@ -1594,6 +1596,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // Drop otherwise equivalent non-const fn pointer candidates (FnPointerCandidate { .. }, FnPointerCandidate { is_const: false }) => true, + // If obligation is a sized predicate or the where-clause bound is + // global, prefer the projection or object candidate. See issue + // #50825 and #89352. + (ObjectCandidate(_) | ProjectionCandidate(_), ParamCandidate(ref cand)) => { + sized_predicate || is_global(cand) + } + (ParamCandidate(ref cand), ObjectCandidate(_) | ProjectionCandidate(_)) => { + !(sized_predicate || is_global(cand)) + } + // Global bounds from the where clause should be ignored // here (see issue #50825). Otherwise, we have a where // clause so don't go around looking for impls. @@ -1609,15 +1621,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | BuiltinUnsizeCandidate | TraitUpcastingUnsizeCandidate(_) | BuiltinCandidate { .. } - | TraitAliasCandidate(..) - | ObjectCandidate(_) - | ProjectionCandidate(_), + | TraitAliasCandidate(..), ) => !is_global(cand), - (ObjectCandidate(_) | ProjectionCandidate(_), ParamCandidate(ref cand)) => { - // Prefer these to a global where-clause bound - // (see issue #50825). - is_global(cand) - } ( ImplCandidate(_) | ClosureCandidate diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index 17cf366761124..34f93a517cefb 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -288,7 +288,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { /// Given the type/lifetime/const arguments provided to some path (along with /// an implicit `Self`, if this is a trait reference), returns the complete /// set of substitutions. This may involve applying defaulted type parameters. - /// Also returns back constraints on associated types. + /// Constraints on associated typess are created from `create_assoc_bindings_for_generic_args`. /// /// Example: /// @@ -302,7 +302,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { /// which will have been resolved to a `def_id` /// 3. The `generic_args` contains info on the `<...>` contents. The `usize` type /// parameters are returned in the `SubstsRef`, the associated type bindings like - /// `Output = u32` are returned in the `Vec` result. + /// `Output = u32` are returned from `create_assoc_bindings_for_generic_args`. /// /// Note that the type listing given here is *exactly* what the user provided. /// diff --git a/compiler/rustc_typeck/src/check/method/mod.rs b/compiler/rustc_typeck/src/check/method/mod.rs index ac3e09318e52f..5057be70c4869 100644 --- a/compiler/rustc_typeck/src/check/method/mod.rs +++ b/compiler/rustc_typeck/src/check/method/mod.rs @@ -359,6 +359,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let (obligation, substs) = self.obligation_for_method(span, trait_def_id, self_ty, opt_input_types); + debug!(?obligation); + // Now we want to know if this can be matched if !self.predicate_may_hold(&obligation) { debug!("--> Cannot match obligation"); diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index ae8d262fcf176..5ff2a74754117 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -18,6 +18,7 @@ use super::{bad_placeholder, is_suggestable_infer_ty}; /// Computes the relevant generic parameter for a potential generic const argument. /// /// This should be called using the query `tcx.opt_const_param_of`. +#[instrument(level = "debug", skip(tcx))] pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option { // FIXME(generic_arg_infer): allow for returning DefIds of inference of // GenericArg::Infer below. This may require a change where GenericArg::Infer has some flag @@ -25,231 +26,228 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option< use hir::*; let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); - if let Node::AnonConst(_) = tcx.hir().get(hir_id) { - let parent_node_id = tcx.hir().get_parent_node(hir_id); - let parent_node = tcx.hir().get(parent_node_id); + match tcx.hir().get(hir_id) { + Node::AnonConst(_) => (), + _ => return None, + }; - match parent_node { - // This match arm is for when the def_id appears in a GAT whose - // path can't be resolved without typechecking e.g. - // - // trait Foo { - // type Assoc; - // fn foo() -> Self::Assoc<3>; - // } - // - // In the above code we would call this query with the def_id of 3 and - // the parent_node we match on would be the hir node for Self::Assoc<3> - // - // `Self::Assoc<3>` cant be resolved without typchecking here as we - // didnt write ::Assoc<3>. If we did then another match - // arm would handle this. - // - // I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU - Node::Ty(hir_ty @ Ty { kind: TyKind::Path(QPath::TypeRelative(_, segment)), .. }) => { - // Find the Item containing the associated type so we can create an ItemCtxt. - // Using the ItemCtxt convert the HIR for the unresolved assoc type into a - // ty which is a fully resolved projection. - // For the code example above, this would mean converting Self::Assoc<3> - // into a ty::Projection(::Assoc<3>) - let item_hir_id = tcx - .hir() - .parent_iter(hir_id) - .filter(|(_, node)| matches!(node, Node::Item(_))) - .map(|(id, _)| id) - .next() - .unwrap(); - let item_did = tcx.hir().local_def_id(item_hir_id).to_def_id(); - let item_ctxt = &ItemCtxt::new(tcx, item_did) as &dyn crate::astconv::AstConv<'_>; - let ty = item_ctxt.ast_ty_to_ty(hir_ty); - - // Iterate through the generics of the projection to find the one that corresponds to - // the def_id that this query was called with. We filter to only const args here as a - // precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't - // but it can't hurt to be safe ^^ - if let ty::Projection(projection) = ty.kind() { - let generics = tcx.generics_of(projection.item_def_id); - - let arg_index = segment - .args - .and_then(|args| { - args.args - .iter() - .filter(|arg| arg.is_const()) - .position(|arg| arg.id() == hir_id) - }) - .unwrap_or_else(|| { - bug!("no arg matching AnonConst in segment"); - }); + let parent_node_id = tcx.hir().get_parent_node(hir_id); + let parent_node = tcx.hir().get(parent_node_id); - return generics - .params - .iter() - .filter(|param| matches!(param.kind, ty::GenericParamDefKind::Const { .. })) - .nth(arg_index) - .map(|param| param.def_id); - } - - // I dont think it's possible to reach this but I'm not 100% sure - BoxyUwU - tcx.sess.delay_span_bug( - tcx.def_span(def_id), - "unexpected non-GAT usage of an anon const", - ); - return None; - } - Node::Expr(&Expr { - kind: - ExprKind::MethodCall(segment, ..) | ExprKind::Path(QPath::TypeRelative(_, segment)), - .. - }) => { - let body_owner = tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id)); - let tables = tcx.typeck(body_owner); - // This may fail in case the method/path does not actually exist. - // As there is no relevant param for `def_id`, we simply return - // `None` here. - let type_dependent_def = tables.type_dependent_def_id(parent_node_id)?; - let idx = segment + let (generics, arg_idx) = match parent_node { + // This match arm is for when the def_id appears in a GAT whose + // path can't be resolved without typechecking e.g. + // + // trait Foo { + // type Assoc; + // fn foo() -> Self::Assoc<3>; + // } + // + // In the above code we would call this query with the def_id of 3 and + // the parent_node we match on would be the hir node for Self::Assoc<3> + // + // `Self::Assoc<3>` cant be resolved without typchecking here as we + // didnt write ::Assoc<3>. If we did then another match + // arm would handle this. + // + // I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU + Node::Ty(hir_ty @ Ty { kind: TyKind::Path(QPath::TypeRelative(_, segment)), .. }) => { + // Find the Item containing the associated type so we can create an ItemCtxt. + // Using the ItemCtxt convert the HIR for the unresolved assoc type into a + // ty which is a fully resolved projection. + // For the code example above, this would mean converting Self::Assoc<3> + // into a ty::Projection(::Assoc<3>) + let item_hir_id = tcx + .hir() + .parent_iter(hir_id) + .filter(|(_, node)| matches!(node, Node::Item(_))) + .map(|(id, _)| id) + .next() + .unwrap(); + let item_did = tcx.hir().local_def_id(item_hir_id).to_def_id(); + let item_ctxt = &ItemCtxt::new(tcx, item_did) as &dyn crate::astconv::AstConv<'_>; + let ty = item_ctxt.ast_ty_to_ty(hir_ty); + + // Iterate through the generics of the projection to find the one that corresponds to + // the def_id that this query was called with. We filter to only const args here as a + // precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't + // but it can't hurt to be safe ^^ + if let ty::Projection(projection) = ty.kind() { + let generics = tcx.generics_of(projection.item_def_id); + + let arg_index = segment .args .and_then(|args| { args.args .iter() - .filter(|arg| arg.is_const()) + .filter(|arg| arg.is_ty_or_const()) .position(|arg| arg.id() == hir_id) }) .unwrap_or_else(|| { bug!("no arg matching AnonConst in segment"); }); - tcx.generics_of(type_dependent_def) - .params - .iter() - .filter(|param| matches!(param.kind, ty::GenericParamDefKind::Const { .. })) - .nth(idx) - .map(|param| param.def_id) + (generics, arg_index) + } else { + // I dont think it's possible to reach this but I'm not 100% sure - BoxyUwU + tcx.sess.delay_span_bug( + tcx.def_span(def_id), + "unexpected non-GAT usage of an anon const", + ); + return None; } + } + Node::Expr(&Expr { + kind: + ExprKind::MethodCall(segment, ..) | ExprKind::Path(QPath::TypeRelative(_, segment)), + .. + }) => { + let body_owner = tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id)); + let tables = tcx.typeck(body_owner); + // This may fail in case the method/path does not actually exist. + // As there is no relevant param for `def_id`, we simply return + // `None` here. + let type_dependent_def = tables.type_dependent_def_id(parent_node_id)?; + let idx = segment + .args + .and_then(|args| { + args.args + .iter() + .filter(|arg| arg.is_ty_or_const()) + .position(|arg| arg.id() == hir_id) + }) + .unwrap_or_else(|| { + bug!("no arg matching AnonConst in segment"); + }); - Node::Ty(&Ty { kind: TyKind::Path(_), .. }) - | Node::Expr(&Expr { kind: ExprKind::Path(_) | ExprKind::Struct(..), .. }) - | Node::TraitRef(..) - | Node::Pat(_) => { - let path = match parent_node { - Node::Ty(&Ty { kind: TyKind::Path(QPath::Resolved(_, path)), .. }) - | Node::TraitRef(&TraitRef { path, .. }) => &*path, - Node::Expr(&Expr { - kind: - ExprKind::Path(QPath::Resolved(_, path)) - | ExprKind::Struct(&QPath::Resolved(_, path), ..), - .. - }) => { - let body_owner = - tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id)); - let _tables = tcx.typeck(body_owner); - &*path - } - Node::Pat(pat) => { - if let Some(path) = get_path_containing_arg_in_pat(pat, hir_id) { - path - } else { - tcx.sess.delay_span_bug( - tcx.def_span(def_id), - &format!( - "unable to find const parent for {} in pat {:?}", - hir_id, pat - ), - ); - return None; - } - } - _ => { - tcx.sess.delay_span_bug( - tcx.def_span(def_id), - &format!("unexpected const parent path {:?}", parent_node), - ); - return None; - } - }; - - // We've encountered an `AnonConst` in some path, so we need to - // figure out which generic parameter it corresponds to and return - // the relevant type. - let filtered = path - .segments - .iter() - .filter_map(|seg| seg.args.map(|args| (args.args, seg))) - .find_map(|(args, seg)| { - args.iter() - .filter(|arg| arg.is_const()) - .position(|arg| arg.id() == hir_id) - .map(|index| (index, seg)) - }); - let (arg_index, segment) = match filtered { - None => { - tcx.sess.delay_span_bug( - tcx.def_span(def_id), - "no arg matching AnonConst in path", - ); - return None; - } - Some(inner) => inner, - }; - - // Try to use the segment resolution if it is valid, otherwise we - // default to the path resolution. - let res = segment.res.filter(|&r| r != Res::Err).unwrap_or(path.res); - use def::CtorOf; - let generics = match res { - Res::Def(DefKind::Ctor(CtorOf::Variant, _), def_id) => tcx.generics_of( - tcx.parent(def_id).and_then(|def_id| tcx.parent(def_id)).unwrap(), - ), - Res::Def(DefKind::Variant | DefKind::Ctor(CtorOf::Struct, _), def_id) => { - tcx.generics_of(tcx.parent(def_id).unwrap()) - } - // Other `DefKind`s don't have generics and would ICE when calling - // `generics_of`. - Res::Def( - DefKind::Struct - | DefKind::Union - | DefKind::Enum - | DefKind::Trait - | DefKind::OpaqueTy - | DefKind::TyAlias - | DefKind::ForeignTy - | DefKind::TraitAlias - | DefKind::AssocTy - | DefKind::Fn - | DefKind::AssocFn - | DefKind::AssocConst - | DefKind::Impl, - def_id, - ) => tcx.generics_of(def_id), - Res::Err => { - tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err"); - return None; - } - _ => { - // If the user tries to specify generics on a type that does not take them, - // e.g. `usize`, we may hit this branch, in which case we treat it as if - // no arguments have been passed. An error should already have been emitted. + (tcx.generics_of(type_dependent_def), idx) + } + + Node::Ty(&Ty { kind: TyKind::Path(_), .. }) + | Node::Expr(&Expr { kind: ExprKind::Path(_) | ExprKind::Struct(..), .. }) + | Node::TraitRef(..) + | Node::Pat(_) => { + let path = match parent_node { + Node::Ty(&Ty { kind: TyKind::Path(QPath::Resolved(_, path)), .. }) + | Node::TraitRef(&TraitRef { path, .. }) => &*path, + Node::Expr(&Expr { + kind: + ExprKind::Path(QPath::Resolved(_, path)) + | ExprKind::Struct(&QPath::Resolved(_, path), ..), + .. + }) => { + let body_owner = tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id)); + let _tables = tcx.typeck(body_owner); + &*path + } + Node::Pat(pat) => { + if let Some(path) = get_path_containing_arg_in_pat(pat, hir_id) { + path + } else { tcx.sess.delay_span_bug( tcx.def_span(def_id), - &format!("unexpected anon const res {:?} in path: {:?}", res, path), + &format!("unable to find const parent for {} in pat {:?}", hir_id, pat), ); return None; } - }; - - generics - .params - .iter() - .filter(|param| matches!(param.kind, ty::GenericParamDefKind::Const { .. })) - .nth(arg_index) - .map(|param| param.def_id) + } + _ => { + tcx.sess.delay_span_bug( + tcx.def_span(def_id), + &format!("unexpected const parent path {:?}", parent_node), + ); + return None; + } + }; + + // We've encountered an `AnonConst` in some path, so we need to + // figure out which generic parameter it corresponds to and return + // the relevant type. + let filtered = path + .segments + .iter() + .filter_map(|seg| seg.args.map(|args| (args.args, seg))) + .find_map(|(args, seg)| { + args.iter() + .filter(|arg| arg.is_ty_or_const()) + .position(|arg| arg.id() == hir_id) + .map(|index| (index, seg)) + }); + let (arg_index, segment) = match filtered { + None => { + tcx.sess + .delay_span_bug(tcx.def_span(def_id), "no arg matching AnonConst in path"); + return None; + } + Some(inner) => inner, + }; + + // Try to use the segment resolution if it is valid, otherwise we + // default to the path resolution. + let res = segment.res.filter(|&r| r != Res::Err).unwrap_or(path.res); + use def::CtorOf; + let generics = match res { + Res::Def(DefKind::Ctor(CtorOf::Variant, _), def_id) => tcx + .generics_of(tcx.parent(def_id).and_then(|def_id| tcx.parent(def_id)).unwrap()), + Res::Def(DefKind::Variant | DefKind::Ctor(CtorOf::Struct, _), def_id) => { + tcx.generics_of(tcx.parent(def_id).unwrap()) + } + // Other `DefKind`s don't have generics and would ICE when calling + // `generics_of`. + Res::Def( + DefKind::Struct + | DefKind::Union + | DefKind::Enum + | DefKind::Trait + | DefKind::OpaqueTy + | DefKind::TyAlias + | DefKind::ForeignTy + | DefKind::TraitAlias + | DefKind::AssocTy + | DefKind::Fn + | DefKind::AssocFn + | DefKind::AssocConst + | DefKind::Impl, + def_id, + ) => tcx.generics_of(def_id), + Res::Err => { + tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err"); + return None; + } + _ => { + // If the user tries to specify generics on a type that does not take them, + // e.g. `usize`, we may hit this branch, in which case we treat it as if + // no arguments have been passed. An error should already have been emitted. + tcx.sess.delay_span_bug( + tcx.def_span(def_id), + &format!("unexpected anon const res {:?} in path: {:?}", res, path), + ); + return None; + } + }; + + (generics, arg_index) + } + _ => return None, + }; + + debug!(?parent_node); + debug!(?generics, ?arg_idx); + generics + .params + .iter() + .filter(|param| param.kind.is_ty_or_const()) + .nth(match generics.has_self && generics.parent.is_none() { + true => arg_idx + 1, + false => arg_idx, + }) + .and_then(|param| match param.kind { + ty::GenericParamDefKind::Const { .. } => { + debug!(?param); + Some(param.def_id) } _ => None, - } - } else { - None - } + }) } fn get_path_containing_arg_in_pat<'hir>( diff --git a/library/std/src/net/mod.rs b/library/std/src/net/mod.rs index a0c77b648fe05..2669f4dbf3068 100644 --- a/library/std/src/net/mod.rs +++ b/library/std/src/net/mod.rs @@ -25,6 +25,8 @@ pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::parser::AddrParseError; +#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] +pub use self::tcp::IntoIncoming; #[stable(feature = "rust1", since = "1.0.0")] pub use self::tcp::{Incoming, TcpListener, TcpStream}; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index cb1b0ebf8db4a..3b2270ad016d6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1540,6 +1540,9 @@ note: if you're sure you want to do this, please open an issue as to why. In the } } cmd.env("RUSTC_BOOTSTRAP", "1"); + // Override the rustc version used in symbol hashes to reduce the amount of normalization + // needed when diffing test output. + cmd.env("RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER", "compiletest"); cmd.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel()); builder.add_rust_test_threads(&mut cmd); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index dda7490493197..c0659b57a8aa0 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1190,11 +1190,9 @@ fn render_deref_methods( } } render_assoc_items_inner(w, cx, container_item, did, what, derefs); - } else { - if let Some(prim) = target.primitive_type() { - if let Some(&did) = cache.primitive_locations.get(&prim) { - render_assoc_items_inner(w, cx, container_item, did, what, derefs); - } + } else if let Some(prim) = target.primitive_type() { + if let Some(&did) = cache.primitive_locations.get(&prim) { + render_assoc_items_inner(w, cx, container_item, did, what, derefs); } } } diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 5431bd8565b57..3d61adbb24aac 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -127,12 +127,12 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, }; let item_vars = ItemVars { - page: page, + page, static_root_path: page.get_static_root_path(), - typ: typ, + typ, name: item.name.as_ref().unwrap().as_str(), item_type: &item.type_().to_string(), - path_components: path_components, + path_components, stability_since_raw: &stability_since_raw, src_href: src_href.as_deref(), }; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index d7741c4fde239..a647a0fbfa55d 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -18,6 +18,7 @@ #![feature(iter_intersperse)] #![recursion_limit = "256"] #![warn(rustc::internal)] +#![allow(clippy::collapsible_if, clippy::collapsible_else_if)] #[macro_use] extern crate tracing; diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs index 675443b48a206..7b07974ae01c6 100644 --- a/src/librustdoc/passes/stripper.rs +++ b/src/librustdoc/passes/stripper.rs @@ -43,11 +43,10 @@ impl<'a> DocFolder for Stripper<'a> { | clean::TraitAliasItem(..) | clean::MacroItem(..) | clean::ForeignTypeItem => { - if i.def_id.is_local() { - if !self.access_levels.is_exported(i.def_id.expect_def_id()) { - debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name); - return None; - } + if i.def_id.is_local() && !self.access_levels.is_exported(i.def_id.expect_def_id()) + { + debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name); + return None; } } diff --git a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff index 4ae783a7f46ff..f874314a2e2b3 100644 --- a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff @@ -30,7 +30,7 @@ - _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35 - _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44 + // + span: $DIR/const-promotion-extern-static.rs:9:31: 9:44 -+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[HASH]::BAR), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } ++ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[e01c]::BAR), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44 _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:44 - StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:34: 9:35 diff --git a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff index 705c2ed06b382..39c156646cd7d 100644 --- a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff @@ -32,7 +32,7 @@ - _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46 - _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55 + // + span: $DIR/const-promotion-extern-static.rs:13:31: 13:55 -+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[HASH]::FOO), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } ++ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[e01c]::FOO), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + _2 = &(*_6); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55 _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:55 - StorageDead(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:45: 13:46 diff --git a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff index 7fb954b8356cd..5b6960ffd46a1 100644 --- a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff @@ -31,7 +31,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[fbcf]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _3 = _9; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 diff --git a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff index 7fb954b8356cd..5b6960ffd46a1 100644 --- a/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff @@ -31,7 +31,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 - // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[fbcf]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _3 = _9; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35 diff --git a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff index 827a86c2376e8..97645309866f3 100644 --- a/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff @@ -22,7 +22,7 @@ // + val: Unevaluated(FOO, [], None) // mir::Constant // + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[HASH]::main::FOO), const_param_did: None }, substs_: Some([]), promoted: None }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[809a]::main::FOO), const_param_did: None }, substs_: Some([]), promoted: None }) } _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16 _1 = move _2 as usize (Misc); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:39 StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:38: 7:39 diff --git a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff index 496b9718c6ad9..5db9bb69decaa 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff @@ -17,7 +17,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/ref_deref.rs:5:6: 5:10 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[d561]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _2 = _4; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 - _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 + _1 = const 4_i32; // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 diff --git a/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff index 07c3b0cd58f2d..a15076d7b9906 100644 --- a/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref.main.PromoteTemps.diff @@ -20,7 +20,7 @@ + // + val: Unevaluated(main, [], Some(promoted[0])) + // mir::Constant + // + span: $DIR/ref_deref.rs:5:6: 5:10 -+ // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } ++ // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[d561]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:5:6: 5:10 _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:5:5: 5:10 - StorageDead(_3); // scope 0 at $DIR/ref_deref.rs:5:10: 5:11 diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff b/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff index 2545b89c1d3ee..cf3e982d5359e 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff @@ -17,7 +17,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/ref_deref_project.rs:5:6: 5:17 - // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[d1f7]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 diff --git a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff b/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff index f728d55ba6ede..49c08acfa2fde 100644 --- a/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff +++ b/src/test/mir-opt/const_prop/ref_deref_project.main.PromoteTemps.diff @@ -20,7 +20,7 @@ + // + val: Unevaluated(main, [], Some(promoted[0])) + // mir::Constant + // + span: $DIR/ref_deref_project.rs:5:6: 5:17 -+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } ++ // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[d1f7]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17 _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17 - StorageDead(_3); // scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18 diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff index 12c77e0b042a3..ccc874bc2e235 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff @@ -25,7 +25,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/slice_len.rs:5:6: 5:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[7261]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _4 = _9; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 StorageLive(_10); // scope 0 at $DIR/slice_len.rs:5:6: 5:19 diff --git a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff index 12c77e0b042a3..ccc874bc2e235 100644 --- a/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff @@ -25,7 +25,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/slice_len.rs:5:6: 5:19 - // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[7261]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _4 = _9; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 _3 = _4; // scope 0 at $DIR/slice_len.rs:5:6: 5:19 StorageLive(_10); // scope 0 at $DIR/slice_len.rs:5:6: 5:19 diff --git a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir index 37f6fc91cf95f..eed2027af9e63 100644 --- a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -38,7 +38,7 @@ fn bar() -> bool { // + val: Unevaluated(bar, [], Some(promoted[1])) // mir::Constant // + span: $DIR/inline-retag.rs:12:7: 12:9 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[HASH]::bar), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[1]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[86d7]::bar), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[1]) }) } Retag(_10); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 _4 = &(*_10); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 Retag(_4); // scope 1 at $DIR/inline-retag.rs:12:7: 12:9 @@ -52,7 +52,7 @@ fn bar() -> bool { // + val: Unevaluated(bar, [], Some(promoted[0])) // mir::Constant // + span: $DIR/inline-retag.rs:12:11: 12:14 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[HASH]::bar), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[86d7]::bar), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } Retag(_9); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 _7 = &(*_9); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 Retag(_7); // scope 1 at $DIR/inline-retag.rs:12:11: 12:14 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 20e5191310caf..a3eeb6e7090f9 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -66,7 +66,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[9565]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 20e5191310caf..a3eeb6e7090f9 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -66,7 +66,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[9565]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index 04e4af70bb75e..33e56addee1f1 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -87,7 +87,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[9565]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index 04e4af70bb75e..33e56addee1f1 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -87,7 +87,7 @@ // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[9565]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff index b8f44b7672a20..68d14b1849053 100644 --- a/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff +++ b/src/test/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff @@ -50,7 +50,7 @@ // + val: Unevaluated(discriminant, [T], Some(promoted[2])) // mir::Constant // + span: $DIR/lower_intrinsics.rs:75:42: 75:44 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[HASH]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[49eb]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) } _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44 _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44 - _5 = discriminant_value::(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45 @@ -74,7 +74,7 @@ // + val: Unevaluated(discriminant, [T], Some(promoted[1])) // mir::Constant // + span: $DIR/lower_intrinsics.rs:76:42: 76:45 - // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[HASH]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) } + // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[49eb]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) } _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45 _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45 - _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46 @@ -98,7 +98,7 @@ // + val: Unevaluated(discriminant, [T], Some(promoted[0])) // mir::Constant // + span: $DIR/lower_intrinsics.rs:77:42: 77:47 - // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[HASH]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[49eb]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) } _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47 _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47 - _13 = discriminant_value::(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48 diff --git a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir index 0ef06da0cb758..e538367312892 100644 --- a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir +++ b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir @@ -57,7 +57,7 @@ fn full_tested_match() -> () { // + val: Unevaluated(full_tested_match, [], Some(promoted[0])) // mir::Constant // + span: $DIR/match_false_edges.rs:16:14: 16:15 - // + literal: Const { ty: &std::option::Option, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[HASH]::full_tested_match), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &std::option::Option, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[5411]::full_tested_match), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } _6 = &(((*_11) as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15 _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27 StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27 diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index defb04db7dece..fa8d603aa64d0 100644 --- a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -127,7 +127,7 @@ fn array_casts() -> () { // + val: Unevaluated(array_casts, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &usize, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:15 ~ retag[HASH]::array_casts), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &usize, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:15 ~ retag[4622]::array_casts), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } Retag(_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Retag(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir index 3f35f15a56d76..e33d5d4358402 100644 --- a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir @@ -113,7 +113,7 @@ fn main() -> () { StorageLive(_14); // scope 1 at $DIR/retag.rs:40:31: 43:6 _14 = [closure@main::{closure#0}]; // scope 1 at $DIR/retag.rs:40:31: 43:6 // closure - // + def_id: DefId(0:14 ~ retag[HASH]::main::{closure#0}) + // + def_id: DefId(0:14 ~ retag[4622]::main::{closure#0}) // + substs: [ // i8, // for<'r> extern "rust-call" fn((&'r i32,)) -> &'r i32, @@ -153,7 +153,7 @@ fn main() -> () { // + val: Unevaluated(main, [], Some(promoted[0])) // mir::Constant // + span: $DIR/retag.rs:47:21: 47:23 - // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[HASH]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } + // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[4622]::main), const_param_did: None }, substs_: Some([]), promoted: Some(promoted[0]) }) } Retag(_28); // scope 7 at $DIR/retag.rs:47:21: 47:23 _23 = &(*_28); // scope 7 at $DIR/retag.rs:47:21: 47:23 Retag(_23); // scope 7 at $DIR/retag.rs:47:21: 47:23 diff --git a/src/test/run-make/raw-dylib-c/Makefile b/src/test/run-make/raw-dylib-c/Makefile index 26ab4d34764d1..166305672e6f2 100644 --- a/src/test/run-make/raw-dylib-c/Makefile +++ b/src/test/run-make/raw-dylib-c/Makefile @@ -1,14 +1,19 @@ # Test the behavior of #[link(.., kind = "raw-dylib")] on windows-msvc -# only-windows-msvc +# only-windows -include ../../run-make-fulldeps/tools.mk all: $(call COMPILE_OBJ,"$(TMPDIR)"/extern_1.obj,extern_1.c) $(call COMPILE_OBJ,"$(TMPDIR)"/extern_2.obj,extern_2.c) +ifdef IS_MSVC $(CC) "$(TMPDIR)"/extern_1.obj -link -dll -out:"$(TMPDIR)"/extern_1.dll $(CC) "$(TMPDIR)"/extern_2.obj -link -dll -out:"$(TMPDIR)"/extern_2.dll +else + $(CC) "$(TMPDIR)"/extern_1.obj -shared -o "$(TMPDIR)"/extern_1.dll + $(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll +endif $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt diff --git a/src/test/run-make/raw-dylib-link-ordinal/Makefile b/src/test/run-make/raw-dylib-link-ordinal/Makefile index 04b257d063204..0e84a749b0578 100644 --- a/src/test/run-make/raw-dylib-link-ordinal/Makefile +++ b/src/test/run-make/raw-dylib-link-ordinal/Makefile @@ -1,12 +1,16 @@ # Test the behavior of #[link(.., kind = "raw-dylib")] and #[link_ordinal] on windows-msvc -# only-windows-msvc +# only-windows -include ../../run-make-fulldeps/tools.mk all: $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) +ifdef IS_MSVC $(CC) "$(TMPDIR)"/exporter.obj exporter.def -link -dll -out:"$(TMPDIR)"/exporter.dll +else + $(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll +endif $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile b/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile new file mode 100644 index 0000000000000..69f62669d6291 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile @@ -0,0 +1,23 @@ +# Test the behavior of #[link(.., kind = "raw-dylib")], #[link_ordinal], and alternative calling conventions on i686 windows. + +# only-x86 +# only-windows + +-include ../../run-make-fulldeps/tools.mk + +all: + $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) +ifdef IS_MSVC + $(CC) "$(TMPDIR)"/exporter.obj exporter-msvc.def -link -dll -out:"$(TMPDIR)"/exporter.dll +else + $(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll +endif + $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs + $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" + "$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt + +ifdef RUSTC_BLESS_TEST + cp "$(TMPDIR)"/actual_output.txt expected_output.txt +else + $(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt +endif diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs b/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs new file mode 100644 index 0000000000000..4059ede11fc96 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs @@ -0,0 +1,5 @@ +extern crate raw_dylib_test; + +fn main() { + raw_dylib_test::library_function(); +} diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt b/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt new file mode 100644 index 0000000000000..20157763745f8 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt @@ -0,0 +1,2 @@ +exported_function_stdcall(6) +exported_function_fastcall(125) diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def new file mode 100644 index 0000000000000..8d28d714b7e64 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def @@ -0,0 +1,4 @@ +LIBRARY exporter +EXPORTS + exported_function_stdcall@4 @15 NONAME + @exported_function_fastcall@4 @18 NONAME \ No newline at end of file diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def new file mode 100644 index 0000000000000..5a4c79a58edfd --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def @@ -0,0 +1,4 @@ +LIBRARY exporter +EXPORTS + _exported_function_stdcall@4 @15 NONAME + @exported_function_fastcall@4 @18 NONAME \ No newline at end of file diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c new file mode 100644 index 0000000000000..1fb45bf010ff2 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c @@ -0,0 +1,11 @@ +#include + +void __stdcall exported_function_stdcall(int i) { + printf("exported_function_stdcall(%d)\n", i); + fflush(stdout); +} + +void __fastcall exported_function_fastcall(int i) { + printf("exported_function_fastcall(%d)\n", i); + fflush(stdout); +} diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs b/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs new file mode 100644 index 0000000000000..07dd3d7be9b90 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs @@ -0,0 +1,20 @@ +#![feature(raw_dylib)] + +#[link(name = "exporter", kind = "raw-dylib")] +extern "stdcall" { + #[link_ordinal(15)] + fn imported_function_stdcall(i: i32); +} + +#[link(name = "exporter", kind = "raw-dylib")] +extern "fastcall" { + #[link_ordinal(18)] + fn imported_function_fastcall(i: i32); +} + +pub fn library_function() { + unsafe { + imported_function_stdcall(6); + imported_function_fastcall(125); + } +} diff --git a/src/test/ui/associated-types/substs-ppaux.rs b/src/test/ui/associated-types/substs-ppaux.rs index 66cd94d7a1b37..974a1d961a05e 100644 --- a/src/test/ui/associated-types/substs-ppaux.rs +++ b/src/test/ui/associated-types/substs-ppaux.rs @@ -25,7 +25,7 @@ fn foo<'z>() where &'z (): Sized { let x: () = >::bar::<'static, char>; //[verbose]~^ ERROR mismatched types //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {>::bar::}` + //[verbose]~| found fn item `fn() {>::bar::}` //[normal]~^^^^ ERROR mismatched types //[normal]~| expected unit type `()` //[normal]~| found fn item `fn() {>::bar::<'static, char>}` diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr index b831f3b7a76d2..cf480223da2b3 100644 --- a/src/test/ui/associated-types/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/substs-ppaux.rs:25:17 | LL | fn bar<'a, T>() where T: 'a {} - | --------------------------- fn() {>::bar::} defined here + | --------------------------- fn() {>::bar::} defined here ... LL | let x: () = >::bar::<'static, char>; | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item @@ -28,7 +28,7 @@ LL | let x: () = >::bar::<'static, char>; | expected due to this | = note: expected unit type `()` - found fn item `fn() {>::bar::}` + found fn item `fn() {>::bar::}` help: use parentheses to call this function | LL | let x: () = >::bar::<'static, char>(); diff --git a/src/test/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs b/src/test/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs new file mode 100644 index 0000000000000..23c8d75375218 --- /dev/null +++ b/src/test/ui/const-generics/generic_arg_infer/infer_arg_and_const_arg.rs @@ -0,0 +1,12 @@ +// check-pass +#![feature(generic_arg_infer)] + +struct Foo; +struct Bar; + +fn main() { + let _: Foo = Foo::<_, 1>; + let _: Foo<_, 1> = Foo::; + let _: Bar<1, _> = Bar::<_, 300>; + let _: Bar<_, 300> = Bar::<1, _>; +} diff --git a/src/test/ui/const-generics/issues/issue-62878.full.stderr b/src/test/ui/const-generics/issues/issue-62878.full.stderr index f074a65313f12..3a2b291d7ba1f 100644 --- a/src/test/ui/const-generics/issues/issue-62878.full.stderr +++ b/src/test/ui/const-generics/issues/issue-62878.full.stderr @@ -4,13 +4,6 @@ error[E0770]: the type of const parameters must not depend on other generic para LL | fn foo() {} | ^ the type must not depend on the parameter `N` -error[E0308]: mismatched types - --> $DIR/issue-62878.rs:10:15 - | -LL | foo::<_, {[1]}>(); - | ^^^ expected `usize`, found array `[{integer}; 1]` - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0308, E0770. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0770`. diff --git a/src/test/ui/const-generics/issues/issue-62878.rs b/src/test/ui/const-generics/issues/issue-62878.rs index 38f5ff77b56a9..578ce765b2fb8 100644 --- a/src/test/ui/const-generics/issues/issue-62878.rs +++ b/src/test/ui/const-generics/issues/issue-62878.rs @@ -7,6 +7,5 @@ fn foo() {} //[min]~| ERROR `[u8; _]` is forbidden as the type of a const generic parameter fn main() { - foo::<_, {[1]}>(); - //[full]~^ ERROR mismatched types + foo::<_, { [1] }>(); } diff --git a/src/test/ui/consts/miri_unleashed/tls.stderr b/src/test/ui/consts/miri_unleashed/tls.stderr index ebe2034883081..a49e50a3eaa60 100644 --- a/src/test/ui/consts/miri_unleashed/tls.stderr +++ b/src/test/ui/consts/miri_unleashed/tls.stderr @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:12:25 | LL | unsafe { let _val = A; } - | ^ cannot access thread local static (DefId(0:6 ~ tls[HASH]::A)) + | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:19:26 | LL | unsafe { let _val = &A; } - | ^ cannot access thread local static (DefId(0:6 ~ tls[HASH]::A)) + | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) warning: skipping const checks | diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs deleted file mode 100644 index 33f9c5393135f..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs +++ /dev/null @@ -1,8 +0,0 @@ -// gate-test-raw_dylib -// only-windows-gnu -#[link(name = "foo", kind = "raw-dylib")] -//~^ ERROR: kind="raw-dylib" is unstable -//~| WARNING: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr deleted file mode 100644 index 14dfadf4126f3..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu - --> $DIR/feature-gate-raw-dylib-windows-gnu.rs:3:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0658]: kind="raw-dylib" is unstable - --> $DIR/feature-gate-raw-dylib-windows-gnu.rs:3:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #58713 for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs similarity index 71% rename from src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.rs rename to src/test/ui/feature-gates/feature-gate-raw-dylib.rs index 49de24ea9ab42..995d9ced4801a 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.rs +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs @@ -1,5 +1,4 @@ -// gate-test-raw_dylib -// only-windows-msvc +// only-windows #[link(name = "foo", kind = "raw-dylib")] //~^ ERROR: kind="raw-dylib" is unstable extern "C" {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr similarity index 88% rename from src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.stderr rename to src/test/ui/feature-gates/feature-gate-raw-dylib.stderr index 1198808081213..bb64af38b2cb9 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.stderr +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr @@ -1,5 +1,5 @@ error[E0658]: kind="raw-dylib" is unstable - --> $DIR/feature-gate-raw-dylib-windows-msvc.rs:3:1 + --> $DIR/feature-gate-raw-dylib.rs:2:1 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index 2b9bcb1bf8a25..2f7faf520d969 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -9,7 +9,7 @@ note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:35:9 | LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[HASH]::make_non_send_generator::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; @@ -29,10 +29,10 @@ LL | require_send(send_gen); = help: the trait `Sync` is not implemented for `RefCell` = note: required because of the requirements on the impl of `Send` for `Arc>` = note: required because it appears within the type `[make_gen2>>::{closure#0} upvar_tys=(Arc>) {()}]` - = note: required because it appears within the type `Opaque(DefId(0:39 ~ generator_print_verbose_1[HASH]::make_gen2::{opaque#0}), [std::sync::Arc>])` - = note: required because it appears within the type `Opaque(DefId(0:42 ~ generator_print_verbose_1[HASH]::make_non_send_generator2::{opaque#0}), [])` - = note: required because it appears within the type `{Opaque(DefId(0:42 ~ generator_print_verbose_1[HASH]::make_non_send_generator2::{opaque#0}), []), ()}` - = note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:42 ~ generator_print_verbose_1[HASH]::make_non_send_generator2::{opaque#0}), []), ()}]` + = note: required because it appears within the type `Opaque(DefId(0:39 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc>])` + = note: required because it appears within the type `Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + = note: required because it appears within the type `{Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), []), ()}` + = note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:42 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), []), ()}]` note: required by a bound in `require_send` --> $DIR/generator-print-verbose-1.rs:26:25 | diff --git a/src/test/ui/generic-associated-types/issue-89352.rs b/src/test/ui/generic-associated-types/issue-89352.rs new file mode 100644 index 0000000000000..d9c656d5f58a9 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-89352.rs @@ -0,0 +1,32 @@ +// check-pass + +#![feature(generic_associated_types)] + +use std::marker::PhantomData; + +pub trait GenAssoc { + type Iter<'at>; + fn iter(&self) -> Self::Iter<'_>; + fn reborrow<'longt: 'shortt, 'shortt>(iter: Self::Iter<'longt>) -> Self::Iter<'shortt>; +} + +pub struct Wrapper<'a, T: 'a, A: GenAssoc> { + a: A::Iter<'a>, + _p: PhantomData, +} + +impl<'ai, T: 'ai, A: GenAssoc> GenAssoc for Wrapper<'ai, T, A> +where + A::Iter<'ai>: Clone, +{ + type Iter<'b> = (); + fn iter<'s>(&'s self) -> Self::Iter<'s> { + let a = A::reborrow::<'ai, 's>(self.a.clone()); + } + + fn reborrow<'long: 'short, 'short>(iter: Self::Iter<'long>) -> Self::Iter<'short> { + () + } +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index 5e56e12eda021..3e6fe789a8b55 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -4,11 +4,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { | -- ^^^^^^^^^^^^ | | - | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) T` captures the anonymous lifetime defined here + | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrAnon(0)) T` captures the anonymous lifetime defined here | -help: to declare that the `impl Trait` captures `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))` lifetime bound +help: to declare that the `impl Trait` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrAnon(0))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrAnon(0))` lifetime bound | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) { +LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrAnon(0)) { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 983d6a06afada..459198eec5a8e 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, + extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, (), ] = note: number of external vids: 3 @@ -42,7 +42,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, + extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, (), ] = note: number of external vids: 3 @@ -69,7 +69,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, + extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, (), ] = note: number of external vids: 4 @@ -105,7 +105,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, + extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, (), ] = note: number of external vids: 4 diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 88d73e7a729a9..6e8b3021d330c 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |y| y) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, + extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r), std::alloc::Global>, (), ] = note: number of external vids: 3 diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 0ab994ecd45be..2a15b1d799f84 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -1,4 +1,4 @@ -// only-windows-msvc +// only-windows #![feature(raw_dylib)] //~^ WARN the feature `raw_dylib` is incomplete diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs index d02bebc9d61d2..13c9aa01e34ae 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs @@ -1,4 +1,5 @@ -// only-i686-pc-windows-msvc +// only-x86 +// only-windows // compile-flags: --crate-type lib --emit link #![allow(clashing_extern_declarations)] #![feature(raw_dylib)] diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr index a9cfd6b23f9f8..93ca8f4d8d448 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -1,5 +1,5 @@ warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multiple-declarations.rs:4:12 + --> $DIR/multiple-declarations.rs:5:12 | LL | #![feature(raw_dylib)] | ^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(raw_dylib)] = note: see issue #58713 for more information error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions - --> $DIR/multiple-declarations.rs:14:9 + --> $DIR/multiple-declarations.rs:15:9 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs deleted file mode 100644 index e9690f03f45c9..0000000000000 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs +++ /dev/null @@ -1,8 +0,0 @@ -// only-windows-gnu -// check-pass -// compile-flags: --crate-type lib -#![feature(raw_dylib)] -//~^ WARNING: the feature `raw_dylib` is incomplete -#[link(name = "foo", kind = "raw-dylib")] -//~^ WARNING: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu -extern "C" {} diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr deleted file mode 100644 index 6e24112b3c3e5..0000000000000 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-dylib-msvc-only.rs:4:12 - | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information - -warning: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu - --> $DIR/raw-dylib-msvc-only.rs:6:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs index e5a5ac2eb2bf1..dc647fd63f527 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs @@ -1,4 +1,5 @@ -// only-x86_64-pc-windows-msvc +// only-x86_64 +// only-windows // compile-flags: --crate-type lib --emit link #![allow(incomplete_features)] #![feature(raw_dylib)] diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr index fc9008128ae43..d8a2a6af9c19e 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr @@ -1,5 +1,5 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture - --> $DIR/unsupported-abi.rs:7:5 + --> $DIR/unsupported-abi.rs:8:5 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr b/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr index 07d194476a5db..8c15e4254516d 100644 --- a/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr +++ b/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr @@ -1,4 +1,4 @@ -error: cannot specialize on `Binder(ProjectionPredicate(ProjectionTy { substs: [V], item_def_id: DefId(0:6 ~ repeated_projection_type[HASH]::Id::This) }, (I,)), [])` +error: cannot specialize on `Binder(ProjectionPredicate(ProjectionTy { substs: [V], item_def_id: DefId(0:6 ~ repeated_projection_type[54ea]::Id::This) }, (I,)), [])` --> $DIR/repeated_projection_type.rs:19:1 | LL | / impl> X for V { diff --git a/src/test/ui/symbol-names/basic.legacy.stderr b/src/test/ui/symbol-names/basic.legacy.stderr index e0e798dac40f1..41f8ecf4ba750 100644 --- a/src/test/ui/symbol-names/basic.legacy.stderr +++ b/src/test/ui/symbol-names/basic.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN5basic4main17h) +error: symbol-name(_ZN5basic4main17h13492e1c4157543fE) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic::main::h) +error: demangling(basic::main::h13492e1c4157543f) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/basic.v0.stderr b/src/test/ui/symbol-names/basic.v0.stderr index 27308fc5ec33e..1f02781364eba 100644 --- a/src/test/ui/symbol-names/basic.v0.stderr +++ b/src/test/ui/symbol-names/basic.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvCsCRATE_HASH_5basic4main) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic[HASH]::main) +error: demangling(basic[b751b4a00e2291d9]::main) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/impl1.legacy.stderr b/src/test/ui/symbol-names/impl1.legacy.stderr index b17a073ee496a..b6012e41594b5 100644 --- a/src/test/ui/symbol-names/impl1.legacy.stderr +++ b/src/test/ui/symbol-names/impl1.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN5impl13foo3Foo3bar17h) +error: symbol-name(_ZN5impl13foo3Foo3bar17) --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(impl1::foo::Foo::bar::h) +error: demangling(impl1::foo::Foo::bar::) --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] @@ -22,13 +22,13 @@ error: def-path(foo::Foo::bar) LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ -error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h) +error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17) --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(impl1::bar::::baz::h) +error: demangling(impl1::bar::::baz::) --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] @@ -46,13 +46,13 @@ error: def-path(bar::::baz) LL | #[rustc_def_path] | ^^^^^^^^^^^^^^^^^ -error: symbol-name(_ZN209_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$C$$u20$...$RP$$u2b$impl1..AutoTrait$u3b$$u20$3$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method17h) +error: symbol-name(_ZN209_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$C$$u20$...$RP$$u2b$impl1..AutoTrait$u3b$$u20$3$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method17) --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method::h) +error: demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method::) --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/impl1.v0.stderr b/src/test/ui/symbol-names/impl1.v0.stderr index 06778e57fb116..48f7473b6a0d1 100644 --- a/src/test/ui/symbol-names/impl1.v0.stderr +++ b/src/test/ui/symbol-names/impl1.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13fooNtB_3Foo3bar) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(::bar) +error: demangling(::bar) --> $DIR/impl1.rs:14:9 | LL | #[rustc_symbol_name] @@ -28,7 +28,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13barNtNtB_3foo3Foo3baz) LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(::baz) +error: demangling(::baz) --> $DIR/impl1.rs:32:9 | LL | #[rustc_symbol_name] @@ -52,7 +52,7 @@ error: symbol-name(_RNvXNCNvCsCRATE_HASH_5impl14mains_0ARDNtB_3Foop5AssocFG LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<[&dyn impl1[HASH]::Foo extern "C" fn(&'a u8, ...)> + impl1[HASH]::AutoTrait; 3usize] as impl1[HASH]::main::{closure#1}::Bar>::method) +error: demangling(<[&dyn impl1[2c09c4f1c7c8e90c]::Foo extern "C" fn(&'a u8, ...)> + impl1[2c09c4f1c7c8e90c]::AutoTrait; 3usize] as impl1[2c09c4f1c7c8e90c]::main::{closure#1}::Bar>::method) --> $DIR/impl1.rs:62:13 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/issue-60925.legacy.stderr b/src/test/ui/symbol-names/issue-60925.legacy.stderr index 46cb84e57bf1c..d26e71842f9b5 100644 --- a/src/test/ui/symbol-names/issue-60925.legacy.stderr +++ b/src/test/ui/symbol-names/issue-60925.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h) +error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hd250581ce0d79d13E) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(issue_60925::foo::Foo::foo::h) +error: demangling(issue_60925::foo::Foo::foo::hd250581ce0d79d13) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/issue-60925.v0.stderr b/src/test/ui/symbol-names/issue-60925.v0.stderr index 1cddba920854f..408c957c6a144 100644 --- a/src/test/ui/symbol-names/issue-60925.v0.stderr +++ b/src/test/ui/symbol-names/issue-60925.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvMNtCsCRATE_HASH_11issue_609253fooINtB_3FooNtNtB LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(>::foo) +error: demangling(>::foo) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/issue-75326.legacy.stderr b/src/test/ui/symbol-names/issue-75326.legacy.stderr index 74e481badb065..aadc0cf43a212 100644 --- a/src/test/ui/symbol-names/issue-75326.legacy.stderr +++ b/src/test/ui/symbol-names/issue-75326.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next17h) +error: symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next17SYMBOL_HASH) --> $DIR/issue-75326.rs:41:5 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling( as issue_75326::Iterator2>::next::h) +error: demangling( as issue_75326::Iterator2>::next::SYMBOL_HASH) --> $DIR/issue-75326.rs:41:5 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/issue-75326.v0.stderr b/src/test/ui/symbol-names/issue-75326.v0.stderr index 446fb8d6cf6f1..3d7803a0c3b9f 100644 --- a/src/test/ui/symbol-names/issue-75326.v0.stderr +++ b/src/test/ui/symbol-names/issue-75326.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvXINICsCRATE_HASH_11issue_75326s_0pppEINtB_3FooppENtB LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling( as issue_75326[HASH]::Iterator2>::next) +error: demangling( as issue_75326[e8e253d78520f2a2]::Iterator2>::next) --> $DIR/issue-75326.rs:41:5 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/symbol-names/trait-objects.v0.stderr b/src/test/ui/symbol-names/trait-objects.v0.stderr index 6c5e55ed2aeab..47192ce5b8389 100644 --- a/src/test/ui/symbol-names/trait-objects.v0.stderr +++ b/src/test/ui/symbol-names/trait-objects.v0.stderr @@ -4,7 +4,7 @@ error: symbol-name(_RNvXCsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4cor LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[HASH]::Bar>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[7260a56bea9f357b]::Bar>::method) --> $DIR/trait-objects.rs:15:5 | LL | #[rustc_symbol_name] @@ -22,7 +22,7 @@ error: symbol-name(_RNvXs_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4c LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[HASH]::Foo>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Foo>::method) --> $DIR/trait-objects.rs:27:5 | LL | #[rustc_symbol_name] @@ -40,7 +40,7 @@ error: symbol-name(_RNvXs0_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4 LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[HASH]::Baz>::method) +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Baz>::method) --> $DIR/trait-objects.rs:39:5 | LL | #[rustc_symbol_name] diff --git a/src/test/ui/thir-tree.stdout b/src/test/ui/thir-tree.stdout index a732eb68a2bca..3c84be8e8f8d8 100644 --- a/src/test/ui/thir-tree.stdout +++ b/src/test/ui/thir-tree.stdout @@ -1,4 +1,4 @@ -DefId(0:3 ~ thir_tree[HASH]::main): +DefId(0:3 ~ thir_tree[8f1d]::main): Thir { arms: [], exprs: [ @@ -30,7 +30,7 @@ Thir { region_scope: Node(2), lint_level: Explicit( HirId { - owner: DefId(0:3 ~ thir_tree[HASH]::main), + owner: DefId(0:3 ~ thir_tree[8f1d]::main), local_id: 2, }, ), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f039ba59d231c..d06e48df11b52 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3486,10 +3486,12 @@ impl<'test> TestCx<'test> { // with placeholders as we do not want tests needing updated when compiler source code // changes. // eg. $SRC_DIR/libcore/mem.rs:323:14 becomes $SRC_DIR/libcore/mem.rs:LL:COL - normalized = Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?") - .unwrap() - .replace_all(&normalized, "SRC_DIR$1:LL:COL") - .into_owned(); + lazy_static! { + static ref SRC_DIR_RE: Regex = + Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?").unwrap(); + } + + normalized = SRC_DIR_RE.replace_all(&normalized, "SRC_DIR$1:LL:COL").into_owned(); normalized = Self::normalize_platform_differences(&normalized); normalized = normalized.replace("\t", "\\t"); // makes tabs visible @@ -3498,73 +3500,38 @@ impl<'test> TestCx<'test> { // since they duplicate actual errors and make the output hard to read. // This mirrors the regex in src/tools/tidy/src/style.rs, please update // both if either are changed. - normalized = - Regex::new("\\s*//(\\[.*\\])?~.*").unwrap().replace_all(&normalized, "").into_owned(); + lazy_static! { + static ref ANNOTATION_RE: Regex = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap(); + } + + normalized = ANNOTATION_RE.replace_all(&normalized, "").into_owned(); + + // This code normalizes various hashes in v0 symbol mangling that is + // emitted in the ui and mir-opt tests. + lazy_static! { + static ref V0_CRATE_HASH_PREFIX_RE: Regex = + Regex::new(r"_R.*?Cs[0-9a-zA-Z]+_").unwrap(); + static ref V0_CRATE_HASH_RE: Regex = Regex::new(r"Cs[0-9a-zA-Z]+_").unwrap(); + } - // This code normalizes various hashes in both - // v0 and legacy symbol names that are emitted in - // the ui and mir-opt tests. - // - // Some tests still require normalization with headers. - const DEFID_HASH_REGEX: &str = r"\[[0-9a-z]{4}\]"; - const DEFID_HASH_PLACEHOLDER: &str = r"[HASH]"; - const V0_DEMANGLING_HASH_REGEX: &str = r"\[[0-9a-z]+\]"; - const V0_DEMANGLING_HASH_PLACEHOLDER: &str = r"[HASH]"; - const V0_CRATE_HASH_PREFIX_REGEX: &str = r"_R.*?Cs[0-9a-zA-Z]+_"; - const V0_CRATE_HASH_REGEX: &str = r"Cs[0-9a-zA-Z]+_"; const V0_CRATE_HASH_PLACEHOLDER: &str = r"CsCRATE_HASH_"; - const V0_BACK_REF_PREFIX_REGEX: &str = r"\(_R.*?B[0-9a-zA-Z]_"; - const V0_BACK_REF_REGEX: &str = r"B[0-9a-zA-Z]_"; - const V0_BACK_REF_PLACEHOLDER: &str = r"B_"; - const LEGACY_SYMBOL_HASH_REGEX: &str = r"h[\w]{16}E?\)"; - const LEGACY_SYMBOL_HASH_PLACEHOLDER: &str = r"h)"; - let test_name = self - .output_testname_unique() - .into_os_string() - .into_string() - .unwrap() - .split('.') - .next() - .unwrap() - .replace("-", "_"); - // Normalize `DefId` hashes - let defid_regex = format!("{}{}", test_name, DEFID_HASH_REGEX); - let defid_placeholder = format!("{}{}", test_name, DEFID_HASH_PLACEHOLDER); - normalized = Regex::new(&defid_regex) - .unwrap() - .replace_all(&normalized, defid_placeholder) - .into_owned(); - // Normalize v0 demangling hashes - let demangling_regex = format!("{}{}", test_name, V0_DEMANGLING_HASH_REGEX); - let demangling_placeholder = format!("{}{}", test_name, V0_DEMANGLING_HASH_PLACEHOLDER); - normalized = Regex::new(&demangling_regex) - .unwrap() - .replace_all(&normalized, demangling_placeholder) - .into_owned(); - // Normalize v0 crate hashes (see RFC 2603) - let symbol_mangle_prefix_re = Regex::new(V0_CRATE_HASH_PREFIX_REGEX).unwrap(); - if symbol_mangle_prefix_re.is_match(&normalized) { + if V0_CRATE_HASH_PREFIX_RE.is_match(&normalized) { // Normalize crate hash - normalized = Regex::new(V0_CRATE_HASH_REGEX) - .unwrap() - .replace_all(&normalized, V0_CRATE_HASH_PLACEHOLDER) - .into_owned(); + normalized = + V0_CRATE_HASH_RE.replace_all(&normalized, V0_CRATE_HASH_PLACEHOLDER).into_owned(); + } + + lazy_static! { + static ref V0_BACK_REF_PREFIX_RE: Regex = Regex::new(r"\(_R.*?B[0-9a-zA-Z]_").unwrap(); + static ref V0_BACK_REF_RE: Regex = Regex::new(r"B[0-9a-zA-Z]_").unwrap(); } - let back_ref_prefix_re = Regex::new(V0_BACK_REF_PREFIX_REGEX).unwrap(); - if back_ref_prefix_re.is_match(&normalized) { + + const V0_BACK_REF_PLACEHOLDER: &str = r"B_"; + if V0_BACK_REF_PREFIX_RE.is_match(&normalized) { // Normalize back references (see RFC 2603) - let back_ref_regex = format!("{}", V0_BACK_REF_REGEX); - let back_ref_placeholder = format!("{}", V0_BACK_REF_PLACEHOLDER); - normalized = Regex::new(&back_ref_regex) - .unwrap() - .replace_all(&normalized, back_ref_placeholder) - .into_owned(); + normalized = + V0_BACK_REF_RE.replace_all(&normalized, V0_BACK_REF_PLACEHOLDER).into_owned(); } - // Normalize legacy mangled symbols - normalized = Regex::new(LEGACY_SYMBOL_HASH_REGEX) - .unwrap() - .replace_all(&normalized, LEGACY_SYMBOL_HASH_PLACEHOLDER) - .into_owned(); // Custom normalization rules for rule in custom_rules {