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 <xizheyin@smail.nju.edu.cn>
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Co-authored-by: Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
Co-authored-by: okaneco <47607823+okaneco@users.noreply.github.com>
Co-authored-by: Jacob Pratt <jacob@jhpratt.dev>
Co-authored-by: xizheyin <xizheyin@smail.nju.edu.cn>
Co-authored-by: Benoît du Garreau <benoit@dugarreau.fr>
Co-authored-by: clubby789 <jamie@hill-daniel.co.uk>
Co-authored-by: Takayuki Maeda <takoyaki0316@gmail.com>
Co-authored-by: Daniel Bloom <daniel@wormholelabs.xyz>
Co-authored-by: Trevor Gross <tmgross@umich.edu>
Co-authored-by: Jake Wharton <jw@squareup.com>
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Co-authored-by: Kornel <kornel@geekhood.net>
Co-authored-by: Chris Denton <chris@chrisdenton.dev>
Co-authored-by: Calder Coalson <caldercoalson@gmail.com>
Co-authored-by: Stuart Cook <Zalathar@users.noreply.github.com>
Co-authored-by: Thalia Archibald <thalia@archibald.dev>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Scott McMurray <scottmcm@users.noreply.github.com>
Co-authored-by: izarma <phuckuhh@gmail.com>
Co-authored-by: Bennet Bleßmann <bb-github@t-online.de>
Co-authored-by: Celina G. Val <celinval@amazon.com>
Co-authored-by: Jonathan Gruner <jogru0@gmail.com>
Co-authored-by: Stan Manilov <stanislav.manilov@gmail.com>
Co-authored-by: Gabriel Bjørnager Jensen <gabriel@achernar.io>
Co-authored-by: lincot <lincot@disroot.org>
Co-authored-by: timesince <seekseat@icloud.com>
Co-authored-by: Boxy <rust@boxyuwu.dev>
Co-authored-by: oyvindln <oyvindln@users.noreply.github.com>
Co-authored-by: Berrysoft <Strawberry_Str@hotmail.com>
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
Co-authored-by: Bastian Kersting <bkersting@google.com>
Co-authored-by: Petros Angelatos <petrosagg@gmail.com>
Co-authored-by: Jesus Checa Hidalgo <jchecahi@redhat.com>
Co-authored-by: Michael Howell <michael@notriddle.com>
Co-authored-by: Ricardo Fernández Serrata <76864299+Rudxain@users.noreply.github.com>
Co-authored-by: GenYuLi <witherslin@synology.com>
Co-authored-by: Chris Denton <christophersdenton@gmail.com>
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Co-authored-by: Sky <sky@sky9.dev>
Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
Co-authored-by: Ayush Singh <ayush@beagleboard.org>
Co-authored-by: Jethro Beekman <jethro@fortanix.com>
Co-authored-by: 0x79de <0x79de@gmail.com>
Co-authored-by: binarycat <binarycat@envs.net>
Co-authored-by: Glyn Normington <glyn.normington@gmail.com>
Co-authored-by: Tamir Duberstein <tamird@gmail.com>
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
Co-authored-by: Bastian Kersting <bastian@cmbt.de>
Co-authored-by: Lyndon Brown <jnqnfe@gmail.com>
Co-authored-by: Kent Ross <k@mad.cash>
Co-authored-by: Noa <coolreader18@gmail.com>
Co-authored-by: Lieselotte <52315535+she3py@users.noreply.github.com>
Co-authored-by: Patrick Mooney <pmooney@pfmooney.com>
Co-authored-by: Onè <43485962+c-git@users.noreply.github.com>
Co-authored-by: gitbot <git@bot>
Co-authored-by: Carolyn Zech <cmzech@amazon.com>
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