Skip to content

Relocate tests in tests/ui #140029

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged

Relocate tests in tests/ui #140029

merged 1 commit into from
Apr 21, 2025

Conversation

reddevilmidzy
Copy link
Contributor

Part of #133895

Moved tests from a top-level directory into a more appropriate subdirectory.
If there is anything else that could be improved, please let me know!

r? jieyouxu

@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 Apr 19, 2025
@reddevilmidzy reddevilmidzy changed the title Move test Relocate tests in tests/ui Apr 19, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! So, the new locations and names for these tests look good -- however, I'd like to see some short doc comments on the test intentions (they were not very obvious to me).

Please also squash the commits into one.

Copy link
Member

Choose a reason for hiding this comment

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

Discussion: I honestly have no idea what this test is actually trying to exercise. This goes all the way back to 2010 d6b7c96.

I assume this is trying to exercise some short-circuiting behavior of || and && but the test itself makes it hard to tell.

EDIT: the OG version of this Rust was

fn incr(mutable &int x) -> bool {
  x += 1;
  check (false);
  ret false;
}

fn main() {

  auto x = (1 == 2) || (3 == 3);
  check (x);

  let int y = 10;
  log x || incr(y);
  check (y == 10);

  if (true && x) {
    check (true);
  } else {
    check (false);
  }

}

so yeah, I believe this is indeed a || and && short-circuiting test. It has a no-arg closure, presumably because back then there must've been a case where the parser confused || and the no-arg closure form || EXPR or sth.

Copy link
Member

Choose a reason for hiding this comment

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

What's amusing is that this is one of the listings of the archive of OG rust syntax listed at https://brson.github.io/archaea/lazy-and-or.html/.

EDIT: I realized you can actually see the dynamic evolution of this test on that listing!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the analysis and sharing that interesting link! Now I understand that this test verifies short-circuiting behavior of logical operators.

I'll update the test with clearer naming and comments to better express its purpose while preserving the original functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And thanks for the historical context! That's super helpful 😁

Copy link
Member

Choose a reason for hiding this comment

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

Discussion: so this one is also introduced in the 2010 populate tree commit, and it kinda has been preserved all these years modulo some language changes. I believe this is some kind of "positive" smoke test of a tree of owned memory...?

Originally (like back in Rust 0.8), this was

tag list {
  cons(int,@list);
  nil;
}

fn main() {
  cons(10, @cons(11, @cons(12, @nil)));
}

This is also one of the OG rust syntax examples at https://brson.github.io/archaea/list.html.

Copy link
Member

Choose a reason for hiding this comment

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

Remark: yeah, this test is because unary negation on an owned string didn't use to properly typeck, back in de4b383.

@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 Apr 19, 2025
@jieyouxu

This comment was marked as outdated.

@rustbot

This comment was marked as off-topic.

@rust-log-analyzer

This comment has been minimized.

@reddevilmidzy reddevilmidzy requested a review from jieyouxu April 19, 2025 13:51
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 19, 2025
@jieyouxu
Copy link
Member

One nit, otherwise looks good

@rustbot author

(Sorry oli, I had to do some more archaeology to figure out what the original tests were doing)

@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 Apr 20, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2025

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

@jieyouxu jieyouxu added the A-testsuite Area: The testsuite used to check the correctness of rustc label Apr 20, 2025
@reddevilmidzy
Copy link
Contributor Author

@rustbot ready

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

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Actually on another review pass I realized I have a few more nits.

@jieyouxu
Copy link
Member

@rustbot author

@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 Apr 21, 2025
@reddevilmidzy
Copy link
Contributor Author

Thank you for the thorough review!

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 21, 2025

📌 Commit dd2d6b2 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 21, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139946 (fix missing word in comment)
 - rust-lang#139982 (SystemTime doc tweaks)
 - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic)
 - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop)
 - rust-lang#140029 (Relocate tests in `tests/ui`)
 - rust-lang#140030 (Fix autodiff debug builds)
 - rust-lang#140120 (Use `output_base_dir` for `mir_dump_dir`)
 - rust-lang#140121 (Document why CodeStats::type_sizes is public)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f8c67c6 into rust-lang:master Apr 21, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup merge of rust-lang#140029 - reddevilmidzy:move-test, r=jieyouxu

Relocate tests in `tests/ui`

Part of rust-lang#133895

Moved tests from a top-level directory into a more appropriate subdirectory.
If there is anything else that could be improved, please let me know!

r? jieyouxu
@reddevilmidzy reddevilmidzy deleted the move-test branch April 22, 2025 00:07
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 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