Skip to content

tests/ui: A New Order [23/N] - #143298

Merged
bors merged 2 commits into
rust-lang:masterfrom
Kivooeo:tf23
Jul 10, 2025
Merged

bors merged 2 commits into
rust-lang:masterfrom
Kivooeo:tf23

Conversation

@Kivooeo

@Kivooeo Kivooeo commented Jul 1, 2025

Copy link
Copy Markdown
Member

Note

Intermediate commits are intended to help review, but will be squashed prior to merge.

Some tests/ui/ housekeeping, to trim down number of tests directly under tests/ui/. Part of #133895.

r? @tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 1, 2025
@rust-log-analyzer

This comment has been minimized.

//! This test checks that expressions like `0 << b` don't accidentally
//! modify the variable `b` due to codegen issues with virtual registers.
//!
//! Regression test for <https://github.com/rust-lang/rust/issues/152>.

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.

Wow, old issue! That's only two months after https://www.github.com/rust-lang/rust/issues/1

@tgross35 tgross35 left a comment

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.

LGTM, please squash

@tgross35

tgross35 commented Jul 4, 2025

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Jul 4, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 626521d has been approved by tgross35

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 Jul 4, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 4, 2025
`tests/ui`: A New Order [23/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang#133895.

r? `@tgross35`
bors added a commit that referenced this pull request Jul 4, 2025
Rollup of 9 pull requests

Successful merges:

 - #141532 (std: sys: net: uefi: tcp4: Implement write)
 - #143085 (Port `#[non_exhaustive]` to the new attribute parsing infrastructure)
 - #143298 (`tests/ui`: A New Order [23/N])
 - #143372 (Remove names_imported_by_glob_use query.)
 - #143386 (Assign dependency bump PRs to me)
 - #143406 (Remove some unnecessary `unsafe` in VecCache)
 - #143408 (mbe: Gracefully handle macro rules that end after `=>`)
 - #143414 (remove special-casing of boxes from match exhaustiveness/usefulness analysis)
 - #143444 (clean up GVN TypeId test)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r-
#143454 (comment)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 4, 2025
let _ = 0_usize << b;
b <<= 1;
}
assert_eq!(8, b);

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.

Check size_of::<usize>() rather than a constant, this failed on 32bit.

Also you can update the above std::mem::size_of -> size_of since it's now in the prelude.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

uhm, do you mean like this?

pub fn main() {
    let mut b: usize = 1;
    while b < size_of::<usize>() {
        // This shift operation should not mutate `b`
        let _ = 0_usize << b;
        b <<= 1;
    }
    assert_eq!(size_of::<usize>(), b);
}

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.

You can test 32-bit behavior on the playground by replacing usize with u32 :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah i know that usize's size is different on different platforms, but I wonder about test above, is that correct now? the reason im asking and not just run ./x test is because it will took 10 minutes and all resoures of my machince which im not ready to give it rn

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.

All I was planning to do to validate is put it in the playground anyway, it indeed looks correct https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=3aaf2f28b9cb4e4e60d14ae7624df83c

Noticing one other thing though; I think it might important that we observe the intermediate value so it can't get optimized out. println was doing this before but got deleted here, could you add std::hint::black_box(b); at the end of the while loop?

@Kivooeo Kivooeo Jul 4, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i dont think that compiler can optimize this loop out, also i could miss understood you, i've added black_box to end of each iteration, and not after the while itself, not sure which one you exactly meant, but both should work fine i guess

@Kivooeo

Kivooeo commented Jul 4, 2025 •

Copy link
Copy Markdown
Member Author

hm, could this test be platform dependent? im not sure exactly what could cause this but when i was write this assert ive checked it and it was worked fine (its still do work fine in playground tho and CI passed, this is weird)

https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=d5c825b667ddbdcfd48c031dcdd0798a

Ah, ok, now i see the answer above

@tgross35

tgross35 commented Jul 4, 2025

Copy link
Copy Markdown
Member

Might as well
@bors2 try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

rust-bors Bot commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

⌛ Trying commit 4d4c3e2 with merge 71ca6be…

To cancel the try build, run the command @bors2 try cancel.

rust-bors Bot added a commit that referenced this pull request Jul 4, 2025
`tests/ui`: A New Order [23/N]

<!-- homu-ignore:start -->
<!--
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>
-->
<!-- homu-ignore:end -->

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895.

r? `@tgross35`
try-job: dist-i586-gnu-i586-i686-musl
@Kivooeo

Kivooeo commented Jul 4, 2025 •

Copy link
Copy Markdown
Member Author

not sure if this needed becuase we made it dependable and not hardcoded 8, but let's see

also not sure if i should force push tidy fix now or later, because im not sure what will happen with bors try

@Kivooeo

Kivooeo commented Jul 4, 2025

Copy link
Copy Markdown
Member Author

fixed tidy, maybe need bors try once again

@rust-bors

rust-bors Bot commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 71ca6be (71ca6be428c123c513694880a2b3b612510b964d, parent: e3843659e9f65f589d184d1221ac6149d5fa07b5)

@Kivooeo

Kivooeo commented Jul 5, 2025

Copy link
Copy Markdown
Member Author

yeah, safe to r+

@tgross35

tgross35 commented Jul 9, 2025

Copy link
Copy Markdown
Member

@bors r+

not sure if this needed becuase we made it dependable and not hardcoded 8, but let's see

It's pretty common to run a try job when adding a fix for something that failed, even if it's reasonably trivial like this

@bors

bors commented Jul 9, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 7c2cc2c has been approved by tgross35

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 9, 2025
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 10, 2025
`tests/ui`: A New Order [23/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang#133895.

r? `@tgross35`
bors added a commit that referenced this pull request Jul 10, 2025
Rollup of 9 pull requests

Successful merges:

 - #141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - #142911 (Remove support for dynamic allocas)
 - #142950 (mbe: Rework diagnostics for metavariable expressions)
 - #143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - #143298 (`tests/ui`: A New Order [23/N])
 - #143398 (tidy: add support for `--extra-checks=auto:` feature)
 - #143632 (fix: correct parameter names in LLVMRustBuildMinNum and LLVMRustBuildMaxNum FFI declarations)
 - #143644 (Add triagebot stdarch mention ping)
 - #143651 (Win: Use exceptions with empty data for SEH panic exception copies instead of a new panic)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 10, 2025
Rollup of 9 pull requests

Successful merges:

 - #141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - #142950 (mbe: Rework diagnostics for metavariable expressions)
 - #143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps)
 - #143265 (Mention as_chunks in the docs for chunks)
 - #143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - #143298 (`tests/ui`: A New Order [23/N])
 - #143396 (Move NaN tests to floats/mod.rs)
 - #143398 (tidy: add support for `--extra-checks=auto:` feature)
 - #143644 (Add triagebot stdarch mention ping)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 7ad9096 into rust-lang:master Jul 10, 2025
@rustbot rustbot added this to the 1.90.0 milestone Jul 10, 2025
rust-timer added a commit that referenced this pull request Jul 10, 2025
Rollup merge of #143298 - Kivooeo:tf23, r=tgross35

`tests/ui`: A New Order [23/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895.

r? ``@tgross35``
github-actions Bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jul 12, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - rust-lang#142950 (mbe: Rework diagnostics for metavariable expressions)
 - rust-lang#143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps)
 - rust-lang#143265 (Mention as_chunks in the docs for chunks)
 - rust-lang#143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - rust-lang#143298 (`tests/ui`: A New Order [23/N])
 - rust-lang#143396 (Move NaN tests to floats/mod.rs)
 - rust-lang#143398 (tidy: add support for `--extra-checks=auto:` feature)
 - rust-lang#143644 (Add triagebot stdarch mention ping)

r? `@ghost`
`@rustbot` modify labels: rollup
Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request Dec 21, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - rust-lang/rust#142950 (mbe: Rework diagnostics for metavariable expressions)
 - rust-lang/rust#143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps)
 - rust-lang/rust#143265 (Mention as_chunks in the docs for chunks)
 - rust-lang/rust#143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - rust-lang/rust#143298 (`tests/ui`: A New Order [23/N])
 - rust-lang/rust#143396 (Move NaN tests to floats/mod.rs)
 - rust-lang/rust#143398 (tidy: add support for `--extra-checks=auto:` feature)
 - rust-lang/rust#143644 (Add triagebot stdarch mention ping)

r? `@ghost`
`@rustbot` modify labels: rollup
Kobzol pushed a commit to Kobzol/rustc_codegen_cranelift that referenced this pull request Dec 29, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - rust-lang/rust#142950 (mbe: Rework diagnostics for metavariable expressions)
 - rust-lang/rust#143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps)
 - rust-lang/rust#143265 (Mention as_chunks in the docs for chunks)
 - rust-lang/rust#143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - rust-lang/rust#143298 (`tests/ui`: A New Order [23/N])
 - rust-lang/rust#143396 (Move NaN tests to floats/mod.rs)
 - rust-lang/rust#143398 (tidy: add support for `--extra-checks=auto:` feature)
 - rust-lang/rust#143644 (Add triagebot stdarch mention ping)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants