-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
replace convert::Infallible
with !
#49038
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
|
||
#![stable(feature = "rust1", since = "1.0.0")] | ||
|
||
use convert::{Infallible, TryFrom}; | ||
use convert::TryFrom; | ||
use fmt; | ||
use intrinsics; | ||
use ops; | ||
|
@@ -3595,20 +3595,12 @@ impl fmt::Display for TryFromIntError { | |
} | ||
} | ||
|
||
#[unstable(feature = "try_from", issue = "33417")] | ||
impl From<Infallible> for TryFromIntError { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe leave this as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed it thinking that we'd have |
||
fn from(infallible: Infallible) -> TryFromIntError { | ||
match infallible { | ||
} | ||
} | ||
} | ||
|
||
// no possible bounds violation | ||
macro_rules! try_from_unbounded { | ||
($source:ty, $($target:ty),*) => {$( | ||
#[unstable(feature = "try_from", issue = "33417")] | ||
impl TryFrom<$source> for $target { | ||
type Error = Infallible; | ||
type Error = !; | ||
|
||
#[inline] | ||
fn try_from(value: $source) -> Result<Self, Self::Error> { | ||
|
@@ -3719,7 +3711,7 @@ try_from_lower_bounded!(isize, usize); | |
#[cfg(target_pointer_width = "16")] | ||
mod ptr_try_from_impls { | ||
use super::TryFromIntError; | ||
use convert::{Infallible, TryFrom}; | ||
use convert::TryFrom; | ||
|
||
try_from_upper_bounded!(usize, u8); | ||
try_from_unbounded!(usize, u16, u32, u64, u128); | ||
|
@@ -3745,7 +3737,7 @@ mod ptr_try_from_impls { | |
#[cfg(target_pointer_width = "32")] | ||
mod ptr_try_from_impls { | ||
use super::TryFromIntError; | ||
use convert::{Infallible, TryFrom}; | ||
use convert::TryFrom; | ||
|
||
try_from_upper_bounded!(usize, u8, u16); | ||
try_from_unbounded!(usize, u32, u64, u128); | ||
|
@@ -3771,7 +3763,7 @@ mod ptr_try_from_impls { | |
#[cfg(target_pointer_width = "64")] | ||
mod ptr_try_from_impls { | ||
use super::TryFromIntError; | ||
use convert::{Infallible, TryFrom}; | ||
use convert::TryFrom; | ||
|
||
try_from_upper_bounded!(usize, u8, u16, u32); | ||
try_from_unbounded!(usize, u64, u128); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through that list of derives, are we missing
Copy
andClone
for!
? They're not in the rustdoc, at least: https://doc.rust-lang.org/nightly/std/primitive.never.html#implementations(Not a blocker for this PR, of course.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're implemented. No idea why they're not showing up in rustdoc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, looks like this is a nearing-three-year-old bug with primitives: #25893