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

Use LitKind::Err for malformed floats #121724

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

nnethercote
Copy link
Contributor

#121120 changed StringReader::cook_lexer_literal to return LitKind::Err for malformed integer literals. This commit does the same for float literals, for consistency.

r? @fmease

@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 28, 2024
@nnethercote
Copy link
Contributor Author

Best reviewed one commit at at time.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

r=me with failing test blessed

This prevents a follow-up type error in a test, which seems fine.
- Put every literal in its own braces, rather than just some of them,
  for maximal error recovery.
- Add a blank line between every case, for readability.
This slightly changes error messages in `float-field.rs`, but nothing of
real importance.
@nnethercote nnethercote force-pushed the LitKind-Err-for-floats branch from 7772605 to 840c8d3 Compare February 28, 2024 10:08
@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@nnethercote
Copy link
Contributor Author

I fixed the clippy test. I think the change kind of neuters it, because the path to the crash that was happening is no longer possible. But I don't think that matters much.

@bors r=fmease

@fmease
Copy link
Member

fmease commented Feb 28, 2024

Bors?

@bors r+

@fmease fmease closed this Feb 28, 2024
@fmease fmease reopened this Feb 28, 2024
@fmease
Copy link
Member

fmease commented Feb 28, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 28, 2024

📌 Commit 840c8d3 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 Feb 28, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 28, 2024
…, r=fmease

Use `LitKind::Err` for malformed floats

rust-lang#121120 changed `StringReader::cook_lexer_literal` to return `LitKind::Err` for malformed integer literals. This commit does the same for float literals, for consistency.

r? `@fmease`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 29, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#110543 (Make `ReentrantLock` public)
 - rust-lang#121689 ([rustdoc] Prevent inclusion of whitespace character after macro_rules ident)
 - rust-lang#121724 (Use `LitKind::Err` for malformed floats)
 - rust-lang#121735 (pattern analysis: Don't panic when encountering unexpected constructor)
 - rust-lang#121743 (Opportunistically resolve regions when processing region outlives obligations)

Failed merges:

 - rust-lang#121326 (Detect empty leading where clauses on type aliases)
 - rust-lang#121416 (Improve error messages for generics with default parameters)
 - rust-lang#121669 (Count stashed errors again)
 - rust-lang#121723 (Two diagnostic things)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 686a4b1 into rust-lang:master Feb 29, 2024
22 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 29, 2024
Rollup merge of rust-lang#121724 - nnethercote:LitKind-Err-for-floats, r=fmease

Use `LitKind::Err` for malformed floats

rust-lang#121120 changed `StringReader::cook_lexer_literal` to return `LitKind::Err` for malformed integer literals. This commit does the same for float literals, for consistency.

r? ``@fmease``
@nnethercote nnethercote deleted the LitKind-Err-for-floats branch February 29, 2024 05:01
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 7, 2024
…, r=fmease

Use `LitKind::Err` for malformed floats

rust-lang#121120 changed `StringReader::cook_lexer_literal` to return `LitKind::Err` for malformed integer literals. This commit does the same for float literals, for consistency.

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

5 participants