Repository navigation
refactor: Stop remove_redundant_let_types from changing types - #2053
Open
thedataking wants to merge 1 commit into
Open
thedataking wants to merge 1 commit into
thedataking wants to merge 1 commit into
Conversation
thedataking
force-pushed
the
remove-redundant-let-types
branch
from
November 5, 2026 12:44
2e7c537 to
6c46d41
Compare
remove_redundant_let_typesremove_redundant_let_types from changing types
thedataking
marked this pull request as ready for review
November 5, 2026 12:44
thedataking
force-pushed
the
remove-redundant-let-types
branch
from
November 5, 2026 14:16
6c46d41 to
a3b6cff
Compare
thedataking
added a commit
to GaloisInc/Tractor-Crisp
that referenced
this pull request
Nov 5, 2026
`remove_redundant_let_types` compared the annotation with the initializer's inferred type, but that type already reflects the annotation, so `let x: u64 = 0;` became an `i32` and `let p: *mut Foo = &mut s;` became a reference. Only remove an annotation when the initializer determines its type without it and isn't coerced: suffixed literals, casts, literals of non-generic structs, unions and variants, calls to non-generic functions and methods, operators on such operands, tuples and arrays of them, field accesses and dereferences of them, and paths to constants, statics, parameters, and locals whose own types are fixed.
thedataking
force-pushed
the
remove-redundant-let-types
branch
from
November 5, 2026 17:09
a3b6cff to
622a90f
Compare
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.
remove_redundant_let_typesnow removes aletannotation only when the initializer determines the same type without it, so it no longer turnslet x: u64 = 0;into ani32orlet p: *mut Foo = &mut s;into a reference.Split out of #2038 (see this comment).