Skip to content

impl TryFrom<{integer}> for NonZero{integer} #68825

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
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make the tests compile
  • Loading branch information
jyn514 committed Feb 4, 2020
commit 673caa4be1def71108d95bad7609b5652d179b59
5 changes: 3 additions & 2 deletions src/test/ui/numeric/numeric-cast-3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::num::NonZeroUsize;
use std::convert::TryInto;

fn main() {
let a: usize = 1.try_into().unwrap();
#[should_panic] let b: usize = 0.try_into().unwrap();
let a: NonZeroUsize = 1_usize.try_into().unwrap();
let b: NonZeroUsize = 0_usize.try_into().unwrap();
}