Skip to content

Compiler warning for "condition is always true" #342

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

Closed
pcwalton opened this issue Apr 27, 2011 · 4 comments
Closed

Compiler warning for "condition is always true" #342

pcwalton opened this issue Apr 27, 2011 · 4 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@pcwalton
Copy link
Contributor

while (i >= 0u) cost a morning. We should add a warning for this.

@brson
Copy link
Contributor

brson commented Mar 5, 2012

We have some functions for evaluating const expressions, I believe in ast_util that could be used for this.

@catamorphism
Copy link
Contributor

Also see #1417

@veddan
Copy link
Contributor

veddan commented Oct 24, 2012

Some simple cases can be handled by #3833.

@graydon
Copy link
Contributor

graydon commented Nov 21, 2012

Type limits catches this case. If others show up we're not catching, we can look at them as they arise. Closing.

@graydon graydon closed this as completed Nov 21, 2012
oli-obk added a commit to oli-obk/rust that referenced this issue Sep 19, 2017
validation: check that int, float etc. are not undef
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add functions to get password/group file entry
workingjubilee pushed a commit to workingjubilee/rustc that referenced this issue May 10, 2023
Fix {to,from}_array UB when repr(simd) produces padding
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
carolynzech added a commit to carolynzech/rust that referenced this issue May 7, 2025
This is an automated PR to merge library subtree updates from 2025-04-23
(rust-lang/rust@6bc57c6) to 2025-04-24
(rust-lang/rust@df35ff6) (inclusive)
into main. `git merge` resulted in conflicts, which require manual
resolution. Files were commited with merge conflict markers. **Do not
remove or edit the following annotations:**
git-subtree-dir: library
git-subtree-split: 563e49d

---------

Signed-off-by: xizheyin <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Huang Qi <[email protected]>
Signed-off-by: Ayush Singh <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Co-authored-by: Matthias Krüger <[email protected]>
Co-authored-by: bors <[email protected]>
Co-authored-by: Mara Bos <[email protected]>
Co-authored-by: mejrs <[email protected]>
Co-authored-by: okaneco <[email protected]>
Co-authored-by: Jacob Pratt <[email protected]>
Co-authored-by: xizheyin <[email protected]>
Co-authored-by: Benoît du Garreau <[email protected]>
Co-authored-by: clubby789 <[email protected]>
Co-authored-by: Takayuki Maeda <[email protected]>
Co-authored-by: Daniel Bloom <[email protected]>
Co-authored-by: Trevor Gross <[email protected]>
Co-authored-by: Jake Wharton <[email protected]>
Co-authored-by: bjorn3 <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Co-authored-by: Guillaume Gomez <[email protected]>
Co-authored-by: Kornel <[email protected]>
Co-authored-by: Chris Denton <[email protected]>
Co-authored-by: Calder Coalson <[email protected]>
Co-authored-by: Stuart Cook <[email protected]>
Co-authored-by: Thalia Archibald <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Scott McMurray <[email protected]>
Co-authored-by: izarma <[email protected]>
Co-authored-by: Bennet Bleßmann <[email protected]>
Co-authored-by: Celina G. Val <[email protected]>
Co-authored-by: Jonathan Gruner <[email protected]>
Co-authored-by: Stan Manilov <[email protected]>
Co-authored-by: Gabriel Bjørnager Jensen <[email protected]>
Co-authored-by: lincot <[email protected]>
Co-authored-by: timesince <[email protected]>
Co-authored-by: Boxy <[email protected]>
Co-authored-by: oyvindln <[email protected]>
Co-authored-by: Berrysoft <[email protected]>
Co-authored-by: Alice Ryhl <[email protected]>
Co-authored-by: Folkert de Vries <[email protected]>
Co-authored-by: Bastian Kersting <[email protected]>
Co-authored-by: Petros Angelatos <[email protected]>
Co-authored-by: Jesus Checa Hidalgo <[email protected]>
Co-authored-by: Michael Howell <[email protected]>
Co-authored-by: Ricardo Fernández Serrata <[email protected]>
Co-authored-by: GenYuLi <[email protected]>
Co-authored-by: Chris Denton <[email protected]>
Co-authored-by: Amanieu d'Antras <[email protected]>
Co-authored-by: Sky <[email protected]>
Co-authored-by: Huang Qi <[email protected]>
Co-authored-by: Ayush Singh <[email protected]>
Co-authored-by: Jethro Beekman <[email protected]>
Co-authored-by: 0x79de <[email protected]>
Co-authored-by: binarycat <[email protected]>
Co-authored-by: Glyn Normington <[email protected]>
Co-authored-by: Tamir Duberstein <[email protected]>
Co-authored-by: Josh Triplett <[email protected]>
Co-authored-by: Bastian Kersting <[email protected]>
Co-authored-by: Lyndon Brown <[email protected]>
Co-authored-by: Kent Ross <[email protected]>
Co-authored-by: Noa <[email protected]>
Co-authored-by: Lieselotte <[email protected]>
Co-authored-by: Patrick Mooney <[email protected]>
Co-authored-by: Onè <[email protected]>
Co-authored-by: gitbot <git@bot>
Co-authored-by: Carolyn Zech <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants