-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
minimal example:
fn f(x: u64) -> u64 { x * 2 }
fn main() {
let g = f as i64;
println!("{}", g); // 94295280847184
}
Ordinarily rust is very strict about casts so I was surprised by this behavior when, because of a typo, I was trying to cast a fn
as an i64
. It compiled fine and resulted in garbage numbers that were difficult to track down. I assume this is a bug and not intended behavior.
First encountered the problem on nightly 1.27 2018-05-13 but it is also present in stable 1.26, per the playground example.
hanna-kruppescottmcm
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.