File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,12 @@ macro_rules! bitxor_impl {
315315
316316bitxor_impl ! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
317317
318- /// The left shift operator `<<`.
318+ /// The left shift operator `<<`. Note that because this trait is implemented
319+ /// for all integer types with multiple right-hand-side types, Rust's type
320+ /// checker has special handling for `_ << _`, setting the result type for
321+ /// integer operations to the type of the left-hand-side operand. This means
322+ /// that though `a << b` and `a.shl(b)` are one and the same from an evaluation
323+ /// standpoint, they are different when it comes to type inference.
319324///
320325/// # Examples
321326///
@@ -417,7 +422,12 @@ macro_rules! shl_impl_all {
417422
418423shl_impl_all ! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
419424
420- /// The right shift operator `>>`.
425+ /// The right shift operator `>>`. Note that because this trait is implemented
426+ /// for all integer types with multiple right-hand-side types, Rust's type
427+ /// checker has special handling for `_ >> _`, setting the result type for
428+ /// integer operations to the type of the left-hand-side operand. This means
429+ /// that though `a >> b` and `a.shr(b)` are one and the same from an evaluation
430+ /// standpoint, they are different when it comes to type inference.
421431///
422432/// # Examples
423433///
You can’t perform that action at this time.
0 commit comments