Expand is_uninhabited for references
This commit is contained in:
parent
75140512eb
commit
f1bdd4fae2
@ -178,8 +178,9 @@ enum Void {}
|
|||||||
issue = "0")]
|
issue = "0")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct ArgumentV1<'a> {
|
pub struct ArgumentV1<'a> {
|
||||||
value: &'a Void,
|
_ph: PhantomData<&'a ()>,
|
||||||
formatter: fn(&Void, &mut Formatter) -> Result,
|
value: *const Void,
|
||||||
|
formatter: fn(*const Void, &mut Formatter) -> Result,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
|
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
|
||||||
@ -203,6 +204,7 @@ impl<'a> ArgumentV1<'a> {
|
|||||||
f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
|
f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
|
||||||
unsafe {
|
unsafe {
|
||||||
ArgumentV1 {
|
ArgumentV1 {
|
||||||
|
_ph: PhantomData,
|
||||||
formatter: mem::transmute(f),
|
formatter: mem::transmute(f),
|
||||||
value: mem::transmute(x)
|
value: mem::transmute(x)
|
||||||
}
|
}
|
||||||
@ -218,7 +220,7 @@ impl<'a> ArgumentV1<'a> {
|
|||||||
|
|
||||||
fn as_usize(&self) -> Option<usize> {
|
fn as_usize(&self) -> Option<usize> {
|
||||||
if self.formatter as usize == ArgumentV1::show_usize as usize {
|
if self.formatter as usize == ArgumentV1::show_usize as usize {
|
||||||
Some(unsafe { *(self.value as *const _ as *const usize) })
|
Some(unsafe { *(self.value as *const usize) })
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -946,11 +946,10 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||||||
},
|
},
|
||||||
|
|
||||||
TyNever => true,
|
TyNever => true,
|
||||||
TyTuple(ref tys) => tys.iter().any(|ty| ty.is_uninhabited(cx)),
|
TyTuple(ref tys) => tys.iter().any(|ty| ty.is_uninhabited_recurse(visited, cx)),
|
||||||
TyArray(ty, len) => len > 0 && ty.is_uninhabited(cx),
|
TyArray(ty, len) => len > 0 && ty.is_uninhabited_recurse(visited, cx),
|
||||||
|
TyRef(_, ref tm) => tm.ty.is_uninhabited_recurse(visited, cx),
|
||||||
|
|
||||||
// FIXME(canndrew): this line breaks core::fmt
|
|
||||||
//TyRef(_, ref tm) => tm.ty.is_uninhabited(cx),
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user