Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
beetrees:fix-f16-f128-literal-feature-gate
Apr 3, 2025
Merged

Fix the f16/f128 feature gates on integer literals#139294
bors merged 1 commit into
rust-lang:masterfrom
beetrees:fix-f16-f128-literal-feature-gate

Conversation

@beetrees

Copy link
Copy Markdown
Contributor

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

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

This PR fixes that.

Tracking issue: #116909

@rustbot

Copy link
Copy Markdown
Collaborator

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

@rustbotrustbot 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
@beetreesbeetrees changed the title Fix the f16/f128 feature gate on integer literalsFix the f16/f128 feature gates on integer literalsApr 3, 2025
@fmease

fmease commented Apr 3, 2025

Copy link
Copy Markdown
Member

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

bors commented Apr 3, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 62fcb9d has been approved by fmease

It is now in the queue for this repository.

@borsbors 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
@m-ou-sem-ou-se mentioned this pull request Apr 3, 2025
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:masterApr 3, 2025
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
@rustbotrustbot 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-actionsBot 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
@tgross35tgross35 added the F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` label Apr 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]`S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@beetrees@rustbot@fmease@bors@tgross35