Skip to content

Commit 4957a40

Browse files
committed
Add extra test for expressions and fix typo in message
1 parent 48825bc commit 4957a40

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/librustc/hir/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
250250
self.emit_repr_error(
251251
attr.span,
252252
stmt.span,
253-
&format!("attribute should not be applied a statement"),
253+
&format!("attribute should not be applied to a statement"),
254254
&format!("not a struct, enum or union"),
255255
);
256256
}

src/test/compile-fail/issue-43988.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(stmt_expr_attributes)]
12+
1113
fn main() {
1214

1315
#[inline]
@@ -21,7 +23,7 @@ fn main() {
2123

2224
#[repr(nothing)]
2325
let _x = 0;
24-
//~^^ ERROR attribute should not be applied a statement
26+
//~^^ ERROR attribute should not be applied to a statement
2527

2628
#[repr(something_not_real)]
2729
loop {
@@ -31,12 +33,16 @@ fn main() {
3133

3234
#[repr]
3335
let _y = "123";
34-
//~^^ ERROR attribute should not be applied a statement
36+
//~^^ ERROR attribute should not be applied to a statement
3537

3638

3739
fn foo() {}
3840

3941
#[inline(ABC)]
4042
foo();
4143
//~^^ ERROR attribute should be applied to function
44+
45+
let _z = #[repr] 1;
46+
//~^ ERROR attribute should not be applied to an expression
47+
4248
}

0 commit comments

Comments
 (0)