Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d013b5a

Browse files
committedFeb 27, 2024
Stabilize the #[diagnostic] namespace and #[diagnostic::on_unimplemented] attribute
This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute. The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working. The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented: * `message` which provides the text for the top level error message * `label` which provides the text for the label shown inline in the broken code in the error message * `note` which provides additional notes. The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated. All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated. Tracking issue: rust-lang#111996
1 parent 91cae1d commit d013b5a

27 files changed

+93
-273
lines changed
 

‎compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
203203
);
204204
}
205205
}
206-
if !attr.is_doc_comment()
207-
&& let [seg, _] = attr.get_normal_item().path.segments.as_slice()
208-
&& seg.ident.name == sym::diagnostic
209-
&& !self.features.diagnostic_namespace
210-
{
211-
let msg = "`#[diagnostic]` attribute name space is experimental";
212-
gate!(self, diagnostic_namespace, seg.ident.span, msg);
213-
}
214206

215207
// Emit errors for non-staged-api crates.
216208
if !self.features.staged_api {

‎compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ declare_features! (
146146
(accepted, derive_default_enum, "1.62.0", Some(86985)),
147147
/// Allows the use of destructuring assignments.
148148
(accepted, destructuring_assignment, "1.59.0", Some(71126)),
149+
/// Allows using the `#[diagnostic]` attribute tool namespace
150+
(accepted, diagnostic_namespace, "CURRENT_RUSTC_VERSION", Some(111996)),
149151
/// Allows `#[doc(alias = "...")]`.
150152
(accepted, doc_alias, "1.48.0", Some(50146)),
151153
/// Allows `..` in tuple (struct) patterns.

‎compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ declare_features! (
434434
(unstable, deprecated_safe, "1.61.0", Some(94978)),
435435
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
436436
(unstable, deprecated_suggestion, "1.61.0", Some(94785)),
437-
/// Allows using the `#[diagnostic]` attribute tool namespace
438-
(unstable, diagnostic_namespace, "1.73.0", Some(111996)),
439437
/// Controls errors in trait implementations.
440438
(unstable, do_not_recommend, "1.67.0", Some(51992)),
441439
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.

‎library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
//
203203
// Language features:
204204
// tidy-alphabetical-start
205+
#![cfg_attr(bootstrap, feature(diagnostic_namespace))]
205206
#![cfg_attr(bootstrap, feature(platform_intrinsics))]
206207
#![feature(abi_unadjusted)]
207208
#![feature(adt_const_params)]
@@ -223,7 +224,6 @@
223224
#![feature(const_trait_impl)]
224225
#![feature(decl_macro)]
225226
#![feature(deprecated_suggestion)]
226-
#![feature(diagnostic_namespace)]
227227
#![feature(doc_cfg)]
228228
#![feature(doc_cfg_hide)]
229229
#![feature(doc_notable_trait)]

‎src/doc/unstable-book/src/language-features/diagnostic-namespace.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

‎tests/ui/diagnostic_namespace/existing_proc_macros.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(diagnostic_namespace)]
21
//@ check-pass
32
//@ aux-build:proc-macro-helper.rs
43

‎tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(diagnostic_namespace)]
21
//@ check-pass
32
#[diagnostic::non_existing_attribute]
43
//~^WARN unknown diagnostic attribute

‎tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
warning: unknown diagnostic attribute
2-
--> $DIR/non_existing_attributes_accepted.rs:3:15
2+
--> $DIR/non_existing_attributes_accepted.rs:2:15
33
|
44
LL | #[diagnostic::non_existing_attribute]
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
88

99
warning: unknown diagnostic attribute
10-
--> $DIR/non_existing_attributes_accepted.rs:8:15
10+
--> $DIR/non_existing_attributes_accepted.rs:7:15
1111
|
1212
LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
1313
| ^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/diagnostic_namespace/on_unimplemented/auxiliary/other.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(
42
message = "Message",
53
note = "Note",

‎tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(
42
on(_Self = "&str"),
53
//~^WARN malformed `on_unimplemented` attribute

‎tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

‎tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(unsupported = "foo")]
42
//~^WARN malformed `on_unimplemented` attribute
53
//~|WARN malformed `on_unimplemented` attribute

‎tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
2-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:8:1
2+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:6:1
33
|
44
LL | #[diagnostic::on_unimplemented(message = "Baz")]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
88

99
warning: malformed `on_unimplemented` attribute
10-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
10+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:1:32
1111
|
1212
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
1313
| ^^^^^^^^^^^^^^^^^^^ invalid option found here
1414
|
1515
= help: only `message`, `note` and `label` are allowed as options
1616

1717
warning: malformed `on_unimplemented` attribute
18-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
18+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:10:50
1919
|
2020
LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
2121
| ^^^^^^^^^^^^^^^^^^^ invalid option found here
2222
|
2323
= help: only `message`, `note` and `label` are allowed as options
2424

2525
warning: malformed `on_unimplemented` attribute
26-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
26+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:50
2727
|
2828
LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
3030
|
3131
= help: only `message`, `note` and `label` are allowed as options
3232

3333
warning: malformed `on_unimplemented` attribute
34-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:32
34+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:20:32
3535
|
3636
LL | #[diagnostic::on_unimplemented = "boom"]
3737
| ^^^^^^^^ invalid option found here
3838
|
3939
= help: only `message`, `note` and `label` are allowed as options
4040

4141
warning: missing options for `on_unimplemented` attribute
42-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
42+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:24:1
4343
|
4444
LL | #[diagnostic::on_unimplemented]
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4646
|
4747
= help: at least one of the `message`, `note` and `label` options are expected
4848

4949
warning: there is no parameter `DoesNotExist` on trait `Test`
50-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:32
50+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:32
5151
|
5252
LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
5454
|
5555
= help: expect either a generic argument name or `{Self}` as format argument
5656

5757
warning: malformed `on_unimplemented` attribute
58-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
58+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:1:32
5959
|
6060
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
6161
| ^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -64,26 +64,26 @@ LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
6464
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6565

6666
error[E0277]: the trait bound `i32: Foo` is not satisfied
67-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:14
67+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:41:14
6868
|
6969
LL | take_foo(1_i32);
7070
| -------- ^^^^^ the trait `Foo` is not implemented for `i32`
7171
| |
7272
| required by a bound introduced by this call
7373
|
7474
help: this trait has no implementations, consider adding one
75-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:6:1
75+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:4:1
7676
|
7777
LL | trait Foo {}
7878
| ^^^^^^^^^
7979
note: required by a bound in `take_foo`
80-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:36:21
80+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:21
8181
|
8282
LL | fn take_foo(_: impl Foo) {}
8383
| ^^^ required by this bound in `take_foo`
8484

8585
warning: malformed `on_unimplemented` attribute
86-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
86+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:10:50
8787
|
8888
LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
8989
| ^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -92,26 +92,26 @@ LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
9292
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
9393

9494
error[E0277]: Boom
95-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:45:14
95+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:14
9696
|
9797
LL | take_baz(1_i32);
9898
| -------- ^^^^^ the trait `Baz` is not implemented for `i32`
9999
| |
100100
| required by a bound introduced by this call
101101
|
102102
help: this trait has no implementations, consider adding one
103-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:1
103+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:13:1
104104
|
105105
LL | trait Baz {}
106106
| ^^^^^^^^^
107107
note: required by a bound in `take_baz`
108-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:21
108+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:21
109109
|
110110
LL | fn take_baz(_: impl Baz) {}
111111
| ^^^ required by this bound in `take_baz`
112112

113113
warning: malformed `on_unimplemented` attribute
114-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
114+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:50
115115
|
116116
LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
117117
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -120,26 +120,26 @@ LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message
120120
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
121121

122122
error[E0277]: Boom
123-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:47:15
123+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:45:15
124124
|
125125
LL | take_boom(1_i32);
126126
| --------- ^^^^^ the trait `Boom` is not implemented for `i32`
127127
| |
128128
| required by a bound introduced by this call
129129
|
130130
help: this trait has no implementations, consider adding one
131-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:20:1
131+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:18:1
132132
|
133133
LL | trait Boom {}
134134
| ^^^^^^^^^^
135135
note: required by a bound in `take_boom`
136-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:38:22
136+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:36:22
137137
|
138138
LL | fn take_boom(_: impl Boom) {}
139139
| ^^^^ required by this bound in `take_boom`
140140

141141
warning: missing options for `on_unimplemented` attribute
142-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
142+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:24:1
143143
|
144144
LL | #[diagnostic::on_unimplemented]
145145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -148,26 +148,26 @@ LL | #[diagnostic::on_unimplemented]
148148
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
149149

150150
error[E0277]: the trait bound `i32: Whatever` is not satisfied
151-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:49:19
151+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:47:19
152152
|
153153
LL | take_whatever(1_i32);
154154
| ------------- ^^^^^ the trait `Whatever` is not implemented for `i32`
155155
| |
156156
| required by a bound introduced by this call
157157
|
158158
help: this trait has no implementations, consider adding one
159-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:1
159+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:27:1
160160
|
161161
LL | trait Whatever {}
162162
| ^^^^^^^^^^^^^^
163163
note: required by a bound in `take_whatever`
164-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:39:26
164+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:26
165165
|
166166
LL | fn take_whatever(_: impl Whatever) {}
167167
| ^^^^^^^^ required by this bound in `take_whatever`
168168

169169
warning: there is no parameter `DoesNotExist` on trait `Test`
170-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:32
170+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:32
171171
|
172172
LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
173173
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -176,20 +176,20 @@ LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
176176
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
177177

178178
error[E0277]: {DoesNotExist}
179-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:51:15
179+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:49:15
180180
|
181181
LL | take_test(());
182182
| --------- ^^ the trait `Test` is not implemented for `()`
183183
| |
184184
| required by a bound introduced by this call
185185
|
186186
help: this trait has no implementations, consider adding one
187-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:1
187+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:32:1
188188
|
189189
LL | trait Test {}
190190
| ^^^^^^^^^^
191191
note: required by a bound in `take_test`
192-
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:40:22
192+
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:38:22
193193
|
194194
LL | fn take_test(_: impl Test) {}
195195
| ^^^^ required by this bound in `take_test`

‎tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(
42
if(Self = "()"),
53
//~^WARN malformed `on_unimplemented` attribute

‎tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: malformed `on_unimplemented` attribute
2-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
2+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:2:5
33
|
44
LL | if(Self = "()"),
55
| ^^^^^^^^^^^^^^^ invalid option found here
@@ -8,7 +8,7 @@ LL | if(Self = "()"),
88
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
99

1010
warning: `message` is ignored due to previous definition of `message`
11-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:10:32
11+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:8:32
1212
|
1313
LL | message = "custom message",
1414
| -------------------------- `message` is first declared here
@@ -17,7 +17,7 @@ LL | #[diagnostic::on_unimplemented(message = "fallback!!")]
1717
| ^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here
1818

1919
warning: malformed `on_unimplemented` attribute
20-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
20+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:2:5
2121
|
2222
LL | if(Self = "()"),
2323
| ^^^^^^^^^^^^^^^ invalid option found here
@@ -26,7 +26,7 @@ LL | if(Self = "()"),
2626
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2727

2828
warning: `message` is ignored due to previous definition of `message`
29-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:10:32
29+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:8:32
3030
|
3131
LL | message = "custom message",
3232
| -------------------------- `message` is first declared here
@@ -37,7 +37,7 @@ LL | #[diagnostic::on_unimplemented(message = "fallback!!")]
3737
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3838

3939
error[E0277]: custom message
40-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:20:15
40+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:18:15
4141
|
4242
LL | takes_foo(());
4343
| --------- ^^ fallback label
@@ -48,12 +48,12 @@ LL | takes_foo(());
4848
= note: custom note
4949
= note: fallback note
5050
help: this trait has no implementations, consider adding one
51-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:15:1
51+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:13:1
5252
|
5353
LL | trait Foo {}
5454
| ^^^^^^^^^
5555
note: required by a bound in `takes_foo`
56-
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:17:22
56+
--> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:15:22
5757
|
5858
LL | fn takes_foo(_: impl Foo) {}
5959
| ^^^ required by this bound in `takes_foo`

‎tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz", note = "Boom")]
42
trait Foo {}
53

‎tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: Foo
2-
--> $DIR/multiple_notes.rs:14:15
2+
--> $DIR/multiple_notes.rs:12:15
33
|
44
LL | takes_foo(());
55
| --------- ^^ Bar
@@ -10,18 +10,18 @@ LL | takes_foo(());
1010
= note: Baz
1111
= note: Boom
1212
help: this trait has no implementations, consider adding one
13-
--> $DIR/multiple_notes.rs:4:1
13+
--> $DIR/multiple_notes.rs:2:1
1414
|
1515
LL | trait Foo {}
1616
| ^^^^^^^^^
1717
note: required by a bound in `takes_foo`
18-
--> $DIR/multiple_notes.rs:10:22
18+
--> $DIR/multiple_notes.rs:8:22
1919
|
2020
LL | fn takes_foo(_: impl Foo) {}
2121
| ^^^ required by this bound in `takes_foo`
2222

2323
error[E0277]: Bar
24-
--> $DIR/multiple_notes.rs:16:15
24+
--> $DIR/multiple_notes.rs:14:15
2525
|
2626
LL | takes_bar(());
2727
| --------- ^^ Foo
@@ -32,12 +32,12 @@ LL | takes_bar(());
3232
= note: Baz
3333
= note: Baz2
3434
help: this trait has no implementations, consider adding one
35-
--> $DIR/multiple_notes.rs:8:1
35+
--> $DIR/multiple_notes.rs:6:1
3636
|
3737
LL | trait Bar {}
3838
| ^^^^^^^^^
3939
note: required by a bound in `takes_bar`
40-
--> $DIR/multiple_notes.rs:11:22
40+
--> $DIR/multiple_notes.rs:9:22
4141
|
4242
LL | fn takes_bar(_: impl Bar) {}
4343
| ^^^ required by this bound in `takes_bar`

‎tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz")]
42
trait Foo {}
53

‎tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: Foo
2-
--> $DIR/on_unimplemented_simple.rs:9:15
2+
--> $DIR/on_unimplemented_simple.rs:7:15
33
|
44
LL | takes_foo(());
55
| --------- ^^ Bar
@@ -9,12 +9,12 @@ LL | takes_foo(());
99
= help: the trait `Foo` is not implemented for `()`
1010
= note: Baz
1111
help: this trait has no implementations, consider adding one
12-
--> $DIR/on_unimplemented_simple.rs:4:1
12+
--> $DIR/on_unimplemented_simple.rs:2:1
1313
|
1414
LL | trait Foo {}
1515
| ^^^^^^^^^
1616
note: required by a bound in `takes_foo`
17-
--> $DIR/on_unimplemented_simple.rs:6:22
17+
--> $DIR/on_unimplemented_simple.rs:4:22
1818
|
1919
LL | fn takes_foo(_: impl Foo) {}
2020
| ^^^ required by this bound in `takes_foo`

‎tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic::on_unimplemented(
42
message = "first message",
53
label = "first label",

‎tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: `message` is ignored due to previous definition of `message`
2-
--> $DIR/report_warning_on_duplicated_options.rs:9:5
2+
--> $DIR/report_warning_on_duplicated_options.rs:7:5
33
|
44
LL | message = "first message",
55
| ------------------------- `message` is first declared here
@@ -10,7 +10,7 @@ LL | message = "second message",
1010
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
1111

1212
warning: `label` is ignored due to previous definition of `label`
13-
--> $DIR/report_warning_on_duplicated_options.rs:12:5
13+
--> $DIR/report_warning_on_duplicated_options.rs:10:5
1414
|
1515
LL | label = "first label",
1616
| --------------------- `label` is first declared here
@@ -19,7 +19,7 @@ LL | label = "second label",
1919
| ^^^^^^^^^^^^^^^^^^^^^^ `label` is already declared here
2020

2121
warning: `message` is ignored due to previous definition of `message`
22-
--> $DIR/report_warning_on_duplicated_options.rs:9:5
22+
--> $DIR/report_warning_on_duplicated_options.rs:7:5
2323
|
2424
LL | message = "first message",
2525
| ------------------------- `message` is first declared here
@@ -30,7 +30,7 @@ LL | message = "second message",
3030
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131

3232
warning: `label` is ignored due to previous definition of `label`
33-
--> $DIR/report_warning_on_duplicated_options.rs:12:5
33+
--> $DIR/report_warning_on_duplicated_options.rs:10:5
3434
|
3535
LL | label = "first label",
3636
| --------------------- `label` is first declared here
@@ -41,7 +41,7 @@ LL | label = "second label",
4141
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4242

4343
error[E0277]: first message
44-
--> $DIR/report_warning_on_duplicated_options.rs:23:15
44+
--> $DIR/report_warning_on_duplicated_options.rs:21:15
4545
|
4646
LL | takes_foo(());
4747
| --------- ^^ first label
@@ -52,12 +52,12 @@ LL | takes_foo(());
5252
= note: custom note
5353
= note: second note
5454
help: this trait has no implementations, consider adding one
55-
--> $DIR/report_warning_on_duplicated_options.rs:17:1
55+
--> $DIR/report_warning_on_duplicated_options.rs:15:1
5656
|
5757
LL | trait Foo {}
5858
| ^^^^^^^^^
5959
note: required by a bound in `takes_foo`
60-
--> $DIR/report_warning_on_duplicated_options.rs:20:22
60+
--> $DIR/report_warning_on_duplicated_options.rs:18:22
6161
|
6262
LL | fn takes_foo(_: impl Foo) {}
6363
| ^^^ required by this bound in `takes_foo`

‎tests/ui/diagnostic_namespace/requires_path.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(diagnostic_namespace)]
2-
31
#[diagnostic]
42
//~^ERROR cannot find attribute `diagnostic` in this scope
53
pub struct Bar;

‎tests/ui/diagnostic_namespace/requires_path.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot find attribute `diagnostic` in this scope
2-
--> $DIR/requires_path.rs:3:3
2+
--> $DIR/requires_path.rs:1:3
33
|
44
LL | #[diagnostic]
55
| ^^^^^^^^^^

0 commit comments

Comments
 (0)
Please sign in to comment.