Skip to content

Commit 7072c99

Browse files
committed
Update fulldeps UI tests to the new lint diagnostic API
1 parent 48dc9c9 commit 7072c99

File tree

4 files changed

+55
-56
lines changed

4 files changed

+55
-56
lines changed

tests/ui-fulldeps/internal-lints/diagnostics.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern crate rustc_session;
1414
extern crate rustc_span;
1515

1616
use rustc_errors::{
17-
Diag, DiagCtxtHandle, DiagInner, DiagMessage, Diagnostic, EmissionGuarantee, Level,
17+
Diag, DiagCtxtHandle, DiagInner, DiagMessage, Diagnostic, EmissionGuarantee, Level, MultiSpan,
1818
LintDiagnostic, SubdiagMessage, SubdiagMessageOp, Subdiagnostic,
1919
};
2020
use rustc_macros::{Diagnostic, Subdiagnostic};
@@ -85,6 +85,10 @@ impl<'a> LintDiagnostic<'a, ()> for UntranslatableInLintDiagnostic {
8585
diag.note("untranslatable diagnostic");
8686
//~^ ERROR diagnostics should be created using translatable messages
8787
}
88+
89+
fn span(&self) -> Option<MultiSpan> {
90+
None
91+
}
8892
}
8993

9094
pub struct TranslatableInLintDiagnostic;
@@ -93,6 +97,10 @@ impl<'a> LintDiagnostic<'a, ()> for TranslatableInLintDiagnostic {
9397
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
9498
diag.note(crate::fluent_generated::no_crate_note);
9599
}
100+
101+
fn span(&self) -> Option<MultiSpan> {
102+
None
103+
}
96104
}
97105

98106
pub fn make_diagnostics<'a>(dcx: DiagCtxtHandle<'a>) {

tests/ui-fulldeps/internal-lints/diagnostics.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LL | diag.note("untranslatable diagnostic");
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls
26-
--> $DIR/diagnostics.rs:99:21
26+
--> $DIR/diagnostics.rs:107:21
2727
|
2828
LL | let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example);
2929
| ^^^^^^^^^^
@@ -35,37 +35,37 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)]
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls
38-
--> $DIR/diagnostics.rs:102:21
38+
--> $DIR/diagnostics.rs:110:21
3939
|
4040
LL | let _diag = dcx.struct_err("untranslatable diagnostic");
4141
| ^^^^^^^^^^
4242

4343
error: diagnostics should be created using translatable messages
44-
--> $DIR/diagnostics.rs:102:32
44+
--> $DIR/diagnostics.rs:110:32
4545
|
4646
LL | let _diag = dcx.struct_err("untranslatable diagnostic");
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4848

4949
error: diagnostics should be created using translatable messages
50-
--> $DIR/diagnostics.rs:120:7
50+
--> $DIR/diagnostics.rs:128:7
5151
|
5252
LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5454

5555
error: diagnostics should be created using translatable messages
56-
--> $DIR/diagnostics.rs:122:50
56+
--> $DIR/diagnostics.rs:130:50
5757
|
5858
LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6060

6161
error: diagnostics should be created using translatable messages
62-
--> $DIR/diagnostics.rs:124:7
62+
--> $DIR/diagnostics.rs:132:7
6363
|
6464
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6666

6767
error: diagnostics should be created using translatable messages
68-
--> $DIR/diagnostics.rs:124:36
68+
--> $DIR/diagnostics.rs:132:36
6969
|
7070
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ struct LintsGood {}
561561
#[diag(no_crate_example)]
562562
struct PrimarySpanOnLint {
563563
#[primary_span]
564-
//~^ ERROR `#[primary_span]` is not a valid attribute
565564
span: Span,
566565
}
567566

0 commit comments

Comments
 (0)