CFI: Skip non-passed arguments
Rust will occasionally rely on fn((), X) -> Y being compatible with fn(X) -> Y, since () is a non-passed argument. Relax CFI by choosing not to encode non-passed arguments.
This PR was split off from #121962 as part of fixing the larger vtable compatibility issues.
r? `@workingjubilee`
This makes it easier to read the trait definition for newcomers:
Sorted from least “complex” to most “complex” followed by trivial “plumbing”
and grouped by area.
* Move `allow_infer` above all `*_infer` methods
* It's the least complex method of those
* Allows the `*_infer` to be placed right next to each other
* Move `probe_ty_param_bounds` further down right next to `lower_assoc_ty` and `probe_adt`
* It's more complex than the `infer` methods, it should come “later”
* Now all required lowering functions are grouped together
* Move the “plumbing” function `set_tainted_by_errors` further down
below any actual lowering methods.
* Provided method should come last
Most of the tracing calls didn't fully leverage the power of `tracing`.
For example, several of them used to hard-code method names / tracing spans
as well as variable names. Use `#[instrument]` and `?var` / `%var` (etc.) instead.
In my opinion, this is the proper way to migrate them from the old
AstConv nomenclature to the new HIR ty lowering one.
Several (doc) comments were super outdated or didn't provide enough context.
Some doc comments shoved everything in a single paragraph without respecting
the fact that the first paragraph should be a single sentence because rustdoc
treats these as item descriptions / synopses on module pages.
Remove SpecOptionPartialEq
With the recent LLVM bump, the specialization for Option::partial_eq on types with niches is no longer necessary. I kept the manual implementation as it still gives us better codegen than the derive (will look at this seperately).
Also implemented PartialOrd/Ord by hand as it _somewhat_ improves codegen for #49892: https://godbolt.org/z/vx5Y6oW4Y
Rollup of 11 pull requests
Successful merges:
- #121881 (std::net: adding acceptfilter feature for netbsd/freebsd.)
- #122817 (Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order)
- #122826 (Add tests for shortcomings of associated type bounds)
- #122829 (Implement `FusedIterator` for `gen` block)
- #122831 (make failure logs less verbose)
- #122837 (add test for #122549)
- #122838 (Avoid noop rewrite of issues.txt)
- #122841 (add 2 more tests for issues fixed by #122749)
- #122843 (Add a never type option to make diverging blocks `()`)
- #122844 (add test for ice "cannot relate region: LUB(ReErased, ReError)")
- #122845 (Clippy subtree update)
r? `@ghost`
`@rustbot` modify labels: rollup
Add a never type option to make diverging blocks `()`
More experiments for ~~the blood god~~ T-lang!
Usage example:
```rust
#![allow(internal_features)]
#![feature(never_type, rustc_attrs)]
#![rustc_never_type_options(diverging_block_default = "unit")]
fn main() {
let _: u8 = { //~ error: expected `u8`, found `()`
return;
};
}
```
r? compiler-errors
I'm not sure how I feel about parsing the attribute every time we create `FnCtxt`. There must be a better way to do this, right?
Add tests for shortcomings of associated type bounds
Adds the test in https://github.com/rust-lang/rust/pull/122791#issuecomment-2011433015
Turns out that #121123 is what breaks `tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs` (passes on nightly), but given that associated type bounds haven't landed anywhere yet, I'm happy with breaking it.
This is unrelated to #122791, which just needed that original commit e6b64c6194 stacked on top of it so that it wouldn't have tests failing.
r? lcnr
Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order
This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types.
I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate.
The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.
Rust will occasionally rely on fn((), X) -> Y being compatible with
fn(X) -> Y, since () is a non-passed argument. Relax CFI by choosing not
to encode non-passed arguments.
select Vec::from_iter impls in a const block to optimize compile times
Ignoring whitespace diffs should make this easier to review.
This relies on the trick from #122301
Split out from #120682
Fix documentation typo "appects" > "affects"
changelog: none
This fixes a typo in the `iter_filter_is_some` and `iter_filter_is_ok` lint documentation.
Allow `llvm.x86.sse2.pause` instrinsic to be called without SSE2
The instrinsic is compiled to a `pause` instruction, which behaves like a no-op when SSE2 is not available.
https://www.felixcloutier.com/x86/pause.html