-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
fn foo(n: usize) {
assert!(n <= u32::MAX as usize);
}
fn main() {}
Gives:
error[E0599]: no associated item named `MAX` found for type `u32` in the current scope
--> ...\test.rs:2:18
|
2 | assert!(n <= u32::MAX as usize);
| ^^^^^^^^ associated item not found in `u32`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
Perhaps here we want to give a hint where to find the u32::MAX?
euclio and estebank
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
estebank commentedon Oct 15, 2018
I'm convinced there's an open ticket for this, but I'm failing to find it. Closest I could find was #29841.
estebank commentedon Oct 15, 2018
This case in particular could be handled explicitly, I believe, as I don't think we have this problem in general in
std
, only for the numeric types. That being said, if someone has the time to build a generic solution, that'd be of course more useful than a targeted approach.estebank commentedon Oct 15, 2018
Found it! #26760
leonardo-m commentedon Oct 15, 2018
Close?