Skip to content

Commit

Permalink
Fixed grammar/style in error messages and reblessed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Regueiro committed Sep 6, 2019
1 parent 6187684 commit 022d9c8
Show file tree
Hide file tree
Showing 125 changed files with 381 additions and 380 deletions.
12 changes: 6 additions & 6 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
match self {
PointerOutOfBounds { ptr, msg, allocation_size } => {
write!(f, "{} failed: pointer must be in-bounds at offset {}, \
but is outside bounds of allocation {} which has size {}",
but is outside bounds of allocation {} which has size {}",
msg, ptr.offset.bytes(), ptr.alloc_id, allocation_size.bytes())
},
ValidationFailure(ref err) => {
write!(f, "type validation failed: {}", err)
}
NoMirFor(ref func) => write!(f, "no mir for `{}`", func),
NoMirFor(ref func) => write!(f, "no MIR for `{}`", func),
FunctionAbiMismatch(caller_abi, callee_abi) =>
write!(f, "tried to call a function with ABI {:?} using caller ABI {:?}",
callee_abi, caller_abi),
Expand All @@ -451,9 +451,9 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
FunctionArgCountMismatch =>
write!(f, "tried to call a function with incorrect number of arguments"),
ReallocatedWrongMemoryKind(ref old, ref new) =>
write!(f, "tried to reallocate memory from {} to {}", old, new),
write!(f, "tried to reallocate memory from `{}` to `{}`", old, new),
DeallocatedWrongMemoryKind(ref old, ref new) =>
write!(f, "tried to deallocate {} memory but gave {} as the kind", old, new),
write!(f, "tried to deallocate `{}` memory but gave `{}` as the kind", old, new),
InvalidChar(c) =>
write!(f, "tried to interpret an invalid 32-bit value as a char: {}", c),
AlignmentCheckFailed { required, has } =>
Expand All @@ -462,7 +462,7 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
TypeNotPrimitive(ty) =>
write!(f, "expected primitive type, got {}", ty),
PathNotFound(ref path) =>
write!(f, "Cannot find path {:?}", path),
write!(f, "cannot find path {:?}", path),
IncorrectAllocationInformation(size, size2, align, align2) =>
write!(f, "incorrect alloc info: expected size {} and align {}, \
got size {} and align {}",
Expand Down Expand Up @@ -525,7 +525,7 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
InvalidBoolOp(_) =>
write!(f, "invalid boolean operation"),
UnterminatedCString(_) =>
write!(f, "attempted to get length of a null terminated string, but no null \
write!(f, "attempted to get length of a null-terminated string, but no null \
found before end of allocation"),
ReadUndefBytes(_) =>
write!(f, "attempted to read undefined bytes"),
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ pub fn parse_error_format(
Some(arg) => early_error(
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color)),
&format!(
"argument for --error-format must be `human`, `json` or \
"argument for `--error-format` must be `human`, `json` or \
`short` (instead was `{}`)",
arg
),
Expand Down Expand Up @@ -2037,7 +2037,7 @@ pub fn build_session_options_and_crate_config(
early_error(
ErrorOutputType::default(),
&format!(
"argument for --edition must be one of: \
"argument for `--edition` must be one of: \
{}. (instead was `{}`)",
EDITION_NAME_LIST,
arg
Expand All @@ -2051,7 +2051,7 @@ pub fn build_session_options_and_crate_config(
early_error(
ErrorOutputType::default(),
&format!(
"Edition {} is unstable and only \
"edition {} is unstable and only \
available for nightly builds of rustc.",
edition,
)
Expand All @@ -2075,14 +2075,14 @@ pub fn build_session_options_and_crate_config(
if let ErrorOutputType::Json { pretty: true, json_rendered } = error_format {
early_error(
ErrorOutputType::Json { pretty: false, json_rendered },
"--error-format=pretty-json is unstable",
"`--error-format=pretty-json` is unstable",
);
}
if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet(_)) =
error_format {
early_error(
ErrorOutputType::Json { pretty: false, json_rendered },
"--error-format=human-annotate-rs is unstable",
"`--error-format=human-annotate-rs` is unstable",
);
}
}
Expand Down Expand Up @@ -2132,8 +2132,8 @@ pub fn build_session_options_and_crate_config(
early_warn(
error_format,
&format!(
"--emit={} with -o incompatible with \
-C codegen-units=N for N > 1",
"`--emit={}` with `-o` incompatible with \
`-C codegen-units=N` for N > 1",
ot
),
);
Expand All @@ -2153,21 +2153,21 @@ pub fn build_session_options_and_crate_config(
if debugging_opts.threads == Some(0) {
early_error(
error_format,
"Value for threads must be a positive nonzero integer",
"value for threads must be a positive non-zero integer",
);
}

if debugging_opts.threads.unwrap_or(1) > 1 && debugging_opts.fuel.is_some() {
early_error(
error_format,
"Optimization fuel is incompatible with multiple threads",
"optimization fuel is incompatible with multiple threads",
);
}

if codegen_units == Some(0) {
early_error(
error_format,
"Value for codegen units must be a positive nonzero integer",
"value for codegen units must be a positive non-zero integer",
);
}

Expand Down
7 changes: 4 additions & 3 deletions src/librustc/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl<'tcx> TyCtxt<'tcx> {
match self.layout_of(param_env.and(ty)) {
Ok(layout) => &layout.abi,
Err(err) => bug!(
"Error: {}\n while computing layout for type {:?}", err, ty
"error: {}\n while computing layout for type {:?}", err, ty
)
}
};
Expand All @@ -384,7 +384,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.sess.delay_span_bug(
self.def_span(method.def_id),
&format!(
"Receiver when Self = () should have a Scalar ABI, found {:?}",
"receiver when `Self = ()` should have a Scalar ABI; found {:?}",
abi
),
);
Expand All @@ -406,7 +406,8 @@ impl<'tcx> TyCtxt<'tcx> {
self.sess.delay_span_bug(
self.def_span(method.def_id),
&format!(
"Receiver when Self = {} should have a ScalarPair ABI, found {:?}",
"receiver when `Self = {}` should have a ScalarPair ABI; \
found {:?}",
trait_object_ty, abi
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
&self.describe_place_with_options(moved_place, IncludingDowncast(true))
.unwrap_or_else(|| "_".to_owned()),
);
err.span_label(span, format!("use of possibly uninitialized {}", item_msg));
err.span_label(span, format!("use of possibly-uninitialized {}", item_msg));

use_spans.var_span_label(
&mut err,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ pub fn error_to_const_error<'mir, 'tcx>(

pub fn note_on_undefined_behavior_error() -> &'static str {
"The rules on what exactly is undefined behavior aren't clear, \
so this check might be overzealous. Please open an issue on the rust compiler \
repository if you believe it should not be considered undefined behavior"
so this check might be overzealous. Please open an issue on the rustc \
repository if you believe it should not be considered undefined behavior."
}

fn validate_and_turn_into_const<'tcx>(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ It is not allowed to use or capture an uninitialized variable. For example:
```compile_fail,E0381
fn main() {
let x: i32;
let y = x; // error, use of possibly uninitialized variable
let y = x; // error, use of possibly-uninitialized variable
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/util/borrowck_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
self,
span,
E0381,
"{} of possibly uninitialized variable: `{}`",
"{} of possibly-uninitialized variable: `{}`",
verb,
desc,
)
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl<'a> Parser<'a> {
}
if self.is_do_catch_block() {
let mut db = self.fatal("found removed `do catch` syntax");
db.help("Following RFC #2388, the new non-placeholder syntax is `try`");
db.help("following RFC #2388, the new non-placeholder syntax is `try`");
return Err(db);
}
if self.is_try_block() {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl<'a> Parser<'a> {
self.diagnostic().struct_span_warn(self.token.span, {
&format!("expected `;`, found {}", self.this_token_descr())
}).note({
"This was erroneously allowed and will become a hard error in a future release"
"this was erroneously allowed and will become a hard error in a future release"
}).emit();
}
}
2 changes: 1 addition & 1 deletion src/test/ui/asm/asm-out-read-uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn main() {
let x: isize;
unsafe {
asm!("mov $1, $0" : "=r"(x) : "r"(x));
//~^ ERROR use of possibly uninitialized variable: `x`
//~^ ERROR use of possibly-uninitialized variable: `x`
}
foo(x);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/asm/asm-out-read-uninit.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0381]: use of possibly uninitialized variable: `x`
error[E0381]: use of possibly-uninitialized variable: `x`
--> $DIR/asm-out-read-uninit.rs:22:43
|
LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
| ^ use of possibly uninitialized `x`
| ^ use of possibly-uninitialized `x`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async fn no_non_guaranteed_initialization(x: usize) -> usize {
y = echo(10).await;
}
y
//~^ use of possibly uninitialized variable: `y`
//~^ use of possibly-uninitialized variable: `y`
}

async fn echo(x: usize) -> usize { x + 1 }
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0381]: use of possibly uninitialized variable: `y`
error[E0381]: use of possibly-uninitialized variable: `y`
--> $DIR/no-non-guaranteed-initialization.rs:10:5
|
LL | y
| ^ use of possibly uninitialized `y`
| ^ use of possibly-uninitialized `y`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn noop() {}
async fn test_tuple() {
let mut t: (i32, i32);
t.0 = 42;
//~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
//~^ ERROR assign to part of possibly-uninitialized variable: `t` [E0381]
noop().await;
t.1 = 88;
let _ = t;
Expand All @@ -20,7 +20,7 @@ async fn test_tuple() {
async fn test_tuple_struct() {
let mut t: T;
t.0 = 42;
//~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
//~^ ERROR assign to part of possibly-uninitialized variable: `t` [E0381]
noop().await;
t.1 = 88;
let _ = t;
Expand All @@ -29,7 +29,7 @@ async fn test_tuple_struct() {
async fn test_struct() {
let mut t: S;
t.x = 42;
//~^ ERROR assign to part of possibly uninitialized variable: `t` [E0381]
//~^ ERROR assign to part of possibly-uninitialized variable: `t` [E0381]
noop().await;
t.y = 88;
let _ = t;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error[E0381]: assign to part of possibly uninitialized variable: `t`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/partial-initialization-across-await.rs:13:5
|
LL | t.0 = 42;
| ^^^^^^^^ use of possibly uninitialized `t`
| ^^^^^^^^ use of possibly-uninitialized `t`

error[E0381]: assign to part of possibly uninitialized variable: `t`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/partial-initialization-across-await.rs:22:5
|
LL | t.0 = 42;
| ^^^^^^^^ use of possibly uninitialized `t`
| ^^^^^^^^ use of possibly-uninitialized `t`

error[E0381]: assign to part of possibly uninitialized variable: `t`
error[E0381]: assign to part of possibly-uninitialized variable: `t`
--> $DIR/partial-initialization-across-await.rs:31:5
|
LL | t.x = 42;
| ^^^^^^^^ use of possibly uninitialized `t`
| ^^^^^^^^ use of possibly-uninitialized `t`

error: aborting due to 3 previous errors

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/borrowck/assign_mutable_fields.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
error[E0381]: assign to part of possibly uninitialized variable: `x`
error[E0381]: assign to part of possibly-uninitialized variable: `x`
--> $DIR/assign_mutable_fields.rs:9:5
|
LL | x.0 = 1;
| ^^^^^^^ use of possibly uninitialized `x`
| ^^^^^^^ use of possibly-uninitialized `x`

error[E0381]: assign to part of possibly uninitialized variable: `x`
error[E0381]: assign to part of possibly-uninitialized variable: `x`
--> $DIR/assign_mutable_fields.rs:17:5
|
LL | x.0 = 1;
| ^^^^^^^ use of possibly uninitialized `x`
| ^^^^^^^ use of possibly-uninitialized `x`

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-and-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ fn main() {
let i: isize;

println!("{}", false && { i = 5; true });
println!("{}", i); //~ ERROR borrow of possibly uninitialized variable: `i`
println!("{}", i); //~ ERROR borrow of possibly-uninitialized variable: `i`
}
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/borrowck-and-init.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0381]: borrow of possibly uninitialized variable: `i`
error[E0381]: borrow of possibly-uninitialized variable: `i`
--> $DIR/borrowck-and-init.rs:5:20
|
LL | println!("{}", i);
| ^ use of possibly uninitialized `i`
| ^ use of possibly-uninitialized `i`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod test_cases {
fn indirect_is_not_init() {
let x: i32;
unsafe {
asm!("nop" : "=*r"(x)); //~ ERROR use of possibly uninitialized variable
asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/borrowck-asm.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ LL | unsafe {
LL | asm!("nop" : "+r"(x));
| ^ cannot assign twice to immutable variable

error[E0381]: use of possibly uninitialized variable: `x`
error[E0381]: use of possibly-uninitialized variable: `x`
--> $DIR/borrowck-asm.rs:60:32
|
LL | asm!("nop" : "=*r"(x));
| ^ use of possibly uninitialized `x`
| ^ use of possibly-uninitialized `x`

error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/borrowck-asm.rs:68:31
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-block-unint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fn force<F>(f: F) where F: FnOnce() { f(); }
fn main() {
let x: isize;
force(|| { //~ ERROR borrow of possibly uninitialized variable: `x`
force(|| { //~ ERROR borrow of possibly-uninitialized variable: `x`
println!("{}", x);
});
}
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/borrowck-block-unint.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0381]: borrow of possibly uninitialized variable: `x`
error[E0381]: borrow of possibly-uninitialized variable: `x`
--> $DIR/borrowck-block-unint.rs:4:11
|
LL | force(|| {
| ^^ use of possibly uninitialized `x`
| ^^ use of possibly-uninitialized `x`
LL | println!("{}", x);
| - borrow occurs due to use in closure

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-break-uninit-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn foo() -> isize {
x = 0;
}

println!("{}", x); //~ ERROR borrow of possibly uninitialized variable: `x`
println!("{}", x); //~ ERROR borrow of possibly-uninitialized variable: `x`

return 17;
}
Expand Down
Loading

0 comments on commit 022d9c8

Please sign in to comment.