Skip to content

Commit c8a9206

Browse files
committed
Add link to invalid repr error
1 parent c63ba70 commit c8a9206

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ attr_parsing_unknown_version_literal =
132132
attr_parsing_unrecognized_repr_hint =
133133
unrecognized representation hint
134134
.help = valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
135+
.note = for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
135136
136137
attr_parsing_unstable_cfg_target_compact =
137138
compact `cfg(target(..))` is experimental and subject to change

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ pub(crate) struct ReprIdent {
498498
#[derive(Diagnostic)]
499499
#[diag(attr_parsing_unrecognized_repr_hint, code = E0552)]
500500
#[help]
501+
#[note]
501502
pub(crate) struct UnrecognizedReprHint {
502503
#[primary_span]
503504
pub span: Span,

tests/ui/attributes/invalid-reprs.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ LL | let y = #[repr(uwu(4))]
2626
| ^^^^^^
2727
|
2828
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
29+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
2930

3031
error: aborting due to 3 previous errors
3132

tests/ui/issues/issue-43988.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ LL | #[repr(nothing)]
2525
| ^^^^^^^
2626
|
2727
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
28+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
2829

2930
error[E0552]: unrecognized representation hint
3031
--> $DIR/issue-43988.rs:18:12
@@ -33,6 +34,7 @@ LL | #[repr(something_not_real)]
3334
| ^^^^^^^^^^^^^^^^^^
3435
|
3536
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
37+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
3638

3739
error[E0539]: malformed `repr` attribute input
3840
--> $DIR/issue-43988.rs:24:5

tests/ui/repr/invalid_repr_list_help.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | #[repr(uwu)]
55
| ^^^
66
|
77
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
8+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
89

910
error[E0552]: unrecognized representation hint
1011
--> $DIR/invalid_repr_list_help.rs:6:8
@@ -13,6 +14,7 @@ LL | #[repr(uwu = "a")]
1314
| ^^^^^^^^^
1415
|
1516
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
17+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
1618

1719
error[E0552]: unrecognized representation hint
1820
--> $DIR/invalid_repr_list_help.rs:9:8
@@ -21,6 +23,7 @@ LL | #[repr(uwu(4))]
2123
| ^^^^^^
2224
|
2325
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
26+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
2427

2528
error[E0552]: unrecognized representation hint
2629
--> $DIR/invalid_repr_list_help.rs:14:8
@@ -29,6 +32,7 @@ LL | #[repr(uwu, u8)]
2932
| ^^^
3033
|
3134
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
35+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
3236

3337
error[E0552]: unrecognized representation hint
3438
--> $DIR/invalid_repr_list_help.rs:19:8
@@ -37,6 +41,7 @@ LL | #[repr(uwu)]
3741
| ^^^
3842
|
3943
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
44+
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
4045

4146
error: unknown `doc` attribute `owo`
4247
--> $DIR/invalid_repr_list_help.rs:20:7

0 commit comments

Comments
 (0)