File tree 1 file changed +12
-2
lines changed
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 {
315
315
316
316
bitxor_impl ! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
317
317
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.
319
324
///
320
325
/// # Examples
321
326
///
@@ -417,7 +422,12 @@ macro_rules! shl_impl_all {
417
422
418
423
shl_impl_all ! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
419
424
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.
421
431
///
422
432
/// # Examples
423
433
///
You can’t perform that action at this time.
0 commit comments