Skip to content

Commit bd979ed

Browse files
committed
more English grammar
1 parent f8999fb commit bd979ed

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/librustc_mir/interpret/validity.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
362362
);
363363
match err.kind {
364364
err_unsup!(InvalidNullPointerUsage) => {
365-
throw_validation_failure!("NULL reference", self.path)
365+
throw_validation_failure!("a NULL reference", self.path)
366366
}
367367
err_unsup!(AlignmentCheckFailed { required, has }) => {
368368
throw_validation_failure!(
369369
format_args!(
370-
"unaligned reference \
370+
"an unaligned reference \
371371
(required {} byte alignment but found {})",
372372
required.bytes(),
373373
has.bytes()
@@ -376,11 +376,11 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
376376
)
377377
}
378378
err_unsup!(ReadBytesAsPointer) => throw_validation_failure!(
379-
"dangling reference (created from integer)",
379+
"a dangling reference (created from integer)",
380380
self.path
381381
),
382382
_ => throw_validation_failure!(
383-
"dangling reference (not entirely in bounds)",
383+
"a dangling reference (not entirely in bounds)",
384384
self.path
385385
),
386386
}

src/test/ui/consts/const-eval/ub-ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::mem;
66

77
const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
88
//~^ ERROR it is undefined behavior to use this value
9-
//~^^ type validation failed: encountered unaligned reference (required 2 byte alignment but found 1)
9+
//~^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
1010

1111
const NULL: &u16 = unsafe { mem::transmute(0usize) };
1212
//~^ ERROR it is undefined behavior to use this value

src/test/ui/consts/const-eval/ub-ref.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/ub-ref.rs:7:1
33
|
44
LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned reference (required 2 byte alignment but found 1)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
66
|
77
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
88

99
error[E0080]: it is undefined behavior to use this value
1010
--> $DIR/ub-ref.rs:11:1
1111
|
1212
LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered NULL reference
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a NULL reference
1414
|
1515
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
1616

@@ -34,7 +34,7 @@ error[E0080]: it is undefined behavior to use this value
3434
--> $DIR/ub-ref.rs:23:1
3535
|
3636
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (created from integer)
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (created from integer)
3838
|
3939
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
4040

src/test/ui/consts/const-eval/ub-upvars.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
66
LL | | let another_var = 13;
77
LL | | move || { let _ = bad_ref; let _ = another_var; }
88
LL | | };
9-
| |__^ type validation failed: encountered NULL reference at .<deref>.<dyn-downcast>.<closure-var(bad_ref)>
9+
| |__^ type validation failed: encountered a NULL reference at .<deref>.<dyn-downcast>.<closure-var(bad_ref)>
1010
|
1111
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
1212

src/test/ui/consts/const-eval/ub-wide-ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/ub-wide-ptr.rs:86:1
33
|
44
LL | const STR_TOO_LONG: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str};
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (not entirely in bounds)
66
|
77
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
88

@@ -50,7 +50,7 @@ error[E0080]: it is undefined behavior to use this value
5050
--> $DIR/ub-wide-ptr.rs:109:1
5151
|
5252
LL | const SLICE_TOO_LONG: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice};
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling reference (not entirely in bounds)
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (not entirely in bounds)
5454
|
5555
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
5656

0 commit comments

Comments
 (0)