Skip to content
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

Fix unwrap error in overflowing int literal #136760

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

chenyukang
Copy link
Member

Fixes #136675

it's maybe negative only from check_lit, in this scenario the fields in TypeLimits is none.

r? @oli-obk

@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 Feb 9, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Feb 9, 2025

Well the unwrap existed for a reason. My preferred way would be to check the negated hir id again instead of using the result of combining the negated arg and the negated hir id.

@chenyukang chenyukang force-pushed the fix-overflowing-int-lint-crash branch from 526e328 to ace6bb9 Compare February 9, 2025 12:39
@chenyukang
Copy link
Member Author

Well the unwrap existed for a reason. My preferred way would be to check the negated hir id again instead of using the result of combining the negated arg and the negated hir id.

you mean don't use this line:

let negative = negated ^ (type_limits.negated_expr_id == Some(hir_id));

I updated the change.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 9, 2025

I guess that works too, very nice

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 9, 2025

📌 Commit ace6bb9 has been approved by oli-obk

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 Feb 9, 2025
Urgau added a commit to Urgau/rust that referenced this pull request Feb 9, 2025
…t-crash, r=oli-obk

Fix unwrap error in overflowing int literal

Fixes rust-lang#136675

it's maybe `negative` only from [check_lit](https://github.com/chenyukang/rust/blob/526e3288feb68eac55013746e03fb54d6a0b9a1e/compiler/rustc_lint/src/types.rs#L546), in this scenario the fields in `TypeLimits` is none.

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 9, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#134999 (Add cygwin target.)
 - rust-lang#135488 (Stabilize `vec_pop_if`)
 - rust-lang#136068 (crashes: more tests)
 - rust-lang#136694 (Update minifier version to `0.3.4`)
 - rust-lang#136760 (Fix unwrap error in overflowing int literal)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135488 (Stabilize `vec_pop_if`)
 - rust-lang#136068 (crashes: more tests)
 - rust-lang#136694 (Update minifier version to `0.3.4`)
 - rust-lang#136722 (Visit all debug info in MIR Visitor)
 - rust-lang#136746 (Emit an error if `-Zdwarf-version=1` is requested)
 - rust-lang#136760 (Fix unwrap error in overflowing int literal)
 - rust-lang#136782 (Fix mistake in x86_64-unknown-freebsd platform description)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b5b460d into rust-lang:master Feb 10, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 10, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
Rollup merge of rust-lang#136760 - chenyukang:fix-overflowing-int-lint-crash, r=oli-obk

Fix unwrap error in overflowing int literal

Fixes rust-lang#136675

it's maybe `negative` only from [check_lit](https://github.com/chenyukang/rust/blob/526e3288feb68eac55013746e03fb54d6a0b9a1e/compiler/rustc_lint/src/types.rs#L546), in this scenario the fields in `TypeLimits` is none.

r? ``@oli-obk``
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.

ICE: None in type limit lint(?)
4 participants