Don't use disk-cache for query `def_kind`
From what I can tell, the `def_kind` query has no local provider, and is always given its value via query feeding, usually from `TyCtxt::create_def`.
If that's the case, there should never be any opportunity for a previous value to be loaded from disk-cache, so serializing the current-session values is a waste of time.
build_helper: fix yarn locking, add check, and bump lockfile
fixesrust-lang/rust#154446
cc @aDotInTheVoid, @GuillaumeGomez
not sure if this needs review from t-rustdoc, t-bootstrap, or both.
Add integer truncation and extension methods
Tracking issue: https://github.com/rust-lang/rust/issues/154330
This provides `.truncate()`, `.saturating_truncate()`, `.checked_truncate()`, and `.extend()`.
These only work within the same signedness (use `.cast_signed()` and `.cast_unsigned()` to change sign).
The truncation methods only work to smaller (or equal) types. `.extend()` only works to larger (or equal) types.
For the purposes of truncation and extending, `u128` is considered larger than or equal to the size of `usize`, and `usize` is considered larger than `u16` or `u8`. We might, in the future, want to consider ways to expand this.
Much of this was pair-programmed with @Amanieu.
In order to seal the new traits, this PR also adds a `core::sealed::Sealed`, like the one in `std`. I didn't modify `std` to re-export the same one, since by definition it isn't nameable, and since doing that would require that it be nameable (even if it was `#[unstable]`).
Rollup of 5 pull requests
Successful merges:
- rust-lang/rust#152935 (c-variadic: error when we can't guarantee that the backend does the right thing)
- rust-lang/rust#153207 (std::net: clamp linger timeout value to prevent silent truncation.)
- rust-lang/rust#154592 (Fix `mismatched_lifetime_syntaxes` suggestions for hidden path lifetimes)
- rust-lang/rust#154643 (fix pin docs)
- rust-lang/rust#154648 (Clarify `ty::List`)
fix pin docs
This PR fixes a small grammatical error in the projection section of the pin docs. There is probably more than one answer for the fix, but I felt that this correction was the *smallest*.
std::net: clamp linger timeout value to prevent silent truncation.
Duration::as_secs() returns u64 but l_linger field type is narrower, c_int on most unix platforms, c_ushort on cygwin and windows. clamping before the cast, consistent with how set_timeout handles this.
Rollup of 2 pull requests
Successful merges:
- rust-lang/rust#154249 (Mention on which items the `missing_doc_code_examples` is not emitted)
- rust-lang/rust#154266 (UdpSocket: document `recv/recv_from` differences)
From what I can tell, the `def_kind` query has no local provider, and is always
given its value via query feeding, usually from `TyCtxt::create_def`.
If that's the case, there should never be any opportunity for a previous value
to be loaded from disk-cache, so serializing the current-session values is a
waste of time.
specifically this emits an error when
- a custom target is used
- `RiscV32 if self.llvm_abiname == "ilp32e"` this abi is used for 32-bit
embedded targets, and clang/llvm document that the ABI may change in
the future.
UdpSocket: document `recv/recv_from` differences
Per libs-api consensus, fixesrust-lang/rust#149392 by documenting possible platform-specific behavior in `UdpSocket`.
r? libs
Mention on which items the `missing_doc_code_examples` is not emitted
As mentioned in rust-lang/rust#154048, the lint's documentation didn't mention which items were ignored. This PR fixes that.
r? @lolbinarycat
- Merge the `List` and `ListWithCachedTypeInfo` impls by referring to
the shared underlying type, `RawList`. This required increasing the
visibility of `RawList`.
- Explain why a separate impl is needed for `RawList`.
- Remove an incorrect FIXME comment. Fat reference types will always
need a separate impl. (To be sure, one could use `T: ?Sized` to merge
the impls for `&T` and `&[T]` and it would compile but it would behave
incorrectly because `&T` needs one word of storage and `&[T]` needs
two words of storage. I tried it and it did not go well.)
- Add some explanatory comments.
- Rename `OpaqueListContents` as `ExternTy`. I've always found both the
"opaque" and "contents" parts of this name to be confusing. Calling it
`ExternTy` makes it clear that all that matters is it's an extern
type.
This provides `.truncate()`, `.saturating_truncate()`,
`.checked_truncate()`, and `.extend()`.
These only work within the same signedness (use `.cast_signed()` and
`.cast_unsigned()` to change sign).
The truncation methods only work to smaller (or equal) types.
`.extend()` only works to larger (or equal) types.
For the purposes of truncation and extending, `usize` is considered
larger than `u16` or `u8`. This is consistent with `From`/`Into`
conversions.
Adding these methods results in needing to update the output of one test
that gets a new method-name similarity result.
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Use `Hcx`/`hcx` consistently for `StableHashingContext`.
The `HashStable` and `ToStableHashKey` traits both have a type parameter that is sometimes called `CTX` and sometimes called `HCX`. (In practice this type parameter is always instantiated as `StableHashingContext`.) Similarly, variables with these types are sometimes called `ctx` and sometimes called `hcx`. This inconsistency has bugged me for some time.
The `HCX`/`hcx` form is more informative (the `H`/`h` indicates what type of context it is) and it matches other cases like `tcx`, `dcx`, `icx`.
Also, RFC 430 says that type parameters should have names that are "concise UpperCamelCase, usually single uppercase letter: T". In this case `H` feels insufficient, and `Hcx` feels better.
Therefore, this commit changes the code to use `Hcx`/`hcx` everywhere.
r? @petrochenkov
add rustc option -Zpacked-stack
this enables `-Zpacked-stack` just as `-mpacked-stack` in clang and gcc. packed-stack is needed on s390x for kernel development.
For reference: rust-lang/rust#151154 and rust-lang/rust#150766
look at @uweigand s post for full explanation of what this does. Here a wrap-up:
https://github.com/rust-lang/rust/pull/150766#issuecomment-3729074303
> [...]
> packed-stack [...] modifies how the compiler-generated function prolog/epilog code makes use of the 160 byte register save area provided by a caller to the callee [...] this variant is not actually incompatible with the ABI - packed-stack and regular functions can freely call each other without ABI issues.
> [...]
> combination of -mpacked-stack and -mbackchain [...] the location in the stack frame where the backchain link ought to be stored is not available. [...] is not supported at all with the default ABI
> [...]
> However, in the special case of also using soft-float, our (implied) soft-float ABI provides a different location for the backchain that is compatible with -mpacked-stack, so that combination should be supported
> [...]
Update libc to v0.2.183
Follow-up of https://github.com/rust-lang/rust/pull/150484.
This PR updates libc to include the latest patches to make rtems target (and probably others) compile again.
Simplify the `cache_on_disk_if` modifier to just `cache_on_disk`
Thanks to https://github.com/rust-lang/rust/pull/154304, there is now only one remaining query with a non-trivial cache-on-disk condition (`check_liveness`). But prior experiments at https://github.com/rust-lang/rust/pull/153441#issuecomment-4009037104 indicate that `check_liveness` can also be made non-disk-caching with little or no measurable effect.
This PR takes advantage of those facts to replace the `cache_on_disk_if` modifier with a simpler `cache_on_disk` modifier:
- When combined with `separate_provide_extern`, only values for “local” keys are cached to disk.
- For any other query with `cache_on_disk`, values are cached to disk unconditionally.
r? nnethercote (or compiler)
Add a test for a now fixed ICE with `offset_of!()`
Adds a test for rust-lang/rust#125805, which was an ICE with `offset_of!()` on a field with the type of a trait object missing `dyn` and a required lifetime parameter.
Closesrust-lang/rust#125805.
misc test cleanups
These are some mixed cleanups to `tests/ui` that individually seemed too small for a PR of their own. Some duplicated tests are removed, `issues-*` tests are renamed and more FIXMEs are added to `ui/README.md`.
Reasoning for the deleted tests:
* `tests/ui/associated-types/issue-47814.rs`: duplicate of `tests/ui/associated-consts/issue-47814.rs`
* rename `tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs` to `.../nested-copy-drops-83176.rs` since rust-lang/rust#78720 was not the correct issue, rust-lang/rust#83176 was.
* `tests/ui/specialization/defaultimpl/specialization-feature-gate-default.rs`: duplicate of `tests/ui/specialization/specialization-feature-gate-default.rs`
* `fn/issue-1900.rs`: duplicate of `error-codes/E0131.rs`
r? @Kivooeo
refactor: remove `Adjust::ReborrowPin`
Followed by rust-lang/rust#149130, this PR removes `Adjust::ReborrowPin` and use an `Adjust::Deref(DerefAdjustKind::Pin)` followed by an `Adjust::Borrow(AutoBorrow::Pin)` instead.
Fix AtomicPtr::update's cfg gate
I'm *pretty* sure this is supposed to be `#[cfg(target_has_atomic = "ptr")]` like `AtomicPtr::try_update` is.
cc @GrigorenkoPV (author), @Noratrieb (r+ to rust-lang/rust#133829)
Update flate2 users to use zlib-rs
flate2 is looking to make zlib-rs the default.
Go ahead and make build-manifest and rust-installer use it, to make sure it
doesn't introduce any issues.