fix handling the default config for profiler and sanitizers
#78354 don't handle the case that user don't add any target-specific config in `[target.*]` of `config.toml`:
```toml
changelog-seen = 2
[llvm]
link-shared = true
[build]
sanitizers = true
profiler = true
[install]
[rust]
[dist]
```
The previes code handle the default config in `Config::prase()`:
```rust
target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default());
target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default());
config.target_config.insert(TargetSelection::from_user(&triple), target);
```
In this case, `toml.target` don't contain any target, so the above code won't execute. Instead, a default `Target` is insert in c919f490bb/src/bootstrap/sanity.rs (L162-L166)
The default value for `bool` is false, hence the issue in #79124
This fix change the type of `sanitizers` and `profiler` to `Option<bool>`, so the default value is `None`, and fallback config is handled in `Config::sanitizers_enabled` and `Config::profiler_enabled`
fix#79124
cc `@Mark-Simulacrum` `@richkadel`
Move capture lowering from THIR to MIR
This allows us to:
- Handle precise Places captured by a closure directly in MIR. Handling
captures in MIR is easier since we can rely on/ tweak PlaceBuilder to
generate `mir::Place`s that resemble how we store captures (`hir::Place`).
- Handle `let _ = x` case when feature `capture_disjoint_fields`
is enabled directly in MIR. This is required to be done in MIR since
patterns are desugared in MIR.
Closes: rust-lang/project-rfc-2229#25
r? ```@nikomatsakis```
add optimization fuel checks to some mir passes
Fixes#77402
Inserts a bunch of calls to `consider_optimizing`. Note that `consider_optimizing` is the method that actually decrements the fuel count, so the point at which it's called is when the optimization takes place, from a fuel perspective. This means that where we call it has some thought behind it:
1. We probably don't want to decrement the fuel count before other simple checks, otherwise we count an optimization as being performed even if nothing was mutated (ie. it returned early).
2. In cases like `InstCombine`, where we gather optimizations in a pass and then mutate values, we probably would rather skip the gathering pass for performance reasons rather than skip the mutations afterwards.
compiletest: Fix a warning in debuginfo tests on windows-gnu
The warning looked like this for me:
```
Warning: C:msys64homewerust./src/etc: No such file or directory.
```
It didn't affect actual testing because we don't currently emit gdb pretty-printer information into executables on windows-gnu.
Add //ignore-macos to pretty-std-collections.rs
On macOS the test is flaky and sometimes fails,
sometimes succeeds on CI.
This is no fix for the underlying issue,
but I feel the workaround is worth it as
the issue makes it harder
to get things merged into master.
cc #78665
libary: Forward compiler-builtins "asm" and "mangled-names" feature
In principle this is a followup of rust-lang/rust#78472. In the previous PR was the support of the test crate missing.
Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-asm
```
and correctly get the assembly implemenations for `memcpy` and friends.
Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.
This mitigates #78941. As suggested by ```@estebank,``` `span_suggestion` was replaced with `span_suggestion_verbose` for this specific diagnostic.
Make bad "rust-call" arguments no longer ICE
The simplest of bad rust-call definitions will no longer cause an ICE. There is a FIXME added for future work, as I wanted to get this easy fix in before trying to either add a hack or mess with the whole obligation system
fixes#22565
Remove semicolon from internal `err` macro
This macro is used in expression position (a match arm), and only
compiles because of #33953
Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.
Remove Hacks and Fixmes from PR CI's LLVM-9 Container
Now with LLVM 9 being the minimum supported version (thanks to #78848 ), we can
finally remove the hacks in the dockerfile.
This wasn't in the main PR bumping the version as I didn't quite
understand what's going on and needed here.
Relevant issues and PRs:
- Issue #69823
- PR #70989
I hope I actually adressed things correctly here?
This macro is used in expression position (a match arm), and only
compiles because of #33953
Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.
Fix setting inline hint based on `InstanceDef::requires_inline`
For instances where `InstanceDef::requires_inline` is true, an attempt
is made to set an inline hint though a call to the `inline` function.
The attempt is ineffective, since all attributes will be usually removed
by the second call.
Fix the issue by applying the attributes only once, with user provided
attributes having a priority when provided.
Closes#79108.
Handle empty matches cleanly in exhaustiveness checking
This removes the special-casing of empty matches that was done in `check_match`. This fixes most of https://github.com/rust-lang/rust/issues/55123.
Somewhat unrelatedly, I also made `_match.rs` more self-contained, because I think it's cleaner.
r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
As `Cell` won't receive an allocator parameter, it is used. Otherwise a `#![feature(allocator_api)]` could have been added, but for the purpose of this test, changing the type is more clear.
Rollup of 11 pull requests
Successful merges:
- #78361 (Updated the list of white-listed target features for x86)
- #78785 (linux: try to use libc getrandom to allow interposition)
- #78999 (stability: More precise location for deprecation lint on macros)
- #79039 (Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak)
- #79079 (Turn top-level comments into module docs in MIR visitor)
- #79114 (add trailing_zeros and leading_zeros to non zero types)
- #79131 (Enable AVX512 *epi64 variants by updating stdarch)
- #79133 (bootstrap: use the same version number for rustc and cargo)
- #79145 (Fix handling of panic calls)
- #79151 (Fix typo in `std::io::Write` docs)
- #79158 (type is too big -> values of the type are too big)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
type is too big -> values of the type are too big
strictly speaking, `[u8; usize::MAX]` or even `[[[u128; usize::MAX]; usize::MAX]; usize::MAX]` are absolutely fine types as long as you don't try to deal with any values of it.
This error message seems to cause some confusion imo, for example in https://github.com/rust-lang/rust/pull/79135#issuecomment-729361380 so I would prefer us to be more precise here.
See the added test case which uses one of these types without causing an error.
r? ``@oli-obk``
Fix typo in `std::io::Write` docs
These referred to a “`Write`er”—extra *e*. Presumably a copy-paste
holdover from “`Read`er”.
Test Plan:
Running ``git grep '`\?[Ww]rite`\?er'`` no longer finds any results.
wchargin-branch: io-write-docs
Fix handling of panic calls
This should make Clippy more resilient and will unblock #78343.
This PR is made against rust-lang/rust to avoid the need for a subtree
sync at ``@flip1995's`` suggestion in rust-lang/rust-clippy#6310.
r? ``@flip1995``
cc ``@m-ou-se``
bootstrap: use the same version number for rustc and cargo
Historically the stable tarballs were named after the version number ofthe specific tool, instead of the version number of Rust. For example, both of the following tarballs were part of the same release:
rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz
PR #77336 changed the dist code to instead use Rust's version number for all the tarballs, regardless of the tool they contain:
rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz
Because of that there is no need anymore to have a separate `cargo` field in `src/stage0.txt`, as the Cargo version will always be the same as the rustc version. This PR removes the field, simplifying the code and the maintenance work required while producing releases.
r? ``@Mark-Simulacrum``