Auto merge of #3711 - rust-lang:rustup, r=oli-obk

Rustup

fixes #3709

I'm currently in the process of making rustc's deprecation lint emit the `AtomicFoo::new(0)` suggestion
This commit is contained in:
bors 2019-01-28 11:37:45 +00:00
commit 4a2116b305
8 changed files with 48 additions and 171 deletions

View file

@ -10,6 +10,7 @@ use rustc::{bug, span_bug};
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use std::cmp::Ordering::{self, Equal}; use std::cmp::Ordering::{self, Equal};
use std::cmp::PartialOrd; use std::cmp::PartialOrd;
use std::convert::TryFrom;
use std::convert::TryInto; use std::convert::TryInto;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use syntax::ast::{FloatTy, LitKind}; use syntax::ast::{FloatTy, LitKind};
@ -441,12 +442,12 @@ pub fn miri_to_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result: &ty::Const<'
// FIXME: implement other conversion // FIXME: implement other conversion
_ => None, _ => None,
}, },
ConstValue::ScalarPair(Scalar::Ptr(ptr), Scalar::Bits { bits: n, .. }) => match result.ty.sty { ConstValue::Slice(Scalar::Ptr(ptr), n) => match result.ty.sty {
ty::Ref(_, tam, _) => match tam.sty { ty::Ref(_, tam, _) => match tam.sty {
ty::Str => { ty::Str => {
let alloc = tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id); let alloc = tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id);
let offset = ptr.offset.bytes().try_into().expect("too-large pointer offset"); let offset = ptr.offset.bytes().try_into().expect("too-large pointer offset");
let n = n as usize; let n = usize::try_from(n).unwrap();
String::from_utf8(alloc.bytes[offset..(offset + n)].to_owned()) String::from_utf8(alloc.bytes[offset..(offset + n)].to_owned())
.ok() .ok()
.map(Constant::Str) .map(Constant::Str)

View file

@ -69,21 +69,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ReplaceConsts {
const REPLACEMENTS: &[(&[&str], &str)] = &[ const REPLACEMENTS: &[(&[&str], &str)] = &[
// Once // Once
(&["core", "sync", "ONCE_INIT"], "Once::new()"), (&["core", "sync", "ONCE_INIT"], "Once::new()"),
// Atomic
(
&["core", "sync", "atomic", "ATOMIC_BOOL_INIT"],
"AtomicBool::new(false)",
),
(&["core", "sync", "atomic", "ATOMIC_ISIZE_INIT"], "AtomicIsize::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_I8_INIT"], "AtomicI8::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_I16_INIT"], "AtomicI16::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_I32_INIT"], "AtomicI32::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_I64_INIT"], "AtomicI64::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_USIZE_INIT"], "AtomicUsize::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_U8_INIT"], "AtomicU8::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_U16_INIT"], "AtomicU16::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_U32_INIT"], "AtomicU32::new(0)"),
(&["core", "sync", "atomic", "ATOMIC_U64_INIT"], "AtomicU64::new(0)"),
// Min // Min
(&["core", "isize", "MIN"], "isize::min_value()"), (&["core", "isize", "MIN"], "isize::min_value()"),
(&["core", "i8", "MIN"], "i8::min_value()"), (&["core", "i8", "MIN"], "i8::min_value()"),

View file

@ -38,10 +38,10 @@ pub const INDEX: [&str; 3] = ["core", "ops", "Index"];
pub const INDEX_MUT: [&str; 3] = ["core", "ops", "IndexMut"]; pub const INDEX_MUT: [&str; 3] = ["core", "ops", "IndexMut"];
pub const INIT: [&str; 4] = ["core", "intrinsics", "", "init"]; pub const INIT: [&str; 4] = ["core", "intrinsics", "", "init"];
pub const INTO: [&str; 3] = ["core", "convert", "Into"]; pub const INTO: [&str; 3] = ["core", "convert", "Into"];
pub const INTO_ITERATOR: [&str; 4] = ["core", "iter", "traits", "IntoIterator"]; pub const INTO_ITERATOR: [&str; 5] = ["core", "iter", "traits", "collect", "IntoIterator"];
pub const IO_READ: [&str; 3] = ["std", "io", "Read"]; pub const IO_READ: [&str; 3] = ["std", "io", "Read"];
pub const IO_WRITE: [&str; 3] = ["std", "io", "Write"]; pub const IO_WRITE: [&str; 3] = ["std", "io", "Write"];
pub const ITERATOR: [&str; 4] = ["core", "iter", "iterator", "Iterator"]; pub const ITERATOR: [&str; 5] = ["core", "iter", "traits", "iterator", "Iterator"];
pub const LATE_CONTEXT: [&str; 4] = ["rustc", "lint", "context", "LateContext"]; pub const LATE_CONTEXT: [&str; 4] = ["rustc", "lint", "context", "LateContext"];
pub const LINKED_LIST: [&str; 4] = ["alloc", "collections", "linked_list", "LinkedList"]; pub const LINKED_LIST: [&str; 4] = ["alloc", "collections", "linked_list", "LinkedList"];
pub const LINT: [&str; 3] = ["rustc", "lint", "Lint"]; pub const LINT: [&str; 3] = ["rustc", "lint", "Lint"];

View file

@ -4,7 +4,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::Cell; use std::cell::Cell;
use std::fmt::Display; use std::fmt::Display;
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Once; use std::sync::Once;
const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
@ -95,9 +95,6 @@ fn main() {
ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability
assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability
let _once = ONCE_INIT; let _once = ONCE_INIT;
let _once_ref = &ONCE_INIT; //~ ERROR interior mutability let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability

View file

@ -144,23 +144,7 @@ LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutabi
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:98:5 --> $DIR/non_copy_const.rs:99:22
|
LL | ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:99:16
|
LL | assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability
| ^^^^^^^^^^^^^^^^^
|
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:102:22
| |
LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^ | ^^^^^^^^^
@ -168,7 +152,7 @@ LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:103:25 --> $DIR/non_copy_const.rs:100:25
| |
LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^ | ^^^^^^^^^
@ -176,7 +160,7 @@ LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:104:27 --> $DIR/non_copy_const.rs:101:27
| |
LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^ | ^^^^^^^^^
@ -184,7 +168,7 @@ LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:105:26 --> $DIR/non_copy_const.rs:102:26
| |
LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^ | ^^^^^^^^^
@ -192,7 +176,7 @@ LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:116:14 --> $DIR/non_copy_const.rs:113:14
| |
LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -200,7 +184,7 @@ LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:117:14 --> $DIR/non_copy_const.rs:114:14
| |
LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -208,7 +192,7 @@ LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:118:19 --> $DIR/non_copy_const.rs:115:19
| |
LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -216,7 +200,7 @@ LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:119:14 --> $DIR/non_copy_const.rs:116:14
| |
LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -224,7 +208,7 @@ LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:120:13 --> $DIR/non_copy_const.rs:117:13
| |
LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -232,7 +216,7 @@ LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mu
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:126:13 --> $DIR/non_copy_const.rs:123:13
| |
LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -240,7 +224,7 @@ LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:131:5 --> $DIR/non_copy_const.rs:128:5
| |
LL | CELL.set(2); //~ ERROR interior mutability LL | CELL.set(2); //~ ERROR interior mutability
| ^^^^ | ^^^^
@ -248,7 +232,7 @@ LL | CELL.set(2); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:132:16 --> $DIR/non_copy_const.rs:129:16
| |
LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
| ^^^^ | ^^^^
@ -256,7 +240,7 @@ LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:145:5 --> $DIR/non_copy_const.rs:142:5
| |
LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -264,12 +248,12 @@ LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:146:16 --> $DIR/non_copy_const.rs:143:16
| |
LL | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability LL | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: aborting due to 31 previous errors error: aborting due to 29 previous errors

View file

@ -10,18 +10,6 @@ use std::sync::{Once, ONCE_INIT};
fn bad() { fn bad() {
// Once // Once
{ let foo = ONCE_INIT; }; { let foo = ONCE_INIT; };
// Atomic
{ let foo = AtomicBool::new(false); };
{ let foo = AtomicIsize::new(0); };
{ let foo = AtomicI8::new(0); };
{ let foo = AtomicI16::new(0); };
{ let foo = AtomicI32::new(0); };
{ let foo = AtomicI64::new(0); };
{ let foo = AtomicUsize::new(0); };
{ let foo = AtomicU8::new(0); };
{ let foo = AtomicU16::new(0); };
{ let foo = AtomicU32::new(0); };
{ let foo = AtomicU64::new(0); };
// Min // Min
{ let foo = isize::min_value(); }; { let foo = isize::min_value(); };
{ let foo = i8::min_value(); }; { let foo = i8::min_value(); };

View file

@ -10,18 +10,6 @@ use std::sync::{Once, ONCE_INIT};
fn bad() { fn bad() {
// Once // Once
{ let foo = ONCE_INIT; }; { let foo = ONCE_INIT; };
// Atomic
{ let foo = ATOMIC_BOOL_INIT; };
{ let foo = ATOMIC_ISIZE_INIT; };
{ let foo = ATOMIC_I8_INIT; };
{ let foo = ATOMIC_I16_INIT; };
{ let foo = ATOMIC_I32_INIT; };
{ let foo = ATOMIC_I64_INIT; };
{ let foo = ATOMIC_USIZE_INIT; };
{ let foo = ATOMIC_U8_INIT; };
{ let foo = ATOMIC_U16_INIT; };
{ let foo = ATOMIC_U32_INIT; };
{ let foo = ATOMIC_U64_INIT; };
// Min // Min
{ let foo = std::isize::MIN; }; { let foo = std::isize::MIN; };
{ let foo = std::i8::MIN; }; { let foo = std::i8::MIN; };

View file

@ -1,8 +1,8 @@
error: using `ATOMIC_BOOL_INIT` error: using `MIN`
--> $DIR/replace_consts.rs:14:17 --> $DIR/replace_consts.rs:14:17
| |
LL | { let foo = ATOMIC_BOOL_INIT; }; LL | { let foo = std::isize::MIN; };
| ^^^^^^^^^^^^^^^^ help: try this: `AtomicBool::new(false)` | ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()`
| |
note: lint level defined here note: lint level defined here
--> $DIR/replace_consts.rs:4:9 --> $DIR/replace_consts.rs:4:9
@ -10,209 +10,143 @@ note: lint level defined here
LL | #![deny(clippy::replace_consts)] LL | #![deny(clippy::replace_consts)]
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
error: using `ATOMIC_ISIZE_INIT` error: using `MIN`
--> $DIR/replace_consts.rs:15:17 --> $DIR/replace_consts.rs:15:17
| |
LL | { let foo = ATOMIC_ISIZE_INIT; };
| ^^^^^^^^^^^^^^^^^ help: try this: `AtomicIsize::new(0)`
error: using `ATOMIC_I8_INIT`
--> $DIR/replace_consts.rs:16:17
|
LL | { let foo = ATOMIC_I8_INIT; };
| ^^^^^^^^^^^^^^ help: try this: `AtomicI8::new(0)`
error: using `ATOMIC_I16_INIT`
--> $DIR/replace_consts.rs:17:17
|
LL | { let foo = ATOMIC_I16_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicI16::new(0)`
error: using `ATOMIC_I32_INIT`
--> $DIR/replace_consts.rs:18:17
|
LL | { let foo = ATOMIC_I32_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicI32::new(0)`
error: using `ATOMIC_I64_INIT`
--> $DIR/replace_consts.rs:19:17
|
LL | { let foo = ATOMIC_I64_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicI64::new(0)`
error: using `ATOMIC_USIZE_INIT`
--> $DIR/replace_consts.rs:20:17
|
LL | { let foo = ATOMIC_USIZE_INIT; };
| ^^^^^^^^^^^^^^^^^ help: try this: `AtomicUsize::new(0)`
error: using `ATOMIC_U8_INIT`
--> $DIR/replace_consts.rs:21:17
|
LL | { let foo = ATOMIC_U8_INIT; };
| ^^^^^^^^^^^^^^ help: try this: `AtomicU8::new(0)`
error: using `ATOMIC_U16_INIT`
--> $DIR/replace_consts.rs:22:17
|
LL | { let foo = ATOMIC_U16_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicU16::new(0)`
error: using `ATOMIC_U32_INIT`
--> $DIR/replace_consts.rs:23:17
|
LL | { let foo = ATOMIC_U32_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicU32::new(0)`
error: using `ATOMIC_U64_INIT`
--> $DIR/replace_consts.rs:24:17
|
LL | { let foo = ATOMIC_U64_INIT; };
| ^^^^^^^^^^^^^^^ help: try this: `AtomicU64::new(0)`
error: using `MIN`
--> $DIR/replace_consts.rs:26:17
|
LL | { let foo = std::isize::MIN; };
| ^^^^^^^^^^^^^^^ help: try this: `isize::min_value()`
error: using `MIN`
--> $DIR/replace_consts.rs:27:17
|
LL | { let foo = std::i8::MIN; }; LL | { let foo = std::i8::MIN; };
| ^^^^^^^^^^^^ help: try this: `i8::min_value()` | ^^^^^^^^^^^^ help: try this: `i8::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:28:17 --> $DIR/replace_consts.rs:16:17
| |
LL | { let foo = std::i16::MIN; }; LL | { let foo = std::i16::MIN; };
| ^^^^^^^^^^^^^ help: try this: `i16::min_value()` | ^^^^^^^^^^^^^ help: try this: `i16::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:29:17 --> $DIR/replace_consts.rs:17:17
| |
LL | { let foo = std::i32::MIN; }; LL | { let foo = std::i32::MIN; };
| ^^^^^^^^^^^^^ help: try this: `i32::min_value()` | ^^^^^^^^^^^^^ help: try this: `i32::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:30:17 --> $DIR/replace_consts.rs:18:17
| |
LL | { let foo = std::i64::MIN; }; LL | { let foo = std::i64::MIN; };
| ^^^^^^^^^^^^^ help: try this: `i64::min_value()` | ^^^^^^^^^^^^^ help: try this: `i64::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:31:17 --> $DIR/replace_consts.rs:19:17
| |
LL | { let foo = std::i128::MIN; }; LL | { let foo = std::i128::MIN; };
| ^^^^^^^^^^^^^^ help: try this: `i128::min_value()` | ^^^^^^^^^^^^^^ help: try this: `i128::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:32:17 --> $DIR/replace_consts.rs:20:17
| |
LL | { let foo = std::usize::MIN; }; LL | { let foo = std::usize::MIN; };
| ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()` | ^^^^^^^^^^^^^^^ help: try this: `usize::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:33:17 --> $DIR/replace_consts.rs:21:17
| |
LL | { let foo = std::u8::MIN; }; LL | { let foo = std::u8::MIN; };
| ^^^^^^^^^^^^ help: try this: `u8::min_value()` | ^^^^^^^^^^^^ help: try this: `u8::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:34:17 --> $DIR/replace_consts.rs:22:17
| |
LL | { let foo = std::u16::MIN; }; LL | { let foo = std::u16::MIN; };
| ^^^^^^^^^^^^^ help: try this: `u16::min_value()` | ^^^^^^^^^^^^^ help: try this: `u16::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:35:17 --> $DIR/replace_consts.rs:23:17
| |
LL | { let foo = std::u32::MIN; }; LL | { let foo = std::u32::MIN; };
| ^^^^^^^^^^^^^ help: try this: `u32::min_value()` | ^^^^^^^^^^^^^ help: try this: `u32::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:36:17 --> $DIR/replace_consts.rs:24:17
| |
LL | { let foo = std::u64::MIN; }; LL | { let foo = std::u64::MIN; };
| ^^^^^^^^^^^^^ help: try this: `u64::min_value()` | ^^^^^^^^^^^^^ help: try this: `u64::min_value()`
error: using `MIN` error: using `MIN`
--> $DIR/replace_consts.rs:37:17 --> $DIR/replace_consts.rs:25:17
| |
LL | { let foo = std::u128::MIN; }; LL | { let foo = std::u128::MIN; };
| ^^^^^^^^^^^^^^ help: try this: `u128::min_value()` | ^^^^^^^^^^^^^^ help: try this: `u128::min_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:39:17 --> $DIR/replace_consts.rs:27:17
| |
LL | { let foo = std::isize::MAX; }; LL | { let foo = std::isize::MAX; };
| ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()` | ^^^^^^^^^^^^^^^ help: try this: `isize::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:40:17 --> $DIR/replace_consts.rs:28:17
| |
LL | { let foo = std::i8::MAX; }; LL | { let foo = std::i8::MAX; };
| ^^^^^^^^^^^^ help: try this: `i8::max_value()` | ^^^^^^^^^^^^ help: try this: `i8::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:41:17 --> $DIR/replace_consts.rs:29:17
| |
LL | { let foo = std::i16::MAX; }; LL | { let foo = std::i16::MAX; };
| ^^^^^^^^^^^^^ help: try this: `i16::max_value()` | ^^^^^^^^^^^^^ help: try this: `i16::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:42:17 --> $DIR/replace_consts.rs:30:17
| |
LL | { let foo = std::i32::MAX; }; LL | { let foo = std::i32::MAX; };
| ^^^^^^^^^^^^^ help: try this: `i32::max_value()` | ^^^^^^^^^^^^^ help: try this: `i32::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:43:17 --> $DIR/replace_consts.rs:31:17
| |
LL | { let foo = std::i64::MAX; }; LL | { let foo = std::i64::MAX; };
| ^^^^^^^^^^^^^ help: try this: `i64::max_value()` | ^^^^^^^^^^^^^ help: try this: `i64::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:44:17 --> $DIR/replace_consts.rs:32:17
| |
LL | { let foo = std::i128::MAX; }; LL | { let foo = std::i128::MAX; };
| ^^^^^^^^^^^^^^ help: try this: `i128::max_value()` | ^^^^^^^^^^^^^^ help: try this: `i128::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:45:17 --> $DIR/replace_consts.rs:33:17
| |
LL | { let foo = std::usize::MAX; }; LL | { let foo = std::usize::MAX; };
| ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()` | ^^^^^^^^^^^^^^^ help: try this: `usize::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:46:17 --> $DIR/replace_consts.rs:34:17
| |
LL | { let foo = std::u8::MAX; }; LL | { let foo = std::u8::MAX; };
| ^^^^^^^^^^^^ help: try this: `u8::max_value()` | ^^^^^^^^^^^^ help: try this: `u8::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:47:17 --> $DIR/replace_consts.rs:35:17
| |
LL | { let foo = std::u16::MAX; }; LL | { let foo = std::u16::MAX; };
| ^^^^^^^^^^^^^ help: try this: `u16::max_value()` | ^^^^^^^^^^^^^ help: try this: `u16::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:48:17 --> $DIR/replace_consts.rs:36:17
| |
LL | { let foo = std::u32::MAX; }; LL | { let foo = std::u32::MAX; };
| ^^^^^^^^^^^^^ help: try this: `u32::max_value()` | ^^^^^^^^^^^^^ help: try this: `u32::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:49:17 --> $DIR/replace_consts.rs:37:17
| |
LL | { let foo = std::u64::MAX; }; LL | { let foo = std::u64::MAX; };
| ^^^^^^^^^^^^^ help: try this: `u64::max_value()` | ^^^^^^^^^^^^^ help: try this: `u64::max_value()`
error: using `MAX` error: using `MAX`
--> $DIR/replace_consts.rs:50:17 --> $DIR/replace_consts.rs:38:17
| |
LL | { let foo = std::u128::MAX; }; LL | { let foo = std::u128::MAX; };
| ^^^^^^^^^^^^^^ help: try this: `u128::max_value()` | ^^^^^^^^^^^^^^ help: try this: `u128::max_value()`
error: aborting due to 35 previous errors error: aborting due to 24 previous errors