Skip to content

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Sep 3, 2025

First step to solve #145364

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 3, 2025
@rust-log-analyzer

This comment has been minimized.

@pvdrz pvdrz force-pushed the pvdrz/edition-range branch from a19047a to 714f2ca Compare September 3, 2025 16:48
@fmease
Copy link
Member

fmease commented Sep 3, 2025

r? fmease

@pvdrz pvdrz marked this pull request as ready for review September 3, 2025 19:07
@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 Sep 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 3, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jieyouxu jieyouxu self-assigned this Sep 3, 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.

Initial pass. I still need to think about the implication of this a bit.

View changes since this review

) -> Option<EditionRange> {
let raw = config.parse_name_value_directive(line, "edition", testfile, line_number)?;

if let Some((greter_equal_than, lower_than)) = raw.split_once("..") {
Copy link
Member

Choose a reason for hiding this comment

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

Nit (typo): greater

) -> Option<EditionRange> {
let raw = config.parse_name_value_directive(line, "edition", testfile, line_number)?;

if let Some((greter_equal_than, lower_than)) = raw.split_once("..") {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: can you just call these lower_bound and upper_bound?

And also leave a quick comment here

// Edition range is half-open: `[lower_bound, upper_bound)`

Comment on lines 1805 to 1806
(None, Some(_)) => panic!("..edition is not a supported range in //@ edition"),
(None, None) => panic!("'..' is not a supported range in //@ edition"),
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: can you please use fatal!(), and include the test file path + line number, so the user can have some idea of where this failed?

enum EditionRange {
Exact(Edition),
GreaterEqualThan(Edition),
Range { greater_equal_than: Edition, lower_than: Edition },
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Range { lower_bound: Edition, upper_bound: Edition }

enum EditionRange {
Exact(Edition),
GreaterEqualThan(Edition),
Range { greater_equal_than: Edition, lower_than: Edition },
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: can you add a doc comment for this as

/// Half-open range: `[lower_bound, upper_bound)`

@pvdrz
Copy link
Contributor Author

pvdrz commented Sep 5, 2025

@jieyouxu this is ready for another review I think 🎉

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-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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants