Skip to content

Commit 2f06527

Browse files
committed
add test to verify that rust-lang#132391 can be closed
1 parent d8ea2a2 commit 2f06527

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

Diff for: compiler/rustc_attr_parsing/src/parser.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,9 @@ impl<'a> MetaItemListParserContext<'a> {
427427
let span = span.with_hi(segments.last().unwrap().span.hi());
428428
Some(AttrPath { segments: segments.into_boxed_slice(), span })
429429
}
430-
TokenTree::Token(
431-
Token { kind: token::OpenDelim(_) | token::CloseDelim(_), .. },
432-
_,
433-
) => None,
430+
TokenTree::Token(Token { kind: token::OpenDelim(_) | token::CloseDelim(_), .. }, _) => {
431+
None
432+
}
434433
_ => {
435434
// malformed attributes can get here. We can't crash, but somewhere else should've
436435
// already warned for this.

Diff for: compiler/rustc_hir/src/stable_hash_impls.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use crate::hir_id::{HirId, ItemLocalId};
1010
/// Requirements for a `StableHashingContext` to be used in this crate.
1111
/// This is a hack to allow using the `HashStable_Generic` derive macro
1212
/// instead of implementing everything in `rustc_middle`.
13-
pub trait HashStableContext: rustc_attr_data_structures::HashStableContext + rustc_ast::HashStableContext + rustc_abi::HashStableContext {
13+
pub trait HashStableContext:
14+
rustc_attr_data_structures::HashStableContext
15+
+ rustc_ast::HashStableContext
16+
+ rustc_abi::HashStableContext
17+
{
1418
fn hash_attr_id(&mut self, id: &HashIgnoredAttrId, hasher: &mut StableHasher);
1519
}
1620

Diff for: tests/ui/attributes/malformed-fn-align.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(fn_align)]
2+
#![crate_type = "lib"]
3+
4+
trait MyTrait {
5+
#[repr(align)] //~ ERROR invalid `repr(align)` attribute: `align` needs an argument
6+
fn myfun();
7+
}

Diff for: tests/ui/attributes/malformed-fn-align.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0589]: invalid `repr(align)` attribute: `align` needs an argument
2+
--> $DIR/malformed-fn-align.rs:5:12
3+
|
4+
LL | #[repr(align)]
5+
| ^^^^^ help: supply an argument here: `align(...)`
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0589`.

0 commit comments

Comments
 (0)