Commit Graph

147466 Commits

Author SHA1 Message Date
bors
aa31bad26b Auto merge of #124222 - GuillaumeGomez:rollup-ws1zju7, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #124069 (enable clippy for bootstrap on CI PRs (in `mingw-check` image))
 - #124089 (Fix watchOS and visionOS for pread64 and pwrite64 calls)
 - #124184 (Suggest using `unsigned_abs` in `abs` documentation)
 - #124198 (Flip spans for precise capturing syntax not capturing a ty/const param, and for implicit captures of lifetime params)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-21 13:05:45 +00:00
Guillaume Gomez
f122a5129c
Rollup merge of #124069 - onur-ozkan:run-clippy-on-bootstrap, r=albertlarsan68
enable clippy for bootstrap on CI PRs (in `mingw-check` image)

Let's keep the bootstrap codebase cleaner.
2024-04-21 13:30:24 +02:00
bors
fecb7b4309 Auto merge of #124193 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-04-21 11:01:46 +00:00
Ralf Jung
ae37b6ec58 the mir-validation ICE test behaves strangely on Windows hosts
let's just disable it there, this code is not platform-dependent anyway
2024-04-21 12:36:16 +02:00
bors
426a698606 Auto merge of #123981 - Kobzol:update-nodejs, r=Mark-Simulacrum
CI: add script for installing NodeJS and update it to v20

I centralized the installation on a single place to make it simple to update the NodeJS version across the board.

Fixes: https://github.com/rust-lang/rust/issues/123965

r? `@Mark-Simulacrum`
2024-04-21 01:06:10 +00:00
bors
453ceafce3 Auto merge of #124208 - jieyouxu:rollup-gbgpu4u, r=jieyouxu
Rollup of 10 pull requests

Successful merges:

 - #123379 (Print note with closure signature on type mismatch)
 - #123967 (static_mut_refs: use raw pointers to remove the remaining FIXME)
 - #123976 (Use fake libc in core test)
 - #123986 (lint-docs: Add redirects for renamed lints.)
 - #124053 (coverage: Branch coverage tests for lazy boolean operators)
 - #124071 (Add llvm-bitcode-linker to build manifest)
 - #124103 (Improve std::fs::Metadata Debug representation)
 - #124132 (llvm RustWrapper: explain OpBundlesIndirect argument type)
 - #124191 (Give a name to each distinct manipulation of pretty-printer FixupContext)
 - #124196 (mir-opt tests: rename unit-test -> test-mir-pass)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-20 22:35:56 +00:00
许杰友 Jieyou Xu (Joe)
c72cfdd46f
Rollup merge of #124196 - RalfJung:mir-opt-tests, r=Mark-Simulacrum
mir-opt tests: rename unit-test -> test-mir-pass

"unit-test" is extremely non-descriptive, no idea how one is supposed to read that and know that this specifies the MIR pass being tested.
2024-04-20 21:45:38 +01:00
许杰友 Jieyou Xu (Joe)
29ee276368
Rollup merge of #124071 - kjetilkjeka:llvm_bitcode_linker_build_manifest, r=Mark-Simulacrum
Add llvm-bitcode-linker to build manifest

When creating #123423 I didn't realize I also had to add the new component to the build-manifest. This PR finishes the work of adding it, by also adding it to the build manifest.

r? ``@Mark-Simulacrum``
2024-04-20 21:45:36 +01:00
许杰友 Jieyou Xu (Joe)
871c3e3075
Rollup merge of #123986 - ehuss:lint-renamed, r=Mark-Simulacrum
lint-docs: Add redirects for renamed lints.

This updates the lint docs to include a redirect for renamed lints to the new name. This helps ensure that links to the old name will still be valid.

Note that this currently uses a hard-coded list. As mentioned in the comment, a future enhancement may gather this information in a better way.

Unblocks #123680
2024-04-20 21:45:35 +01:00
bors
dbce3b43b6 Auto merge of #122013 - Swatinem:unicode-gen-fastpath, r=scottmcm
Add a lower bound check to `unicode-table-generator` output

This adds a dedicated check for the lower bound
(if it is outside of ASCII range) to the output of the `unicode-table-generator` tool.

This generalized the ASCII-only fast-path, but only for the `Grapheme_Extend` property for now, as that is the only one with a lower bound outside of ASCII.
2024-04-20 20:33:25 +00:00
bors
54692c3d0b Auto merge of #124202 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-04-20 17:01:20 +00:00
Laurențiu Nicola
b0a18daa75 Merge commit '55d9a533b309119c8acd13061581b43ae8840823' into sync-from-ra 2024-04-20 19:17:08 +03:00
bors
8cf135e191 Auto merge of #121712 - mati865:provide-prebuilt-std-for-gnullvm, r=Mark-Simulacrum
Provide prebuilt std for gnullvm targets

Revival of https://github.com/rust-lang/rust/pull/114346 which waiting on MCP that was accepted recently: https://github.com/rust-lang/compiler-team/issues/710#issuecomment-1942014308
2024-04-20 14:58:25 +00:00
Ralf Jung
75d0fdd967 mir-opt tests: rename unit-test -> test-mir-pass 2024-04-20 13:19:34 +02:00
Ralf Jung
61a7d3d523 ensure the ICE-to-file logic does not affect our test 2024-04-20 11:42:10 +02:00
Matthias Krüger
f58ef084c9
Rollup merge of #124137 - tgross35:testsuite-multi-rev-regex, r=jieyouxu
Match hyphen in multi-revision comment matchers

Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by the regex. Change the matcher to include `-`.
2024-04-20 11:10:32 +02:00
Matthias Krüger
efb264fa78
Rollup merge of #123409 - ZhuUx:master, r=oli-obk
Implement Modified Condition/Decision  Coverage

This is an implementation based on llvm backend support (>= 18) by `@evodius96` and branch coverage support by `@Zalathar.`

### Major changes:

* Add -Zcoverage-options=mcdc as switch. Now coverage options accept either `no-branch`, `branch`, or `mcdc`. `mcdc` also enables `branch` because it is essential to work.
* Add coverage mapping for MCDCBranch and MCDCDecision. Note that MCDCParameter evolves from  llvm 18 to llvm 19. The mapping in rust side mainly references to 19 and is casted to 18 types in llvm wrapper.
* Add wrapper for mcdc instrinc functions from llvm. And inject associated statements to mir.
* Add BcbMappingKind::Decision, I'm not sure is it proper but can't find a better way temporarily.
* Let coverage-dump support parsing MCDCBranch and MCDCDecision from llvm ir.
* Add simple tests to check whether mcdc works.
* Same as clang, currently rustc does not generate instrument for decision with more than 6 condtions or only 1 condition due to considerations of resource.

### Implementation Details

1. To get information about conditions and decisions, `MCDCState` in `BranchInfoBuilder` is used during hir lowering to mir. For expressions with logical op we call `Builder::visit_coverage_branch_operation` to record its sub conditions, generate condition ids for them and save their spans (to construct the span of whole decision). This process mainly references to the implementation in clang and is described in comments over `MCDCState::record_conditions`. Also true marks and false marks introduced by branch coverage are used to detect where the decision evaluation ends: the next id  of the condition == 0.
2. Once the `MCDCState::decision_stack` popped all recorded conditions, we can ensure that the decision is checked over and push it into `decision_spans`. We do not manually insert decision span to avoid complexity from then_else_break in nested if scopes.
3. When constructing CoverageSpans, add condition info to BcbMappingKind::Branch and decision info to BcbMappingKind::Decision. If the branch mapping has non-zero condition id it will be transformed to MCDCBranch mapping and insert `CondBitmapUpdate` statements to its evaluated blocks. While decision bcb mapping will insert `TestVectorBitmapUpdate` in all its end blocks.

### Usage
```bash
 echo "[build]\nprofiler=true" >> config.toml
./x build --stage 1
./x test tests/coverage/mcdc_if.rs
```
to build the compiler and run tests.

```shell
export PATH=path/to/llvm-build:$PATH
rustup toolchain link mcdc build/host/stage1
cargo +mcdc rustc --bin foo -- -Cinstrument-coverage -Zcoverage-options=mcdc
cd target/debug
LLVM_PROFILE_FILE="foo.profraw" ./foo
llvm-profdata merge -sparse foo.profraw -o foo.profdata
llvm-cov show ./foo -instr-profile=foo.profdata --show-mcdc
```
to check "foo" code.

### Problems to solve

For now decision mapping will insert statements to its all end blocks, which may be optimized by inserting a final block of the decision. To do this we must also trace the evaluated value at each end of the decision and join them separately.

This implementation is not heavily tested so there should be some unrevealed issues. We are going to check our rust products in the next.  Please let me know if you had any suggestions or comments.
2024-04-20 11:10:31 +02:00
Arpad Borsos
488598c183
Add a lower bound check to unicode-table-generator output
This adds a dedicated check for the lower bound
(if it is outside of ASCII range) to the output of the `unicode-table-generator` tool.

This generalized the ASCII-only fast-path, but only for the `Grapheme_Extend` property for now,
as that is the only one with a lower bound outside of ASCII.
2024-04-20 10:16:45 +02:00
bors
6b0ce8b1e2 Auto merge of #3495 - RalfJung:data-race-clocks, r=RalfJung
data_race: make the release/acquire API more clear
2024-04-20 08:11:15 +00:00
Ralf Jung
8cab0d5617 restrict VClock API surface 2024-04-20 10:09:31 +02:00
Ralf Jung
cb1b4a6977 reuse_pool: only do acquire_clock if we reused from a different thread 2024-04-20 09:08:09 +02:00
Ralf Jung
7dcfb54dc6 data_race: make the release/acquire API more clear 2024-04-20 09:01:53 +02:00
Ralf Jung
7952316aff re-bless tests 2024-04-20 08:26:48 +02:00
Ralf Jung
8e1f18dce8 fix clippy warning 2024-04-20 08:26:42 +02:00
The Miri Cronjob Bot
b63bb1b374 Merge from rustc 2024-04-20 05:12:44 +00:00
The Miri Cronjob Bot
29e41fbc30 Preparing for merge from rustc 2024-04-20 05:05:23 +00:00
bors
c8d19a92aa Auto merge of #124177 - weihanglo:update-cargo, r=weihanglo
Update cargo

8 commits in 6f06fe908a5ee0f415c187f868ea627e82efe07d..80d5b607dde6ef97dfff4e23923822c01d2bb036
2024-04-16 18:47:44 +0000 to 2024-04-19 18:39:22 +0000
- fix 13773 - 'cargo build' fails when list_files() with gix is triggered (rust-lang/cargo#13777)
- fix(toml): Don't crash on parse errors that point to multi-byte character (rust-lang/cargo#13780)
- fix(toml)!: Disallow source-less dependencies (rust-lang/cargo#13775)
- fix(msrv): Put MSRV-aware resolver behind a config (rust-lang/cargo#13769)
- fix(msrv): Error, rather than panic, on rust-version 'x' (rust-lang/cargo#13771)
- fix(credential): trim newlines in tokens from stdin (rust-lang/cargo#13770)
- test(msrv): Re-organize MSRV tests (rust-lang/cargo#13767)
- feat(install): Including Locking message (rust-lang/cargo#13764)

r? ghost
2024-04-20 02:06:04 +00:00
Weihang Lo
db881f67f3
Update cargo 2024-04-19 17:04:13 -04:00
bors
e9ebc6f800 Auto merge of #3475 - RalfJung:reduce-reuse-recycle, r=RalfJung
Address reuse improvements and fixes

- when an address gets reused, establish a happens-before link in the data race model
- do not reuse stack addresses, and make the reuse rate configurable

Fixes https://github.com/rust-lang/miri/issues/3450
2024-04-19 20:50:04 +00:00
Trevor Gross
282488c808 Match hyphen in multi-revision comment matchers
Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by
the regex. Change the matcher to also match strings that contain a `-`.h
2024-04-19 16:03:44 -04:00
Matthias Krüger
f1e536df59
Rollup merge of #124155 - klensy:wrong-rayon-here, r=albertlarsan68
bootstrap: don't use rayon for sysinfo

It's looks overkill to use rayon to collect cpu usage
2024-04-19 19:30:50 +02:00
Matthias Krüger
f8afb6314b
Rollup merge of #124149 - notriddle:notriddle/desc-alias, r=GuillaumeGomez
rustdoc-search: fix description on aliases in results

This needs to start downloading the descriptions after aliases have been added to the result set.
2024-04-19 19:30:49 +02:00
Matthias Krüger
b1eee427a0
Rollup merge of #123729 - jieyouxu:rmake-refactor-2, r=oli-obk
run-make: refactor out command wrappers for `clang` and `llvm-readobj`

This PR is rebased on top of https://github.com/rust-lang/rust/pull/123699.

This PR is a follow up to https://github.com/rust-lang/rust/pull/123612 to refactor out command wrappers into the support library for `llvm-readobj` and `clang`.

r? ghost
2024-04-19 19:30:48 +02:00
onur-ozkan
c5fdb39120 fix clippy warnings on bootstrap
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-04-19 20:29:16 +03:00
bors
d1a0fa5ed3 Auto merge of #118441 - GuillaumeGomez:display-stability-version, r=rustdoc
Always display stability version even if it's the same as the containing item

Fixes https://github.com/rust-lang/rust/issues/118439.

Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item.

This was something done on purpose as you can see [here](e9b7bf0114/src/librustdoc/html/render/mod.rs (L949-L955)). It was implemented in https://github.com/rust-lang/rust/pull/30686.

I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great.

You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new).

r? `@notriddle`
2024-04-19 14:17:29 +00:00
bors
07d0d7ce3f Auto merge of #123364 - klensy:bs-mixed-types, r=albertlarsan68
bootstrap: actually allow set debuginfo-level to "line-tables-only"

I've tried to set in config.toml `rust.debuginfo-level = "line-tables-only"`, but ended with:
``` failed to parse TOML configuration 'config.toml':
data did not match any variant of untagged enum StringOrInt for key `rust.debuginfo-level`
```
Also this PR allows to set `line-directives-only` for debuginfo in config.toml too.
1. Fixes this. Alternative is remove that Deserialize and use default one:
0e682e9875/src/bootstrap/src/core/config/config.rs (L725-L728)

2. Should `line-directives-only` be added too?

3. I've tried to add test to rust/src/bootstrap/src/core/config/tests.rs:
```rust
#[test]
fn rust_debuginfo() {
    assert!(matches!(
        parse("rust.debuginfo-level-rustc = 1").rust_debuginfo_level_rustc,
        DebuginfoLevel::Limited
    ));
    assert!(matches!(
        parse("rust.debuginfo-level-rustc = \"line-tables-only\"").rust_debuginfo_level_rustc,
        DebuginfoLevel::LineTablesOnly
    ));
}
```

But test passes before that PR too; looks like config parse tests checks something wrong? I mean, that tests check something which isn't actual bootstrap behavior.
2024-04-19 12:11:09 +00:00
bors
43a0686f8d Auto merge of #115253 - donno2048:patch-1, r=albertlarsan68
Implement `PROBLEMATIC_CONSTS` generalization

You forgot that `A≈4`, `B≈8`, and `E≈3` and some more constants.

The new `PROBLEMATIC_CONSTS` was generated using this code:

```py
from functools import reduce
def generate_problems(consts: list, letter_digit: dict):
    for const in consts:
        problem = reduce(lambda string, rep: string.replace(*reversed(rep)), ['%X' % const, *letter_digit.items()])
        indexes = [index for index, c in enumerate(problem) if c in letter_digit.keys()]
        for i in range(1 << len(indexes)):
            yield int(''.join(letter_digit[c] if index in indexes and (i >> indexes.index(index)) & 1 else c for index, c in enumerate(problem)), 0x10)

problems = generate_problems(
    [
        # Old PROBLEMATIC_CONSTS:
        184594741, 2880289470, 2881141438, 2965027518, 2976579765, 3203381950, 3405691582, 3405697037,
        3735927486, 3735932941, 4027431614, 4276992702,
        # More of my own:
        195934910, 252707358, 762133, 179681982, 173390526
    ],
    {
    'A': '4',
    'B': '8',
    'E': '3',
    }
)

# print(list(problems)) # won't use that to print formatted

from itertools import islice
while len(cur_problems := list(islice(problems, 8))):
    print('    ', end='')
    print(*cur_problems, sep=', ', end='')
    print(',')
```
2024-04-19 09:52:17 +00:00
klensy
6612ad796c bootstrap: don't use rayon for sysinfo
It's looks overkill to use rayon to collect cpu usage
2024-04-19 12:07:07 +03:00
bors
95ae2dd7ff Auto merge of #3489 - rust-lang:rustup-2024-04-19, r=RalfJung
Automatic Rustup
2024-04-19 09:00:46 +00:00
Ralf Jung
fecd7fc937 make test not leak rustc crate hash 2024-04-19 10:59:27 +02:00
bors
c4f112af6e Auto merge of #124123 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-04-19 07:39:44 +00:00
Ralf Jung
b9ed4cd70a share code between win-to-unix and unix-to-win path conversion 2024-04-19 09:17:37 +02:00
bors
0ed85d0c8d Auto merge of #124147 - workingjubilee:rollup-7pjnzr6, r=workingjubilee
Rollup of 7 pull requests

Successful merges:

 - #123406 (Force exhaustion in iter::ArrayChunks::into_remainder)
 - #123752 (Properly handle emojis as literal prefix in macros)
 - #123935 (Don't inline integer literals when they overflow - new attempt)
 - #123980 ( Add an opt-in to store incoming edges in `VecGraph` + misc)
 - #124019 (Use raw-dylib for Windows synchronization functions)
 - #124110 (Fix negating `f16` and `f128` constants)
 - #124116 (when suggesting RUST_BACKTRACE=1, add a special note for Miri's env var isolation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-19 05:38:13 +00:00
Michael Howell
2e7d9e9acb rustdoc-search: fix description on aliases in results
This needs to start downloading the descriptions after aliases
have been added to the result set.
2024-04-18 22:21:29 -07:00
The Miri Cronjob Bot
d0783e8836 Merge from rustc 2024-04-19 05:13:02 +00:00
The Miri Cronjob Bot
c1cf0a3e38 Preparing for merge from rustc 2024-04-19 05:05:48 +00:00
Jubilee
c8d58faba2
Rollup merge of #124116 - RalfJung:miri-rust-backtrace, r=Nilstrieb
when suggesting RUST_BACKTRACE=1, add a special note for Miri's env var isolation

Fixes https://github.com/rust-lang/miri/issues/2855
2024-04-18 21:38:57 -07:00
Jubilee
0a0a5a956c
Rollup merge of #123752 - estebank:emoji-prefix, r=wesleywiser
Properly handle emojis as literal prefix in macros

Do not accept the following

```rust
macro_rules! lexes {($($_:tt)*) => {}}
lexes!(🐛"foo");
```

Before, invalid emoji identifiers were gated during parsing instead of lexing in all cases, but this didn't account for macro pre-expansion of literal prefixes.

Fix #123696.
2024-04-18 21:38:55 -07:00
bors
13e63f7490 Auto merge of #117919 - daxpedda:wasm-c-abi, r=wesleywiser
Introduce perma-unstable `wasm-c-abi` flag

Now that `wasm-bindgen` v0.2.88 supports the spec-compliant C ABI, the idea is to switch to that in a future version of Rust. In the meantime it would be good to let people test and play around with it.

This PR introduces a new perma-unstable `-Zwasm-c-abi` compiler flag, which switches to the new spec-compliant C ABI when targeting `wasm32-unknown-unknown`.

Alternatively, we could also stabilize this and then deprecate it when we switch. I will leave this to the Rust maintainers to decide.

This is a companion PR to #117918, but they could be merged independently.
MCP: https://github.com/rust-lang/compiler-team/issues/703
Tracking issue: https://github.com/rust-lang/rust/issues/122532
2024-04-19 03:35:10 +00:00
zhuyunxing
68f86381ee coverage. Add coverage-options=mcdc as gate for MC/DC instrument 2024-04-19 10:43:53 +08:00