rust icon indicating copy to clipboard operation
rust copied to clipboard

Simplify the canonical clone method and the copy-like forms to copy

Open dianqk opened this issue 1 year ago • 45 comments

Fixes #128081.

r? @cjgillot

dianqk avatar Jul 28 '24 09:07 dianqk

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)

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.
# 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,cpp:fmt
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#13 2.697 Building wheels for collected packages: reuse
#13 2.698   Building wheel for reuse (pyproject.toml): started
#13 2.948   Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 2.949   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#13 2.950   Stored in directory: /tmp/pip-ephem-wheel-cache-_710gpoe/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#13 2.953 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#13 3.348 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#13 3.348 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#13 4.060 Collecting virtualenv
#13 4.060 Collecting virtualenv
#13 4.098   Downloading virtualenv-20.26.3-py3-none-any.whl (5.7 MB)
#13 4.169      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 82.8 MB/s eta 0:00:00
#13 4.224 Collecting filelock<4,>=3.12.2
#13 4.228   Downloading filelock-3.15.4-py3-none-any.whl (16 kB)
#13 4.257 Collecting platformdirs<5,>=3.9.1
#13 4.261   Downloading platformdirs-4.2.2-py3-none-any.whl (18 kB)
#13 4.278 Collecting distlib<1,>=0.3.7
#13 4.289      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 82.8 MB/s eta 0:00:00
#13 4.289      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 82.8 MB/s eta 0:00:00
#13 4.369 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#13 4.559 Successfully installed distlib-0.3.8 filelock-3.15.4 platformdirs-4.2.2 virtualenv-20.26.3
#13 DONE 4.6s

#14 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#14 DONE 0.0s
---
DirectMap4k:      204736 kB
DirectMap2M:     8183808 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint,cpp:fmt
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/3148b35f6a6226548929c12da529ab0d1a4b47d5/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-3148b35f6a6226548929c12da529ab0d1a4b47d5-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
fmt check
fmt: checked 5401 files
tidy check
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/tests/mir-opt/instsimplify/copy_like.rs:106: line longer than 100 chars
##[error]tidy error: /checkout/tests/mir-opt/instsimplify/copy_like.rs:126: line longer than 100 chars
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (24.1)
  Downloading pip-24.1.2-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.1.2-py3-none-any.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 12.4 MB/s eta 0:00:00
Installing collected packages: pip
---
All checks passed!
checking C++ file formatting
some tidy checks failed

Command LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/checkout" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build" "4" "--extra-checks=py:lint,cpp:fmt" (failure_mode=DelayFail, stdout_mode=Print, stderr_mode=Print) did not execute successfully.
Created at: src/core/build_steps/tool.rs:1109:23
Executed at: src/core/build_steps/test.rs:1084:29

Build completed unsuccessfully in 0:01:21

rust-log-analyzer avatar Jul 28 '24 09:07 rust-log-analyzer

@bors try @rust-timer queue

dianqk avatar Jul 28 '24 10:07 dianqk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Jul 28 '24 10:07 rust-timer

:hourglass: Trying commit 31a160882d6a9013ce19a4ff462e9e53fa5e9bcc with merge e4c8ee79cb77eea8faf9d06719ac0a1c26e5fb54...

bors avatar Jul 28 '24 10:07 bors

:sunny: Try build successful - checks-actions Build commit: e4c8ee79cb77eea8faf9d06719ac0a1c26e5fb54 (e4c8ee79cb77eea8faf9d06719ac0a1c26e5fb54)

bors avatar Jul 28 '24 12:07 bors

Queued e4c8ee79cb77eea8faf9d06719ac0a1c26e5fb54 with parent 0bb6fec1c9aa484a7ec987a9e8ffca2eb647b0b3, future comparison URL. There is currently 1 preceding artifact in the queue. It will probably take at least ~2.0 hours until the benchmark run finishes.

rust-timer avatar Jul 28 '24 12:07 rust-timer

Finished benchmarking commit (e4c8ee79cb77eea8faf9d06719ac0a1c26e5fb54): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never @rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.3%, 2.7%] 26
Regressions ❌
(secondary)
1.4% [0.1%, 4.0%] 7
Improvements ✅
(primary)
-0.7% [-1.8%, -0.2%] 7
Improvements ✅
(secondary)
-0.6% [-1.1%, -0.3%] 4
All ❌✅ (primary) 0.6% [-1.8%, 2.7%] 33

Max RSS (memory usage)

Results (primary -0.9%, secondary -2.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.8% [2.6%, 6.8%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-4.9%, -0.4%] 24
Improvements ✅
(secondary)
-2.9% [-3.7%, -2.2%] 2
All ❌✅ (primary) -0.9% [-4.9%, 6.8%] 28

Cycles

Results (primary 1.4%, secondary -0.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.4% [1.0%, 2.3%] 6
Regressions ❌
(secondary)
2.7% [2.2%, 3.0%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-4.5%, -1.3%] 11
All ❌✅ (primary) 1.4% [1.0%, 2.3%] 6

Binary size

Results (primary -0.1%, secondary -0.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.6%] 41
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 3
Improvements ✅
(primary)
-0.3% [-1.1%, -0.0%] 45
Improvements ✅
(secondary)
-0.7% [-1.7%, -0.0%] 19
All ❌✅ (primary) -0.1% [-1.1%, 0.6%] 86

Bootstrap: 772.73s -> 772.725s (-0.00%) Artifact size: 331.60 MiB -> 331.61 MiB (0.00%)

rust-timer avatar Jul 28 '24 14:07 rust-timer

@bors try @rust-timer queue

dianqk avatar Jul 29 '24 20:07 dianqk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Jul 29 '24 20:07 rust-timer

:hourglass: Trying commit a7d48fcc15f9f71917927144e1e1ece4f6f5e5a4 with merge 39db211ca6455f46c20f96c349f1e12734c085ba...

bors avatar Jul 29 '24 20:07 bors

:sunny: Try build successful - checks-actions Build commit: 39db211ca6455f46c20f96c349f1e12734c085ba (39db211ca6455f46c20f96c349f1e12734c085ba)

bors avatar Jul 29 '24 22:07 bors

Queued 39db211ca6455f46c20f96c349f1e12734c085ba with parent 66e5852c3bd022e2a589a089a0bc8392f8b291e1, future comparison URL. There is currently 1 preceding artifact in the queue. It will probably take at least ~2.4 hours until the benchmark run finishes.

rust-timer avatar Jul 29 '24 22:07 rust-timer

@rustbot label -S-blocked

dianqk avatar Jul 29 '24 23:07 dianqk

Finished benchmarking commit (39db211ca6455f46c20f96c349f1e12734c085ba): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never @rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.8% [0.3%, 1.5%] 21
Regressions ❌
(secondary)
2.6% [0.4%, 5.4%] 4
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) 0.7% [-1.9%, 1.5%] 22

Max RSS (memory usage)

Results (primary 2.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.7% [1.9%, 6.9%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-5.1% [-5.1%, -5.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.2% [-5.1%, 6.9%] 6

Cycles

Results (primary 1.2%, secondary 3.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [0.7%, 1.7%] 12
Regressions ❌
(secondary)
3.3% [2.3%, 3.9%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [0.7%, 1.7%] 12

Binary size

Results (primary -0.0%, secondary -0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.2%] 7
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.5%, -0.3%] 2
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 3
All ❌✅ (primary) -0.0% [-0.5%, 0.2%] 9

Bootstrap: 770.008s -> 770.86s (0.11%) Artifact size: 331.82 MiB -> 331.70 MiB (-0.04%)

rust-timer avatar Jul 30 '24 01:07 rust-timer

I wonder if implementing this in GVN pass would be simpler. It already tracks value assignments.

cjgillot avatar Jul 30 '24 23:07 cjgillot

I wonder if implementing this in GVN pass would be simpler. It already tracks value assignments.

It's possible. I'm considering GVN or backward traversal.

dianqk avatar Jul 30 '24 23:07 dianqk

I wonder if implementing this in GVN pass would be simpler. It already tracks value assignments.

Completed, but I haven't done a thorough check yet.

dianqk avatar Jul 31 '24 15:07 dianqk

I hope to get a good result when I wake up. :3

@bors try @rust-timer queue

dianqk avatar Jul 31 '24 15:07 dianqk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Jul 31 '24 15:07 rust-timer

:hourglass: Trying commit b52bb119323156d306e3415a39733ee191857392 with merge 197f924805d603332c41a45f11e22b4d6fee368b...

bors avatar Jul 31 '24 15:07 bors

:sunny: Try build successful - checks-actions Build commit: 197f924805d603332c41a45f11e22b4d6fee368b (197f924805d603332c41a45f11e22b4d6fee368b)

bors avatar Jul 31 '24 16:07 bors

Queued 197f924805d603332c41a45f11e22b4d6fee368b with parent e552c168c72c95dc28950a9aae8ed7030199aa0d, future comparison URL. There are currently 0 preceding artifacts in the queue. It will probably take at least ~1.2 hours until the benchmark run finishes.

rust-timer avatar Jul 31 '24 16:07 rust-timer

@rust-timer build 197f924805d603332c41a45f11e22b4d6fee368b

cjgillot avatar Aug 01 '24 00:08 cjgillot

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

rustbot avatar Aug 01 '24 01:08 rustbot

@rustbot author

dianqk avatar Aug 01 '24 01:08 dianqk

Queued 197f924 with parent e552c16, future comparison URL. There are currently 0 preceding artifacts in the queue. It will probably take at least ~1.2 hours until the benchmark run finishes.

Looks like this never actually got picked up? 🤔

tgross35 avatar Aug 01 '24 15:08 tgross35

It will appear in ~40 minutes.

Kobzol avatar Aug 01 '24 15:08 Kobzol

Finished benchmarking commit (197f924805d603332c41a45f11e22b4d6fee368b): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never @rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.4% [0.3%, 0.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
-1.5% [-1.5%, -1.5%] 1
All ❌✅ (primary) -0.4% [-1.9%, 0.5%] 3

Max RSS (memory usage)

Results (primary 1.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.8% [2.2%, 7.4%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.7% [-4.6%, -2.8%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [-4.6%, 7.4%] 6

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results (primary -0.1%, secondary -0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.3%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.8%, -0.0%] 29
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 3
All ❌✅ (primary) -0.1% [-0.8%, 0.3%] 34

Bootstrap: 769.779s -> 769.589s (-0.02%) Artifact size: 331.88 MiB -> 331.98 MiB (0.03%)

rust-timer avatar Aug 01 '24 16:08 rust-timer

I have had good results with my local tests.

@bors try @rust-timer queue

dianqk avatar Aug 02 '24 15:08 dianqk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Aug 02 '24 15:08 rust-timer