Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err.#121120
Merged
bors merged 5 commits intorust-lang:masterfrom Feb 15, 2024
Merged
Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err.#121120bors merged 5 commits intorust-lang:masterfrom
ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err.#121120bors merged 5 commits intorust-lang:masterfrom
Conversation
Collaborator
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
Contributor
Author
Contributor
Author
|
Note: I didn't add |
fmease
reviewed
Feb 15, 2024
|
|
||
| #[derive(Debug)] | ||
| pub enum LitError { | ||
| LexerError, |
Contributor
Author
|
Best reviewed one commit at a time. |
This comment has been minimized.
This comment has been minimized.
`cook_lexer_literal` can emit an error about an invalid int literal but then return a non-`Err` token. And then `integer_lit` has to account for this to avoid printing a redundant error message. This commit changes `cook_lexer_literal` to return `Err` in that case. Then `integer_lit` doesn't need the special case, and `LitError::LexerError` can be removed.
This will be helpful for subsequent commits.
And use the result in `cook_common` to decide whether to return an error token.
6caf605 to
57c7326
Compare
fmease
reviewed
Feb 15, 2024
This mostly works well, and eliminates a couple of delayed bugs. One annoying thing is that we should really also add an `ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`, so we have to fake it.
57c7326 to
25ed6e4
Compare
To avoid some unwrapping.
fmease
approved these changes
Feb 15, 2024
Member
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 15, 2024
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#120449 (Document requirements for unsized {Rc,Arc}::from_raw) - rust-lang#120505 (Fix BTreeMap's Cursor::remove_{next,prev}) - rust-lang#120672 (std::thread update freebsd stack guard handling.) - rust-lang#121088 (Implicitly enable evex512 if avx512 is enabled) - rust-lang#121104 (Ignore unsized types when trying to determine the size of the original type) - rust-lang#121107 (Fix msg for verbose suggestions with confusable capitalization) - rust-lang#121113 (Continue compilation even if inherent impl checks fail) - rust-lang#121120 (Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 15, 2024
Rollup merge of rust-lang#121120 - nnethercote:LitKind-Err-guar, r=fmease Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`. Similar to recent work doing the same for `ExprKind::Err` (rust-lang#120586) and `TyKind::Err` (rust-lang#121109). r? `@oli-obk`
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Feb 26, 2024
…ease Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`. Similar to recent work doing the same for `ExprKind::Err` (rust-lang#120586) and `TyKind::Err` (rust-lang#121109). r? `@oli-obk`
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`
matthiaskrgr
added a commit
to matthiaskrgr/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``
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``
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``
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to recent work doing the same for
ExprKind::Err(#120586) andTyKind::Err(#121109).r? @oli-obk