Allow specifying LLVM's MCTargetOptions::ABIName in target specification files
This addresses #65024, as it allows RISC-V target specification files to set `"llvm-abiname": "lp64d"`.
Other languages (read: C) usually expose this codegen parameter under a compiler argument like `-mabi=<XYZ>`.
Improve MaybeUninit::get_{ref,mut} documentation
As mentioned in https://github.com/rust-lang/rust/issues/63568#issuecomment-544106668, `MaybeUninit`'s `get_{ref,mut}` documentation is lacking, so this PR attempts to fix that.
That being said, and as @RalfJung mentions in that thread,
> In particular, we should clarify that all the UB rules for these methods equally apply when calling the raw ptr methods and creating a reference manually.
these other docs also need to be improved, which I can do in this PR ~~(hence the `[WIP]`)~~.
Finally, since all these documentations are related to clearly establishing when dealing with uninitialized memory which patterns are known to be sound and which patterns are currently UB (that is, until, if ever, the rules around references to unintialized integers get relaxed, this documentation will treat them as UB, and advise against such patterns (_e.g._, it is not possible to use uninitialized buffers with the `Read` API)), I think that adding even more examples to the main documentation of `MaybeUninit` inherent definition wouldn't hurt either.
___
- [Rendered](http://dreamy-ritchie-99d637.netlify.com/core/mem/union.maybeuninit#method.get_ref)
Rollup of 10 pull requests
Successful merges:
- #65136 (Update codegen option documentation.)
- #65574 (docs: improve disclaimer regarding LinkedList)
- #65720 (Add FFI bindings for LLVM's Module::getInstructionCount())
- #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`)
- #65962 (Fix logic in example.)
- #66019 (Improved std::iter::Chain documentation)
- #66038 (doc(str): show example of chars().count() under len())
- #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait)
- #66073 (Do not needlessly write-lock)
- #66096 (Add a failing UI test for multiple loops of all kinds in a `const`)
Failed merges:
r? @ghost
Add a failing UI test for multiple loops of all kinds in a `const`
This simply demonstrates the current behavior and ensures we don't allow anything by accident.
The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-`while` loops in a `const`, and there were no tests with multiple loops.
Suggest correct code when encountering an incorrect trait bound referencing the current trait
Fixes#65985 and also improves the suggestion for code like this:
```
trait Grab {
type Value;
fn grab(&self) -> Grab::Value;
}
```
To suggest `<Self as Grab>::Value`.
I wasn't sure which of the syntax versions is better (`<Self as ..>::` vs `Self::`), so I used the former simply because it was less change to the existing code.
r? @estebank
doc(str): show example of chars().count() under len()
the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.
Improved std::iter::Chain documentation
Replaces `strings two iterators` by `links two iterators` in `std::iter::Chain` documentation.
I didn't find any meaning of `strings` which can be evaluated as `links` or `joins`.
I don't think that `std::iter:Chain` works as a stringer or plays billiards. (https://www.lexico.com/en/definition/string).
Add FFI bindings for LLVM's Module::getInstructionCount()
Just to make it usable for profiling and such inside
rustc itself. It was vaguely useful in
https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured
I might as well upstream it; I may or may not ever get around
to doing more with it (hopefully I will), but it may be useful
for others.
Update codegen option documentation.
Some documentation updates:
- Add more detail to codegen options.
- Add missing options:
- `force-frame-pointers`
- `default-linker-libraries`
- `linker-plugin-lto`
- Add fragment anchors for all command-line-arguments.
- Add some cross links between options.
rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.
I was trying to tweak the API of `FnType` (now `FnAbi`) and the name kept bothering me.
`FnAbi` is to a function signature a bit like a layout is to a type, so the name still isn't perfect yet, but at least it doesn't have the misleading `Type` in it anymore.
If this can't land I think I can continue my original refactor without it, so I'm not strongly attached to it.
r? @nagisa cc @oli-obk
Clarify pattern-matching usefulness algorithm
This PR clarifies a bit the usefulness algorithm by emphasizing that each row of the matrix can be seen as a sort of stack from which we pop constructors. It also moves code around to increase separation of concerns.
This is part of my splitting of https://github.com/rust-lang/rust/pull/65160 into smaller PRs.
This system call is present on all supported NetBSD versions and
provides an endless stream of non-blocking random data from the
kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor
to be opened.
The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0
And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273
The semantics are the same as FreeBSD so reading 256 bytes per call
is fine.
Similar change for getrandom crate: rust-random/getrandom#115