Skip to content

Commit eda9d21

Browse files
authoredJun 12, 2020
Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2 parents cb425c8 + fff822f commit eda9d21

File tree

101 files changed

+485
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+485
-518
lines changed
 

‎src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,7 @@ trait RcBoxPtr<T: ?Sized> {
20342034
// The reference count will never be zero when this is called;
20352035
// nevertheless, we insert an abort here to hint LLVM at
20362036
// an otherwise missed optimization.
2037-
if strong == 0 || strong == usize::max_value() {
2037+
if strong == 0 || strong == usize::MAX {
20382038
abort();
20392039
}
20402040
self.inner().strong.set(strong + 1);
@@ -2058,7 +2058,7 @@ trait RcBoxPtr<T: ?Sized> {
20582058
// The reference count will never be zero when this is called;
20592059
// nevertheless, we insert an abort here to hint LLVM at
20602060
// an otherwise missed optimization.
2061-
if weak == 0 || weak == usize::max_value() {
2061+
if weak == 0 || weak == usize::MAX {
20622062
abort();
20632063
}
20642064
self.inner().weak.set(weak + 1);

‎src/liballoc/rc/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,14 @@ fn test_from_vec() {
407407
fn test_downcast() {
408408
use std::any::Any;
409409

410-
let r1: Rc<dyn Any> = Rc::new(i32::max_value());
410+
let r1: Rc<dyn Any> = Rc::new(i32::MAX);
411411
let r2: Rc<dyn Any> = Rc::new("abc");
412412

413413
assert!(r1.clone().downcast::<u32>().is_err());
414414

415415
let r1i32 = r1.downcast::<i32>();
416416
assert!(r1i32.is_ok());
417-
assert_eq!(r1i32.unwrap(), Rc::new(i32::max_value()));
417+
assert_eq!(r1i32.unwrap(), Rc::new(i32::MAX));
418418

419419
assert!(r2.clone().downcast::<i32>().is_err());
420420

0 commit comments

Comments
 (0)