mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Reduce noise in error reporting
This commit is contained in:
parent
8a93972ba9
commit
b75a828e2b
@ -306,7 +306,7 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
|
||||
PathNotFound(ref path) =>
|
||||
write!(f, "Cannot find path {:?}", path),
|
||||
MachineError(ref inner) =>
|
||||
write!(f, "machine error: {}", inner),
|
||||
write!(f, "{}", inner),
|
||||
IncorrectAllocationInformation(size, size2, align, align2) =>
|
||||
write!(f, "incorrect alloc info: expected size {} and align {}, got size {} and align {}", size, align, size2, align2),
|
||||
_ => write!(f, "{}", self.description()),
|
||||
|
@ -76,7 +76,7 @@ impl<'tcx> Discr<'tcx> {
|
||||
let n = n as i128;
|
||||
let oflo = val > max - n;
|
||||
let val = if oflo {
|
||||
min + (n - (max - val))
|
||||
min + (n - (max - val) - 1)
|
||||
} else {
|
||||
val + n
|
||||
};
|
||||
@ -95,7 +95,7 @@ impl<'tcx> Discr<'tcx> {
|
||||
let val = self.val;
|
||||
let oflo = val > max - n;
|
||||
let val = if oflo {
|
||||
min + (n - (max - val))
|
||||
min + (n - (max - val) - 1)
|
||||
} else {
|
||||
val + n
|
||||
};
|
||||
|
@ -183,7 +183,7 @@ impl fmt::Display for ConstEvalError {
|
||||
msg
|
||||
)
|
||||
}
|
||||
NotConst(ref msg) => write!(f, "Cannot evaluate within constants: \"{}\"", msg),
|
||||
NotConst(ref msg) => write!(f, "{}", msg),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,5 +26,4 @@ fn main() {
|
||||
write(|| format_args!("{}", String::from("Hello world")));
|
||||
//~^ ERROR borrowed value does not live long enough
|
||||
//~| ERROR borrowed value does not live long enough
|
||||
//~| ERROR borrowed value does not live long enough
|
||||
}
|
||||
|
17
src/test/run-pass/ctfe/promotion.rs
Normal file
17
src/test/run-pass/ctfe/promotion.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(_: &'static [&'static str]) {}
|
||||
fn bar(_: &'static [&'static str; 3]) {}
|
||||
|
||||
fn main() {
|
||||
foo(&["a", "b", "c"]);
|
||||
bar(&["d", "e", "f"]);
|
||||
}
|
@ -56,7 +56,7 @@ fn f_u16() {
|
||||
Ok = u16::MAX - 1,
|
||||
Ok2,
|
||||
OhNo, //~ ERROR enum discriminant overflowed [E0370]
|
||||
//~| overflowed on value after 65535u16
|
||||
//~| overflowed on value after 65535
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -68,7 +68,7 @@ fn f_i32() {
|
||||
Ok = i32::MAX - 1,
|
||||
Ok2,
|
||||
OhNo, //~ ERROR enum discriminant overflowed [E0370]
|
||||
//~| overflowed on value after 2147483647i32
|
||||
//~| overflowed on value after 2147483647
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -80,7 +80,7 @@ fn f_u32() {
|
||||
Ok = u32::MAX - 1,
|
||||
Ok2,
|
||||
OhNo, //~ ERROR enum discriminant overflowed [E0370]
|
||||
//~| overflowed on value after 4294967295u32
|
||||
//~| overflowed on value after 4294967295
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -92,7 +92,7 @@ fn f_i64() {
|
||||
Ok = i64::MAX - 1,
|
||||
Ok2,
|
||||
OhNo, //~ ERROR enum discriminant overflowed [E0370]
|
||||
//~| overflowed on value after 9223372036854775807i64
|
||||
//~| overflowed on value after 9223372036854775807
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -104,7 +104,7 @@ fn f_u64() {
|
||||
Ok = u64::MAX - 1,
|
||||
Ok2,
|
||||
OhNo, //~ ERROR enum discriminant overflowed [E0370]
|
||||
//~| overflowed on value after 18446744073709551615u64
|
||||
//~| overflowed on value after 18446744073709551615
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
|
@ -11,7 +11,7 @@
|
||||
enum Enum {
|
||||
P = 3,
|
||||
X = 3,
|
||||
//~^ ERROR discriminant value `3isize` already exists
|
||||
//~^ ERROR discriminant value `3` already exists
|
||||
Y = 5
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user