We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41ba864 commit 6169a1aCopy full SHA for 6169a1a
compiler/rustc_span/src/lib.rs
@@ -1860,22 +1860,22 @@ macro_rules! impl_pos {
1860
impl Pos for $ident {
1861
#[inline(always)]
1862
fn from_usize(n: usize) -> $ident {
1863
- $ident(n as $inner_ty)
+ $ident(<$inner_ty>::try_from(n).unwrap())
1864
}
1865
1866
1867
fn to_usize(&self) -> usize {
1868
- self.0 as usize
+ self.0.try_into().unwrap()
1869
1870
1871
1872
fn from_u32(n: u32) -> $ident {
1873
1874
1875
1876
1877
fn to_u32(&self) -> u32 {
1878
- self.0 as u32
1879
1880
1881
0 commit comments