Skip to content

Fix the f16/f128 feature gates on integer literals #139294

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 3, 2025

Conversation

beetrees
Copy link
Contributor

@beetrees beetrees commented Apr 3, 2025

The feature gating logic for f16/f128 currently only checks float literals, meaning this code currently compiles with no feature gates on stable (playground):

fn main() {
    let a = 1f16;
    let b = 1f128;
    dbg!(a, b);
}

This PR fixes that.

Tracking issue: #116909

@rustbot
Copy link
Collaborator

rustbot commented Apr 3, 2025

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 3, 2025
@beetrees beetrees changed the title Fix the f16/f128 feature gate on integer literals Fix the f16/f128 feature gates on integer literals Apr 3, 2025
@fmease
Copy link
Member

fmease commented Apr 3, 2025

Wow, this is bad! Thanks a lot, very good catch!

I don't think anyone is relying on this since you can't do a whole lot with them (type names are unstable, library functions except operators and trait impls are unstable). Therefore I'll approve this as is and accept potential breakages.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 3, 2025

📌 Commit 62fcb9d has been approved by fmease

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 Apr 3, 2025
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Apr 3, 2025
…ure-gate, r=fmease

Fix the `f16`/`f128` feature gates on integer literals

The feature gating logic for `f16`/`f128` currently only checks float literals, meaning this code currently compiles with no feature gates on stable ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b0c0e285ccb822fc7e2abc595557886b)):
```rust
fn main() {
    let a = 1f16;
    let b = 1f128;
    dbg!(a, b);
}
```
This PR fixes that.

Tracking issue: rust-lang#116909
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#139080 (Experimental feature gate for `super let`)
 - rust-lang#139145 (slice: Remove some uses of unsafe in first/last chunk methods)
 - rust-lang#139149 (unstable book: document import_trait_associated_functions)
 - rust-lang#139273 (Apply requested API changes to `cell_update`)
 - rust-lang#139282 (rustdoc: make settings checkboxes always square)
 - rust-lang#139283 (Rustc dev guide subtree update)
 - rust-lang#139294 (Fix the `f16`/`f128` feature gates on integer literals)

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#139080 (Experimental feature gate for `super let`)
 - rust-lang#139145 (slice: Remove some uses of unsafe in first/last chunk methods)
 - rust-lang#139149 (unstable book: document import_trait_associated_functions)
 - rust-lang#139273 (Apply requested API changes to `cell_update`)
 - rust-lang#139282 (rustdoc: make settings checkboxes always square)
 - rust-lang#139283 (Rustc dev guide subtree update)
 - rust-lang#139294 (Fix the `f16`/`f128` feature gates on integer literals)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 29c0fe7 into rust-lang:master Apr 3, 2025
6 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2025
Rollup merge of rust-lang#139294 - beetrees:fix-f16-f128-literal-feature-gate, r=fmease

Fix the `f16`/`f128` feature gates on integer literals

The feature gating logic for `f16`/`f128` currently only checks float literals, meaning this code currently compiles with no feature gates on stable ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b0c0e285ccb822fc7e2abc595557886b)):
```rust
fn main() {
    let a = 1f16;
    let b = 1f128;
    dbg!(a, b);
}
```
This PR fixes that.

Tracking issue: rust-lang#116909
@rustbot rustbot added this to the 1.88.0 milestone Apr 3, 2025
@beetrees beetrees deleted the fix-f16-f128-literal-feature-gate branch April 3, 2025 19:17
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 8, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#139080 (Experimental feature gate for `super let`)
 - rust-lang#139145 (slice: Remove some uses of unsafe in first/last chunk methods)
 - rust-lang#139149 (unstable book: document import_trait_associated_functions)
 - rust-lang#139273 (Apply requested API changes to `cell_update`)
 - rust-lang#139282 (rustdoc: make settings checkboxes always square)
 - rust-lang#139283 (Rustc dev guide subtree update)
 - rust-lang#139294 (Fix the `f16`/`f128` feature gates on integer literals)

r? `@ghost`
`@rustbot` modify labels: rollup
@tgross35 tgross35 added the F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` label Apr 28, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` 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.

5 participants