Skip to content

Conversation

@AudaciousAxiom
Copy link
Contributor

@AudaciousAxiom AudaciousAxiom commented Nov 29, 2025

This should hopefully unblock #149425 (I couldn't find an in-flight PR that was already doing this).
I've tested locally with the master version of Clippy that rustc_codegen_gcc passes the lints (the syncing PR could still fail for other reasons however).

I understand that rustc_codegen_gcc is normally developed outside of this repo but my understanding is that that repo is two-way synced regularly and hopefully it is acceptable to do this tiny change here to unblock the Clippy syncing PR (is there an established process for how to unblock these syncing PRs?). Of course feel free to close if this isn't the expected process.

r? @matthiaskrgr

@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@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 Nov 29, 2025
@workingjubilee
Copy link
Member

Yeah, it should be fine.

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 29, 2025

📌 Commit d3653e9 has been approved by workingjubilee

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 Nov 29, 2025
bors added a commit that referenced this pull request Nov 29, 2025
Rollup of 3 pull requests

Successful merges:

 - #144000 (Add `DefId::parent()` accessor for `rustc_public`)
 - #149409 (Test the coexistence of 'stack-protector' and 'safe-stack')
 - #149449 (Remove an unnecessary `unwrap` in `rustc_codegen_gcc`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3b9b370 into rust-lang:main Nov 29, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Nov 29, 2025
Rollup merge of #149449 - AudaciousAxiom:refactor/rustc-codegen-gcc-remove-unnecessary-unwrap, r=workingjubilee

Remove an unnecessary `unwrap` in `rustc_codegen_gcc`

This should hopefully unblock #149425 (I couldn't find an in-flight PR that was already doing this).
I've tested  locally with the `master` version of Clippy that `rustc_codegen_gcc` passes the lints (the syncing PR could still fail for other reasons however).

I understand that `rustc_codegen_gcc` is normally developed [outside of this repo](https://github.com/rust-lang/rustc_codegen_gcc) but my understanding is that that repo is two-way synced regularly and hopefully it is acceptable to do this tiny change here to unblock the Clippy syncing PR (is there an established process for how to unblock these syncing PRs?). Of course feel free to close if this isn't the expected process.
@rustbot rustbot added this to the 1.93.0 milestone Nov 29, 2025
Comment on lines +506 to 509
if let Some(location) = bx.location {
#[cfg(feature = "master")]
rvalue.set_location(bx.location.unwrap());
rvalue.set_location(location);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably going to cause some clippy failures on our side, though.
Better would have been:

Suggested change
if let Some(location) = bx.location {
#[cfg(feature = "master")]
rvalue.set_location(bx.location.unwrap());
rvalue.set_location(location);
}
#[cfg(feature = "master")]
if let Some(location) = bx.location {
rvalue.set_location(location);
}

Copy link
Member

Choose a reason for hiding this comment

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

Hm. It seems unlikely that it would do so, @antoyo, given it fixes a clippy lint? But I will try to pay closer attention to the cfg on any PRs in this area.

Copy link
Member

@workingjubilee workingjubilee Nov 29, 2025

Choose a reason for hiding this comment

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

I suppose it might seem weird as an "empty" conditional?

Copy link
Contributor

Choose a reason for hiding this comment

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

When the feature master is disabled, the variable location is unused. That might even be a compiler warning instead of a clippy warning.

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