Add unstable Iterator::copied()
Initially suggested at https://github.com/bluss/rust-itertools/pull/289, however the maintainers of itertools suggested this may be better of in a standard library.
The intent of `copied` is to avoid accidentally cloning iterator elements after doing a code refactoring which causes a structure to be no longer `Copy`. This is a relatively common pattern, as it can be seen by calling `rg --pcre2 '[.]map[(][|](?:(\w+)[|] [*]\1|&(\w+)[|] \2)[)]'` on Rust main repository. Additionally, many uses of `cloned` actually want to simply `Copy`, and changing something to be no longer copyable may introduce unnoticeable performance penalty.
Also, this makes sense because the standard library includes `[T].copy_from_slice` to pair with `[T].clone_from_slice`.
This also adds `Option::copied`, because it makes sense to pair it with `Iterator::copied`. I don't think this feature is particularly important, but it makes sense to update `Option` along with `Iterator` for consistency.
Remove header licenses across the project
This pull request removes the header licenses from files across the Rust repository.
I've attempted to check for any remaining headers and removed all of them -- any we've missed can be removed in the future; there's nothing blocking that.
Unfortunately, not all of the changes are as basic as "removing a header" because some of them required test file updates or otherwise. However, I am fairly confident that the changes in this pull request, while wide-sweeping, are unlikely to actually make any tests fail to properly test the code; any non-script based changes were manual and carefully verified.
r? @pietroalbini cc @rust-lang/infra
make non_camel_case_types an early lint
This allows us to catch these kinds of style violations much earlier, as evidenced by the large number of tests that had to be updated for this change.
Revert #56944.
This should fix#57111, since #56944 is the only PR involving LLVM.
#57111 is caused by both the rustc and rust-std tarballs providing libLLVM.
r? @alexcrichton
Update the stdsimd submodule
This brings in a few updates:
* Update wasm intrinsic naming for atomics
* Update and reimplement most simd128 wasm intrinsics
* Other misc improvements here and there, including a small start to
AVX-512 intrinsics
std: Use backtrace-sys from crates.io
This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.
Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
x.py: fixup 6130fc884b, fix submodule handling
./x.py used to automatically check out the right commit when a submodule was outdated and ./x.py build was run
and submodules handling was enabled in config.toml (submodules = true).
But it threw an error:
[...]
failed to run: git submodule -q sync --progress src/tools/clippy
The commit removes the --progress from git submodule call.
Fixes#57080
./x.py used to automatically check out the right commit when a submodule was outdated and ./x.py build was run
and submodules handling was enabled in config.toml (submodules = true).
But it threw an error:
[...]
failed to run: git submodule -q sync --progress src/tools/clippy
The commit removes the --progress from git submodule call.
Fixes#57080
This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.
Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
docs(rustc): make hello() public
Running the example code [here](https://doc.rust-lang.org/rustc/what-is-rustc.html#basic-usage) throws error:
```
error[E0603]: function `hello` is private
--> src/main.rs:4:10
|
4 | foo::hello();
| ^^^^^
```
Making `hello()` public fixes the problem.
Rollup of 10 pull requests
Successful merges:
- #55470 (box: Add documentation for `From` impls)
- #56242 (Add missing link in docs)
- #56944 (bootstrap: Link LLVM as a dylib with ThinLTO)
- #56978 (Add `std::os::fortanix_sgx` module)
- #56985 (Allow testing pointers for inboundedness while forbidding dangling pointers)
- #56986 (rustc: Move jemalloc from rustc_driver to rustc)
- #57010 (Actually run compiletest tests on CI)
- #57021 (Enable emission of alignment attrs for pointer params)
- #57074 (Fix recursion limits)
- #57085 (librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64)
Failed merges:
r? @ghost
librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64
This is in accordance with the SPARC Compliance Definition 2.4.1,
Page 3P-12. It says that structs of up to 8 bytes (which applies
to empty structs as well) are to be passed in one register.
Enable emission of alignment attrs for pointer params
Instead disable creation of assumptions during inlining using an LLVM opt flag. For non-inlined functions, this gives us alignment information, while not inserting any assumes that kill other optimizations.
The `-Z arg-align-attributes` option which previously controlled this behavior is removed.
Fixes#54982.
r? @nagisa
cc @eddyb who added the current behavior, and @scottmcm, who added the `-Z arg-align-attributes` flag.
Actually run compiletest tests on CI
I was assuming that https://github.com/rust-lang/rust/pull/56792 would
have resulted in compiletest tests being executed on CI. However, I
couldn't find any mentions of the unit test names in any CI logs.
This adds the compiletest test execution to the checktools.sh script.
rustc: Move jemalloc from rustc_driver to rustc
This commit moves jemalloc to just the rustc binary rather than the
rustc_driver shared library, enusring that it's only used for binaries
that opt-in to it like rustc rather than other binaries using
librustc_driver like rustdoc/rls/etc. This will hopefully address #56980