Skip to content

Replace truncate(0) with clear()#154029

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
xtqqczze:clear
Mar 28, 2026
Merged

Replace truncate(0) with clear()#154029
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
xtqqczze:clear

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

No description provided.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 18, 2026

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc 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) labels Mar 18, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 18, 2026

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet

@rustbot rustbot added 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Mar 18, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't modify subtrees like rust-analyzer inside the rust-lang/rust repo unless necessary. Development of rust-analyzer happens at https://github.com/rust-lang/rust-analyzer/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased

For future reference do all subtrees have a josh-sync.toml?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most do. The exceptions I believe are compiler/rustc_codegen_cranelift, compiler/rustc_codegen_gcc and src/tools/rustfmt. Those I think are the only ones that still use git-subtree rather than josh for syncing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, unfortunately there is no reliable method get a list of current subtrees from Git. Perhaps these could be tracked explicitly somewhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to, just see if triagebot complains. You can skim https://github.com/rust-lang/rust/blob/main/triagebot.toml if you're wondering.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary, so please remove this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I've rebased to remove changes under src/tools/rust-analyzer

I've added the change to src/tools/compiletest back since that doesn't appear to be a subtree.

Copy link
Copy Markdown
Member

@Kivooeo Kivooeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve on compiler/ part, yet requires an approve on library/ part

View changes since this review

@cjgillot
Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 19, 2026
Replace `truncate(0)` with `clear()`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 19, 2026

☀️ Try build successful (CI)
Build commit: 637b2a9 (637b2a9e6396c8eee79c1faf2b551af705aec553, parent: fd0c901b00ee1e08a250039cdb90258603497e20)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (637b2a9): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 4
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-1.8%, -1.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-1.8%, 2.3%] 2

Cycles

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

Binary size

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

Bootstrap: 481.003s -> 480.752s (-0.05%)
Artifact size: 396.91 MiB -> 395.01 MiB (-0.48%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary, so please remove this change.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 19, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@xtqqczze
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 19, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2026
@joboet
Copy link
Copy Markdown
Member

joboet commented Mar 28, 2026

Thanks!
@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 28, 2026

📌 Commit b9cd592 has been approved by joboet

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Mar 28, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 28, 2026
Rollup of 11 pull requests

Successful merges:

 - #152880 (Tweak incorrect assoc item note)
 - #153526 (Fix LegacyKeyValueFormat report from docker build: i686)
 - #153613 (interpreter error reporting: remove arguments that are always the same)
 - #154029 (Replace `truncate(0)` with `clear()`)
 - #154125 (Inline and remove `DepGraphData::try_mark_parent_green`.)
 - #154185 (Prevent no_threads RwLock's write() impl from setting mode to -1 when it is locked for reading)
 - #154394 (Normalize rustc path prefix when testing `-Z track-diagnostics`)
 - #154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`)
 - #154475 (Emit a pre-expansion feature gate warning for `box`'ed struct field patterns)
 - #154500 (EnumSizeOpt: use Allocation::write_scalar instead of manual endianess logic)
 - #154502 (interpret: ensure that untupled arguments are actually tuples)
@rust-bors rust-bors bot merged commit d289cc4 into rust-lang:main Mar 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 28, 2026
rust-timer added a commit that referenced this pull request Mar 28, 2026
Rollup merge of #154029 - xtqqczze:clear, r=joboet

Replace `truncate(0)` with `clear()`
@xtqqczze xtqqczze deleted the clear branch March 28, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants