Skip to content

Conversation

@jhpratt
Copy link
Member

@jhpratt jhpratt commented Dec 13, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

notJoon and others added 29 commits August 12, 2025 07:49
This flag was an artifact of compiletest's old libtest-based test executor, and
currently doesn't influence compiletest's output at all.
This commit introduces two new constants to SystemTime: `MIN` and `MAX`,
whose value represent the maximum values for the respective data type,
depending upon the platform.

Technically, this value is already obtainable during runtime with the
following algorithm: Use `SystemTime::UNIX_EPOCH` and call `checked_add`
(or `checked_sub`) repeatedly with `Duration::new(0, 1)` on it, until it
returns None.  Mathematically speaking, this algorithm will terminate
after a finite amount of steps, yet it is impractical to run it, as it
takes practically forever.

Besides, this commit also adds a unit test.  Concrete implementation
depending upon the platform is done in later commits.

In the future, the hope of the authors lies within the creation of a
`SystemTime::saturating_add` and `SystemTime::saturating_sub`, similar
to the functions already present in `std::time::Duration`.  However, for
those, these constants are crucially required, thereby this should be
seen as the initial step towards this direction.

Below are platform specifc notes:

# Hermit

The HermitOS implementation is more or less identitcal to the Unix one.

# sgx

The implementation uses a `Duration` to store the Unix time, thereby
implying `Duration::ZERO` and `Duration::MAX` as the limits.

# solid

The implementation uses a `time_t` to store the system time within a
single value (i.e. no dual secs/nanosecs handling), thereby implying its
`::MIN` and `::MAX` values as the respective boundaries.

# UEFI

UEFI has a weird way to store times, i.e. a very complicated struct.
The standard proclaims "1900-01-01T00:00:00+0000" to be the lowest
possible value and `MAX_UEFI_TIME` is already present for the upper
limit.

# Windows

Windows is weird.  The Win32 documentation makes no statement on a
maximum value here.  Next to this, there are two conflicting types:
`SYSTEMTIME` and `FILETIME`.  Rust's Standard Library uses `FILETIME`,
whose limit will (probably) be `i64::MAX` packed into two integers.
However, `SYSTEMTIME` has a lower-limit.

# xous

It is similar to sgx in the sense of using a `Duration`.

# unsupported

Unsupported platforms store a `SystemTime` in a `Duration`, just like
sgx, thereby implying `Duration::ZERO` and `Duration::MAX` as the
respective limits.
This logic is cargo-specific anyway, so there is no need for it to be a
generally-available helper method.
The `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES` lint was missing from
this causing it to be an unknown lint when attempting to allow it.
…toyo

Update `rustc_codegen_gcc` rotate operation document

## Description

This PR resolves a TODO comment in the `rustc_codegen_gcc` backend by documenting that the rotate operations (`rotate_left` and `rotate_right`) already implement the optimized branchless algorithm from comment.

The existing implementation already uses the optimal branchless rotation pattern:
- For left rotation: `(x << n) | (x >> (-n & (width-1)))`
- For right rotation: `(x >> n) | (x << (-n & (width-1)))`

This pattern avoids branches and generates efficient machine code across different platforms, which was the goal mentioned in the original TODO.

## Changes

- Removed the TODO comment that suggested implementing the algorithm from https://blog.regehr.org/archives/1063
…=ChrisDenton

Add SystemTime::{MIN, MAX}

Accepted ACP: <rust-lang/libs-team#692>
Tracking Issue: <rust-lang#149067>

---

This merge request introduces two new constants to `SystemTime`: `MIN` and `MAX`, whose values represent the maximum values for the respective data type, depending upon the platform.

Technically, this value is already obtainable during runtime with the following algorithm:
Use `SystemTime::UNIX_EPOCH` and call `checked_add` (or `checked_sub`) repeatedly with `Duration::new(0, 1)` on it, until it returns None.
Mathematically speaking, this algorithm will terminate after a finite amount of steps, yet it is impractical to run it, as it takes practically forever.

Besides, this commit also adds a unit test to verify those values represent the respective minimum and maximum, by letting a `checked_add` and `checked_sub` on it fail.

In the future, the hope of the authors lies within the creation of a `SystemTime::saturating_add` and `SystemTime::saturating_sub`, similar to the functions already present in `std::time::Duration`.
However, for those, these constants are crucially required, thereby this should be seen as the initial step towards this direction.
With this change, implementing these functions oneself outside the standard library becomes feasible in a portable manner for the first time.

This feature (and a related saturating version of `checked_{add, sub}` has been requested multiple times over the course of the past few years, most notably:
* rust-lang#100141
* rust-lang#133525
* rust-lang#105762
* rust-lang#71224
* rust-lang#45448
* rust-lang#52555
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
…49038, r=estebank

Add proper suggestion for associated function with unknown field

Fixes rust-lang#149038

The first commit is changing the old suggestion to verbose,
the second commit is a new added suggestion.

r? `@estebank`
…legation, r=petrochenkov

Inherit attributes in delegation

This PR adds support for inheriting attributes of the original function of the delegation and is a part of rust-lang#118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found [here](https://github.com/aerooneqq/public-docs/blob/master/rust/delegation/processed_attributes.md).

r? `@petrochenkov`
…r=petrochenkov

Fix: Prevent macro-expanded extern crates from shadowing extern arguments

prevents an ICE by fixing a logic bug in `build_reduced_graph.rs`.
the bug caused the compiler to correctly detect and report a shadowing error for a macro-expanded `extern crate` but then continue processing the invalid item, corrupting the resolver's internal state (`extern_prelude`) and leading to a crash in later resolution passes the fix adds an early return after the shadowing error is reported to ensure the invalid item is not added to the resolution graph.

Fixes rust-lang#149821
…sync, r=eholk

Weak for Arc pointer is marked as DynSend/DynSync

`std::sync::Weak` (weak pointer for Arc) added to DynSend and DynSync (looks like it was missed to add there when implemented).
…=jdonszelmann

Remove unused code in `cfg_old`

r? ``@jdonszelmann``

Fixes one of the todos from rust-lang#149865
bootstrap: Don't pass an unused `--color` to compiletest

- Follow-up to rust-lang#149850

---

This flag was an artifact of compiletest's old libtest-based test executor, and currently doesn't influence compiletest's output at all.

A follow-up commit also inlines `force_coloring_in_ci` into its only remaining caller, and updates its comment.
…petrochenkov

Add a sanity check in case of any duplicate nodes

A simple check in case compiler tries to encode a dep node twice like in rust-lang#141540.

Also if we'd try to mark a red node as green as it may then create a bad `DepNodeIndex` like in rust-lang#148295.

If it prevents rust-lang#141540 from emitting a faulty `dep-graph.bin` file via panic then it means you will be able to temporarily fix it by simply restarting cargo or rust-analyzer without cleaning up incremental cache.
… r=davidtwco

`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`

The `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES` lint was missing from this causing it to be an unknown lint when attempting to allow it.

r? `@davidtwco`
@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Dec 13, 2025
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-windows Operating system: Windows 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) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Dec 13, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Dec 13, 2025

@bors r+ rollup=never p=5

@rustbot rustbot added the rollup A PR which is a rollup label Dec 13, 2025
@bors
Copy link
Collaborator

bors commented Dec 13, 2025

📌 Commit f90ae7f has been approved by jhpratt

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 Dec 13, 2025
@bors
Copy link
Collaborator

bors commented Dec 13, 2025

⌛ Testing commit f90ae7f with merge 7941e11...

bors added a commit that referenced this pull request Dec 13, 2025
Rollup of 11 pull requests

Successful merges:

 - #145278 (Update `rustc_codegen_gcc` rotate operation document)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - #149177 (Add proper suggestion for associated function with unknown field)
 - #149843 (Inherit attributes in delegation)
 - #149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - #149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - #149903 (Remove unused code in `cfg_old`)
 - #149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - #149916 (Add a sanity check in case of any duplicate nodes)
 - #149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- system_time_max_min stdout ----

thread 'system_time_max_min' (7728) panicked at library\std\tests\time.rs:260:5:
assertion failed: SystemTime::MAX.checked_add(Duration::new(0, 1)).is_none()
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- system_time_max_min stdout end ----

failures:
    system_time_max_min

test result: FAILED. 12 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 618.22ms

error: test failed, to rerun pass `-p std --test time`
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src`
Build completed unsuccessfully in 1:24:59
make: *** [Makefile:112: ci-msvc-py] Error 1
  local time: Sat Dec 13 05:53:43 CUT 2025
  network time: Sat, 13 Dec 2025 05:53:43 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@bors
Copy link
Collaborator

bors commented Dec 13, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 13, 2025
@jhpratt jhpratt closed this Dec 13, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2025
@jhpratt jhpratt deleted the rollup-7b6iyje branch December 13, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-windows Operating system: Windows rollup A PR which is a rollup 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.