Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #125820

Closed
wants to merge 29 commits into from
Closed

Conversation

jieyouxu
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

amandasystems and others added 29 commits May 28, 2024 13:05
This shunts all the complexity of siphoning off the drop-use facts
into `LivenessResults::add_extra_drop_facts()`, which may or may
not be a good approach.
When a lazy logical operator (`&&` or `||`) occurs outside of an `if`
condition, it normally doesn't have any associated control-flow branch, so we
don't have an existing way to track whether it was true or false.

This patch adds special code to handle this case, by inserting extra MIR blocks
in a diamond shape after evaluating the RHS. This gives us a place to insert
the appropriate marker statements, which can then be given their own counters.
We do this for `&*` and `&mut*` already; might as well do it for raw pointers too.
The coverage-dump tool already needs `rustc_demangle` for its own purposes, so
the amount of extra code needed for a demangle mode is very small.
This avoids the need to build `rust-demangler` when running coverage tests,
since we typically need to build `coverage-dump` anyway.
This appears to be the canonical way to build a tool with the stage 0 compiler.
…g, r=oli-obk

Revert propagation of drop-live information from Polonius

rust-lang#64749 introduced a flow of drop-use data from Polonius to `LivenessResults::add_extra_drop_facts()`, which makes `LivenessResults` agree with Polonius on liveness in the presence of free regions that may be dropped. Later changes accidentally removed this flow. This PR restores it.
…-obk

Apply `x clippy --fix` and `x fmt` on Rustc

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Just run `x clippy --fix` and `x fmt`, and remove some changes like `impl Default`.
coverage: Optionally instrument the RHS of lazy logical operators

(This is an updated version of rust-lang#124644 and rust-lang#124402. Fixes rust-lang#124120.)

When `||` or `&&` is used outside of a branching context (such as the condition of an `if`), the rightmost value does not directly influence any branching decision, so branch coverage instrumentation does not treat it as its own true-or-false branch.

That is a correct and useful interpretation of “branch coverage”, but might be undesirable in some contexts, as described at rust-lang#124120. This PR therefore adds a new coverage level `-Zcoverage-options=condition` that behaves like branch coverage, but also adds additional branch instrumentation to the right-hand-side of lazy boolean operators.

---

As discussed at rust-lang#124120 (comment), this is mainly intended as an intermediate step towards fully-featured MC/DC instrumentation. It's likely that we'll eventually want to remove this coverage level (rather than stabilize it), either because it has been incorporated into MC/DC instrumentation, or because it's getting in the way of future MC/DC work. The main appeal of landing it now is so that work on tracking conditions can proceed concurrently with other MC/DC-related work.

```@rustbot``` label +A-code-coverage
…ylib, r=jieyouxu

Migrate run make cdylib

Part of rust-lang#121876.

r? `@jieyouxu`
…lcnr

Stop using `translate_args` in the new solver

It was unnecessary and also sketchy, since it was doing an out-of-search-graph fulfillment loop. Added a test for the only really minor subtlety of translating args, though not sure if it was being tested before, though I wouldn't be surprised if it wasn't.

r? lcnr
…-obk

Also InstSimplify `&raw*`

We do this for `&*` and `&mut*` already; might as well do it for raw pointers too.

r? mir-opt
…piler-errors

Also resolve the type of constants, even if we already turned it into an error constant

error constants can still have arbitrary types, and in this case it was turned into an error constant because there was an infer var in the *type* not the *const*.

fixes rust-lang#125760
…link-to-rust-dylib, r=jieyouxu

Migrate `run-make/c-link-to-rust-dylib` to `rmake.rs`

Part of rust-lang#121876.

First commit comes from rust-lang#125773.

r? `@jieyouxu`
Don't build the `rust-demangler` binary for coverage tests

The coverage-run tests invoke `llvm-cov`, which requires us to specify a command-line demangler that it can use to demangle Rust symbol names.

Historically this used `src/tools/rust-demangler`, which means that we currently build two different command-line tools to help with the coverage tests (`rust-demangler` and `coverage-dump`).

However, it occurred to me that if we add a demangler mode to `coverage-dump` (which is only a handful of lines and no extra dependencies), then we only need to build one helper binary for the coverage tests, and there is no need for tests to build `rust-demangler` at all.

---

Note that the `rust-demangler` binary is separate from the `rustc-demangle` crate (which both `rust-demangler` and `coverage-dump` use as a dependency to do the actual demangling).

---

So the main benefits/motivations here are:
- Slightly faster builds after a fresh checkout or bootstrap bump.
- Making it clear that currently no tests actually need the `rust-demangler` binary, since the coverage tests can use their own tool instead.
@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label May 31, 2024
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative rollup A PR which is a rollup labels May 31, 2024
@jieyouxu
Copy link
Member Author

@bors r+ rollup=never p=9

@bors
Copy link
Contributor

bors commented May 31, 2024

📌 Commit 85a859d has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2024
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Download action repository 'msys2/setup-msys2@v2.22.0' (SHA:cc11e9188b693c2b100158c3322424c4cc1dadea)
Download action repository 'actions/checkout@v4' (SHA:a5ac7e51b41094c92402da3b24376905380afc29)
Download action repository 'actions/setup-python@v5' (SHA:82c7e631bb3cdc910f68e0081d67478d79c6982d)
Download action repository 'actions/upload-artifact@v4' (SHA:65462800fd760344b1a7b4382951275a0abb4808)
Complete job name: PR - mingw-check-tidy
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt \
    && pip3 install virtualenv
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---

#10 [5/8] COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
#10 CACHED

#11 [6/8] RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt     && pip3 install virtualenv

#12 [2/8] RUN apt-get update && apt-get install -y --no-install-recommends   g++   make   ninja-build   file   curl   ca-certificates   python2.7   python3   python3-pip   python3-pkg-resources   git   cmake   sudo   gdb   xz-utils   libssl-dev   pkg-config   mingw-w64   && rm -rf /var/lib/apt/lists/*
#12 CACHED

---
DirectMap4k:      182208 kB
DirectMap2M:     7157760 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
    Finished `dev` profile [unoptimized] target(s) in 0.03s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/2a2c29aafa50bf6fe53d66b32070eba59f860ac3/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-2a2c29aafa50bf6fe53d66b32070eba59f860ac3-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
   Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
    Finished `release` profile [optimized] target(s) in 25.27s
##[endgroup]
fmt check
##[error]Diff in /checkout/tests/run-make/c-link-to-rust-dylib/rmake.rs at line 13:
     rustc().input("foo.rs").run();
 
     if is_msvc() {
-        Cc::new()
-            .input("bar.c")
-            .arg(tmp_dir().join("foo.dll.lib"))
-            .out_exe("bar")
-            .run();
+        Cc::new().input("bar.c").arg(tmp_dir().join("foo.dll.lib")).out_exe("bar").run();
         Cc::new()
         Cc::new()
             .input("bar.c")
##[error]Diff in /checkout/tests/run-make/c-link-to-rust-dylib/rmake.rs at line 32:
     let expected_extension = dynamic_lib_extension();
     read_dir(tmp_dir(), |path| {
-            && path
-                .extension()
-                .extension()
-                .is_some_and(|ext| ext == expected_extension)
+            && path.extension().is_some_and(|ext| ext == expected_extension)
             && path
                 .file_name()
                 .and_then(|name| name.to_str())
##[error]Diff in /checkout/tests/run-make/cdylib/rmake.rs at line 19:
     rustc().input("foo.rs").run();
 
     if is_msvc() {
-        cc().input("foo.c")
-            .arg(tmp_dir().join("foo.dll.lib"))
-            .out_exe("foo")
-            .run();
+        cc().input("foo.c").arg(tmp_dir().join("foo.dll.lib")).out_exe("foo").run();
     } else {
         cc().input("foo.c")
             .arg("-lfoo")
fmt error: Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt" "--config-path" "/checkout" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/checkout/compiler/rustc_baked_icu_data/src/data/macros/fallback_supplement_co_v1.data.rs" "/checkout/compiler/rustc_baked_icu_data/src/data/any.rs" "/checkout/tests/run-make/same-lib-two-locations-no-panic/bar.rs" "/checkout/tests/run-make/same-lib-two-locations-no-panic/rmake.rs" "/checkout/tests/run-make/same-lib-two-locations-no-panic/foo.rs" "/checkout/tests/run-make/static-unwinding/lib.rs" "/checkout/tests/run-make/static-unwinding/rmake.rs" "/checkout/tests/run-make/static-unwinding/main.rs" "/checkout/compiler/rustc_serialize/tests/leb128.rs" "/checkout/compiler/rustc_serialize/tests/opaque.rs" "/checkout/tests/run-make/sepcomp-separate/foo.rs" "/checkout/compiler/rustc_serialize/src/lib.rs" "/checkout/compiler/rustc_serialize/src/int_overflow.rs" "/checkout/compiler/rustc_serialize/src/serialize.rs" "/checkout/compiler/rustc_serialize/src/leb128.rs" "/checkout/compiler/rustc_serialize/src/opaque.rs" "/checkout/tests/run-make/missing-crate-dependency/crateC.rs" "/checkout/tests/run-make/missing-crate-dependency/crateB.rs" "/checkout/tests/run-make/missing-crate-dependency/crateA.rs" "/checkout/tests/run-make/rustdoc-verify-output-files/rmake.rs" "/checkout/tests/run-make/rustdoc-verify-output-files/src/lib.rs" "/checkout/compiler/rustc_traits/src/codegen.rs" "/checkout/compiler/rustc_traits/src/normalize_erasing_regions.rs" "/checkout/compiler/rustc_traits/src/lib.rs" "/checkout/compiler/rustc_traits/src/normalize_projection_ty.rs" "/checkout/compiler/rustc_traits/src/type_op.rs" "/checkout/compiler/rustc_traits/src/implied_outlives_bounds.rs" "/checkout/compiler/rustc_traits/src/evaluate_obligation.rs" "/checkout/compiler/rustc_traits/src/dropck_outlives.rs" "/checkout/tests/run-make/no-builtins-attribute/no_builtins.rs" "/checkout/tests/run-make/no-builtins-attribute/main.rs" "/checkout/tests/run-make/const_fn_mir/main.rs" "/checkout/tests/run-make/pass-linker-flags-flavor/empty.rs" "/checkout/tests/run-make/pass-linker-flags-flavor/attribute.rs" "/checkout/tests/run-make/foreign-exceptions/foo.rs" "/checkout/compiler/rustc_errors/src/styled_buffer.rs" "/checkout/compiler/rustc_errors/src/lib.rs" "/checkout/compiler/rustc_errors/src/codes.rs" "/checkout/tests/run-make/dep-info-spaces/lib.rs" "/checkout/tests/run-make/dep-info-spaces/bar.rs" "/checkout/compiler/rustc_errors/src/markdown/mod.rs" "/checkout/compiler/rustc_errors/src/markdown/term.rs" "/checkout/tests/run-make/dep-info-spaces/foo foo.rs" "/checkout/compiler/rustc_errors/src/markdown/parse.rs" "/checkout/tests/run-make/pdb-alt-path/main.rs" "/checkout/compiler/rustc_errors/src/markdown/tests/term.rs" "/checkout/compiler/rustc_errors/src/markdown/tests/parse.rs" "/checkout/compiler/rustc_errors/src/diagnostic.rs" "/checkout/compiler/rustc_errors/src/json/tests.rs" "/checkout/tests/run-make/lto-dylib-dep/a_dylib.rs" "/checkout/tests/run-make/lto-dylib-dep/main.rs" "/checkout/compiler/rustc_errors/src/error.rs" "/checkout/compiler/rustc_errors/src/emitter.rs" "/checkout/compiler/rustc_errors/src/diagnostic_impls.rs" "/checkout/compiler/rustc_errors/src/snippet.rs" "/checkout/compiler/rustc_errors/src/tests.rs" "/checkout/compiler/rustc_errors/src/lock.rs" "/checkout/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs" "/checkout/compiler/rustc_errors/src/json.rs" "/checkout/compiler/rustc_errors/src/translation.rs" "/checkout/compiler/rustc_errors/src/registry.rs" "/checkout/tests/run-make/cdylib/bar.rs" "/checkout/tests/run-make/cdylib/rmake.rs" "/checkout/compiler/rustc_baked_icu_data/src/data/macros/list_and_v1.data.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
  local time: Fri May 31 14:47:13 UTC 2024
  network time: Fri, 31 May 2024 14:47:13 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.