rustdoc: attempt full build for compile_fail test
Some code fails when doing a full build but does not fail when only emitting metadata. This commit makes sure compile_fail tests for such code behave as expected, that is, the test succeeds because the compilation fails.
Fixes#67771.
Account for HR lifetimes when suggesting introduction of named lifetime
```
error[E0106]: missing lifetime specifier
--> src/test/ui/suggestions/fn-missing-lifetime-in-item.rs:2:32
|
2 | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
| ---- ---- ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
2 | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
| ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^
help: consider introducing a named lifetime parameter
|
2 | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);=
| ^^^ ^^^^^^^ ^^^^^^^ ^^^
```
Follow up to #68267. Addresses the diagnostics part of #49287.
Move datatypes definitions in specific modules inside rustc::{traits, infer}
Prelude to #67953
Some data types inside `rustc::traits` and `rustc::infer` are used in other parts of `librustc`. These cannot go to a separate crate `librustc_infer`.
This PR moves those data types to `traits::types` and `infer::types` modules, from where everything is reexported.
Note for review: some imports feature the `crate -> rustc` substitution. This is cruft from the splitting out of #67953. This can be reverted, but are bound to be put back by #67953.
r? @Centril
cc @Zoxc
windows-gnu: prefer system crt libraries if they are available
The origin of the issue is the fact Rust ships mingw-w64 libraries but no headers and prefers own libraries over the system ones.
This leads to situation when headers aren't compatible with libraries (mingw-w64 doesn't provide any forward compatibility and AFAIK backwards compatibility is guaranteed only within major release series).
It's easier to understand how this PR works when looking at the linker invocation before and with this PR: https://www.diffchecker.com/GEuYFmzo
It adds system libraries path before Rust libraries so the linker will prefer them.
It has potential issue when system has files with the same names as Rust but that could be avoided by moving Rust shipped mingw-w64 libraries from `lib/rustlib/x86_64-pc-windows-gnu/lib` to say `lib/rustlib/x86_64-pc-windows-gnu/lib/mingw`. Then adding linker paths in this order: Rust libraries, system libraries, Rust shipped mingw-w64 libraries.
Fixes#47048Fixes#49078Fixes#53454Fixes#60912
Merge item id stable hashing functions
Supersedes https://github.com/rust-lang/rust/pull/67999 splitting out the pure cleanup bits, i.e. merging `hash_item_id`, `hash_impl_item_id` and `hash_trait_item_id` into a common `hash_reference_to_item`.
r? @michaelwoerister
Make more arithmetic functions unstably const
This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146.
This makes the following things unstably const.
- `feature = const_int_unchecked_arith`
- `intrinsics::unchecked_add`
- `intrinsics::unchecked_sub`
- `intrinsics::unchecked_mul`
- `intrinsics::unchecked_div`
- `intrinsics::unchecked_rem`
- `feature = const_checked_int_methods`
- `checked_add`
- `checked_sub`
- `checked_mul`
- `checked_div` (Uses `intrinsics::unchecked_div` internally)
- `checked_rem` (Uses `intrinsics::unchecked_rem` internally)
- `checked_neg`
- `checked_shl`
- `checked_shr`
- `checked_abs`
- `feature = const_saturating_int_methods`
- `saturating_mul`
- `saturating_neg` (Uses `intrinsics::unchecked_sub` internally)
- `saturating_abs` (Uses `intrinsics::unchecked_sub` internally)
- `feature = const_wrapping_int_methods`
- `wrapping_div`
- `wrapping_rem`
- `feature = const_overflowing_int_methods`
- `overflowing_div`
- `overflowing_rem`
- `feature = const_euclidean_int_methods`
- `checked_div_euclid`
- `checked_rem_euclid`
- `wrapping_div_euclid`
- `wrapping_rem_euclid`
- `overflowing_div_euclid`
- `overflowing_rem_euclid`
Exponentiation and operations on the `NonZero` types are left to a later PR.
r? @oli-obk
cc @rust-lang/wg-const-eval @rust-lang/libs