linker: Add a linker rerun hack for gcc versions not supporting -static-pie
Which mirrors the existing `-no-pie` linker rerun hack, but the logic is a bit more elaborated in this case.
If the linker (gcc or clang) errors on `-static-pie` we rerun in with `-static` instead.
We must also replace CRT objects corresponding to `-static-pie` with ones corresponding to `-static` in this case.
(One sanity check for CRT objects in target specs is also added as a drive-by fix.)
To do in the future: refactor all linker rerun hacks into separate functions and share more code with `add_(pre,post)_link_objects`.
This PR accompanies https://github.com/rust-lang/rust/pull/71804 and unblocks https://github.com/rust-lang/rust/pull/70740.
Make `PolyTraitRef::self_ty` return `Binder<Ty>`
This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
Make `PolyTraitRef::self_ty` return `Binder<Ty>`
This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
de-promote Duration::from_secs
In https://github.com/rust-lang/rust/pull/67531, we removed the `rustc_promotable` attribute from a bunch of `Duration` methods, but not from `Duration::from_secs`. This makes the current list of promotable functions the following (courtesy of @ecstatic-morse):
* `INT::min_value`, `INT::max_value`
* `std::mem::size_of`, `std::mem::align_of`
* `RangeInclusive::new` (backing `x..=y`)
* `std::ptr::null`, `std::ptr::null_mut`
* `RawWaker::new`, `RawWakerVTable::new` ???
* `Duration::from_secs`
I feel like the last one stands out a bit here -- the rest are all very core language primitives, and `RawWaker` has a strong motivation for getting a `'static` vtable. But a `&'static Duration`? That seems unlikely. So I propose we no longer promote calls to `Duration::from_secs`, which is what this PR does.
https://github.com/rust-lang/rust/pull/67531 saw zero regressions and I am not aware of anyone complaining that this broke their (non-cratered) code, so I consider it likely the same will be true here, but of course we'd do a crater run.
See [this document](https://github.com/rust-lang/const-eval/blob/master/promotion.md) for some more background on promotion and https://github.com/rust-lang/const-eval/issues/19 for some of the concerns around promoting function calls.
Add doc for checking if type defines specific method
This PR adds documentation on how:
- check if a type defines a specific method
- check an expr is calling a specific method
closes: #3843
changelog: none
Cleanup: Use rustc's `same_type` for our `same_tys`
This delegates our `same_tys` to [ty::TyS::same_type][same_type] to
remove some duplication.
Our `same_tys` was introduced 4 years ago in #730. Before, it was
building an inference context to be able to call
`can_eq` to compare the types. The `rustc-dev-guide` has some more details
about `can_eq` in [Type Inference -> Trying equality][try_eq].
Now, using the rustc function, we are essentially comparing the `DefId`s
of the given types, which also makes more sense, IMO.
I also confirmed that the FIXME is resolved via a bit of `dbg!`, however
no UI tests seem to have been affected.
[same_type]: 659951c4a0/src/librustc_middle/ty/util.rs (L777)
[try_eq]: https://rustc-dev-guide.rust-lang.org/type-inference.html#trying-equality
---
changelog: none
Fix cargo tests when running inside the rustlang/rust repo
It seems we hit https://github.com/rust-lang/cargo/issues/5418, so I've applied the suggested solution. Also added some more info when cargo-metadata fails to execute.
(there was no open issue for this)
changelog: none
resolve: Sort E0408 errors by Symbol str
This is a request for comments implementing my suggested solution to https://github.com/rust-lang/rust/issues/72913
Previously errors were sorted by Symbol index instead of the string. The indexes are not the same between architectures because Symbols for architecture extensions (e.g. x86 AVX or RISC-V d) are interned before the source file is parsed. RISC-V's naming of extensions after single letters led to it having errors sorted differently for test cases using single letter variable names. Instead sort the errors by the Symbol string so that it is stable across architectures.
While I was at it, there's also 8edb05c2 skipping some ui tests which I think are irrelevant for risc-v.
Rollup of 5 pull requests
Successful merges:
- #72260 (Spell out `Self` in async function return)
- #72996 (Remove unsused `NodeId` related APIs in hir map)
- #73010 (Update RELEASES.md)
- #73017 (Use assert_eq for liballoc test)
- #73019 (add test for #72960)
Failed merges:
r? @ghost
Replace all remaining occurrences of submodule with subtree
r? @phansch
I should have included this in #5686, but forgot about it, so here we go again.
changelog: none