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 6 pull requests #127706

Merged
merged 27 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6bd68fc
Run filecheck on dest-prop/branch.rs
CastilloDel Apr 14, 2024
f238eba
Run filecheck on dest-prop/copy_propagation.rs
CastilloDel Apr 14, 2024
853311c
Run filecheck on dest-prop/cycle.rs
CastilloDel Apr 14, 2024
0692090
Run filecheck on dest-prop/dead_stores_79191.rs and dead_stores_bette…
CastilloDel Apr 14, 2024
f0f867e
Run filecheck on dest-prop/simple.rs
CastilloDel Apr 14, 2024
2d5a483
Acknowledge comments
CastilloDel Jun 26, 2024
4819270
use "bootstrap" instead of "rustbuild" in comments and docs
onur-ozkan Jul 6, 2024
99721c8
Clear `inner_attr_ranges` regularly.
nnethercote Jul 8, 2024
a47ae57
Use an `@` pattern to shorten some code.
nnethercote Jul 8, 2024
b162013
Use iterator normally in `make_attr_token_stream`.
nnethercote Jul 8, 2024
a88c4d6
Split the stack in `make_attr_token_stream`.
nnethercote Jul 8, 2024
f552794
Move `Spacing` into `FlatToken`.
nnethercote Jul 8, 2024
8a390ba
Change empty replace range condition.
nnethercote Jul 10, 2024
fee1525
Rework `Attribute::get_tokens`.
nnethercote Jul 10, 2024
d8b6aa6
Use `cfg_attr` as a name more.
nnethercote Jul 10, 2024
d6ebbbf
Factor out `AttrsTarget` flattening code.
nnethercote Jul 10, 2024
478ba59
Add some comments.
nnethercote Jul 10, 2024
7fc6943
Use ManuallyDrop in BufWriter::into_parts
saethlin Jul 12, 2024
4d35754
Add URL and crate_name to test cases
notriddle Jul 13, 2024
17419f6
rustdoc: rename `issue-\d+.rs` tests to have meaningful names
notriddle Jul 13, 2024
42ee400
Move assertion-free rustdoc ice tests to rustdoc-ui
notriddle Jul 13, 2024
4c493db
Rollup merge of #122300 - CastilloDel:master, r=cjgillot
workingjubilee Jul 14, 2024
1d59d22
Rollup merge of #127434 - onur-ozkan:use-bootstrap-instead-of-rustbui…
workingjubilee Jul 14, 2024
1c8ea14
Rollup merge of #127477 - nnethercote:tweak-inner_attr_ranges, r=petr…
workingjubilee Jul 14, 2024
125343e
Rollup merge of #127558 - nnethercote:more-Attribute-cleanups, r=petr…
workingjubilee Jul 14, 2024
2d8493b
Rollup merge of #127659 - saethlin:manually-drop-bufwriter, r=joboet
workingjubilee Jul 14, 2024
6a3566c
Rollup merge of #127671 - notriddle:notriddle/issue-d, r=Mark-Simulacrum
workingjubilee Jul 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/mir-opt/dest-prop/branch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that assignment in both branches of an `if` are eliminated.
//@ test-mir-pass: DestinationPropagation
Expand All @@ -12,6 +11,10 @@ fn cond() -> bool {

// EMIT_MIR branch.foo.DestinationPropagation.diff
fn foo() -> i32 {
// CHECK-LABEL: fn foo(
// CHECK: debug y => [[y:_.*]];
// CHECK: [[y]] = val()
// CHECK-NOT: [[y]] = {{_.*}};
let x = val();

let y = if cond() {
Expand Down
18 changes: 17 additions & 1 deletion tests/mir-opt/dest-prop/copy_propagation_arg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that DestinationPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
Expand All @@ -9,25 +8,42 @@ fn dummy(x: u8) -> u8 {

// EMIT_MIR copy_propagation_arg.foo.DestinationPropagation.diff
fn foo(mut x: u8) {
// CHECK-LABEL: fn foo(
// CHECK: debug x => [[x:_.*]];
// CHECK: dummy(move [[x]])
// CHECK: [[x]] = move {{_.*}};
// calling `dummy` to make a use of `x` that copyprop cannot eliminate
x = dummy(x); // this will assign a local to `x`
}

// EMIT_MIR copy_propagation_arg.bar.DestinationPropagation.diff
fn bar(mut x: u8) {
// CHECK-LABEL: fn bar(
// CHECK: debug x => [[x:_.*]];
// CHECK: dummy(move [[x]])
// CHECK: [[x]] = const 5_u8;
dummy(x);
x = 5;
}

// EMIT_MIR copy_propagation_arg.baz.DestinationPropagation.diff
fn baz(mut x: i32) -> i32 {
// CHECK-LABEL: fn baz(
// CHECK: debug x => [[x:_.*]];
// CHECK-NOT: [[x]] =
// self-assignment to a function argument should be eliminated
x = x;
x
}

// EMIT_MIR copy_propagation_arg.arg_src.DestinationPropagation.diff
fn arg_src(mut x: i32) -> i32 {
// CHECK-LABEL: fn arg_src(
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: [[y]] = [[x]]
// CHECK: [[x]] = const 123_i32;
// CHECK-NOT: {{_.*}} = [[y]];
let y = x;
x = 123; // Don't propagate this assignment to `y`
y
Expand Down
5 changes: 4 additions & 1 deletion tests/mir-opt/dest-prop/cycle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
//@ test-mir-pass: DestinationPropagation
Expand All @@ -8,6 +7,10 @@ fn val() -> i32 {

// EMIT_MIR cycle.main.DestinationPropagation.diff
fn main() {
// CHECK-LABEL: main(
// CHECK: debug x => [[x:_.*]];
// CHECK: [[x]] = val()
// CHECK-NOT: [[x]] = {{_.*}};
let mut x = val();
let y = x;
let z = y;
Expand Down
8 changes: 7 additions & 1 deletion tests/mir-opt/dest-prop/dead_stores_79191.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ test-mir-pass: DestinationPropagation

Expand All @@ -8,6 +7,13 @@ fn id<T>(x: T) -> T {

// EMIT_MIR dead_stores_79191.f.DestinationPropagation.after.mir
fn f(mut a: usize) -> usize {
// CHECK-LABEL: fn f(
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
// CHECK: [[b]] = [[a]];
// CHECK: [[a]] = const 5_usize;
// CHECK: [[a]] = move [[b]];
// CHECK: id::<usize>(move [[a]])
let b = a;
a = 5;
a = b;
Expand Down
8 changes: 7 additions & 1 deletion tests/mir-opt/dest-prop/dead_stores_better.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
Expand All @@ -12,6 +11,13 @@ fn id<T>(x: T) -> T {

// EMIT_MIR dead_stores_better.f.DestinationPropagation.after.mir
pub fn f(mut a: usize) -> usize {
// CHECK-LABEL: fn f(
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
// CHECK: [[b]] = [[a]];
// CHECK: [[a]] = const 5_usize;
// CHECK: [[a]] = move [[b]];
// CHECK: id::<usize>(move [[a]])
let b = a;
a = 5;
a = b;
Expand Down
8 changes: 7 additions & 1 deletion tests/mir-opt/dest-prop/simple.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
//@ test-mir-pass: DestinationPropagation
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
// CHECK-LABEL: fn nrvo(
// CHECK: debug init => [[init:_.*]];
// CHECK: debug buf => [[buf:_.*]];
// CHECK: [[buf]] = [const 0_u8; 1024];
// CHECK-NOT: {{_.*}} = [[init]];
// CHECK: move [[init]](move {{_.*}})
// CHECK: {{_.*}} = [[buf]]
let mut buf = [0; 1024];
init(&mut buf);
buf
Expand Down
2 changes: 2 additions & 0 deletions tests/mir-opt/dest-prop/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ fn val() -> u32 {

// EMIT_MIR union.main.DestinationPropagation.diff
fn main() {
// CHECK-LABEL: fn args(
// CHECK: {{_.*}} = Un { us: const 1_u32 };
union Un {
us: u32,
}
Expand Down