Skip to content

Commit 8165375

Browse files
Update tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs
1 parent 665894d commit 8165375

File tree

2 files changed

+36
-103
lines changed

2 files changed

+36
-103
lines changed

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_span::symbol::Ident;
2020
use rustc_span::Span;
2121

2222
extern crate rustc_macros;
23-
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
23+
use rustc_macros::{Diagnostic, Subdiagnostic};
2424

2525
extern crate rustc_middle;
2626
use rustc_middle::ty::Ty;
@@ -495,18 +495,6 @@ struct LabelWithTrailingList {
495495
span: Span,
496496
}
497497

498-
#[derive(LintDiagnostic)]
499-
#[diag("this is an example message")]
500-
struct LintsGood {}
501-
502-
#[derive(LintDiagnostic)]
503-
#[diag("this is an example message")]
504-
struct PrimarySpanOnLint {
505-
#[primary_span]
506-
//~^ ERROR `#[primary_span]` is not a valid attribute
507-
span: Span,
508-
}
509-
510498
#[derive(Diagnostic)]
511499
#[diag("this is an example message", code = E0123)]
512500
struct ErrorWithMultiSpan {
@@ -542,13 +530,6 @@ struct WarnAttribute {}
542530
//~| ERROR cannot find attribute `lint` in this scope
543531
struct LintAttributeOnSessionDiag {}
544532

545-
#[derive(LintDiagnostic)]
546-
#[lint("this is an example message", code = E0123)]
547-
//~^ ERROR `#[lint(...)]` is not a valid attribute
548-
//~| ERROR diagnostic message not specified
549-
//~| ERROR cannot find attribute `lint` in this scope
550-
struct LintAttributeOnLintDiag {}
551-
552533
#[derive(Diagnostic)]
553534
#[diag("this is an example message", code = E0123)]
554535
struct DuplicatedSuggestionCode {
@@ -670,14 +651,6 @@ struct SubdiagnosticBadLitStr {
670651
note: Note,
671652
}
672653

673-
#[derive(LintDiagnostic)]
674-
#[diag("this is an example message")]
675-
struct SubdiagnosticEagerLint {
676-
#[subdiagnostic(eager)]
677-
//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
678-
note: Note,
679-
}
680-
681654
#[derive(Diagnostic)]
682655
#[diag("this is an example message")]
683656
struct SubdiagnosticEagerFormerlyCorrect {

tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.stderr

Lines changed: 35 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -300,212 +300,184 @@ error: derive(Diagnostic): no nested attribute expected here
300300
LL | #[label("with a label", foo("..."))]
301301
| ^^^
302302

303-
error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
304-
--> $DIR/diagnostic-derive-inline.rs:505:5
305-
|
306-
LL | #[primary_span]
307-
| ^
308-
|
309-
= help: the `primary_span` field attribute is not valid for lint diagnostics
310-
311303
error: derive(Diagnostic): `#[error(...)]` is not a valid attribute
312-
--> $DIR/diagnostic-derive-inline.rs:525:1
304+
--> $DIR/diagnostic-derive-inline.rs:513:1
313305
|
314306
LL | #[error("this is an example message", code = E0123)]
315307
| ^
316308

317309
error: derive(Diagnostic): diagnostic message not specified
318-
--> $DIR/diagnostic-derive-inline.rs:525:1
310+
--> $DIR/diagnostic-derive-inline.rs:513:1
319311
|
320312
LL | #[error("this is an example message", code = E0123)]
321313
| ^
322314
|
323315
= help: specify the message as the first argument to the `#[diag(...)]` attribute, such as `#[diag("Example error")]`
324316

325317
error: derive(Diagnostic): `#[warn_(...)]` is not a valid attribute
326-
--> $DIR/diagnostic-derive-inline.rs:532:1
318+
--> $DIR/diagnostic-derive-inline.rs:520:1
327319
|
328320
LL | #[warn_("this is an example message", code = E0123)]
329321
| ^
330322

331323
error: derive(Diagnostic): diagnostic message not specified
332-
--> $DIR/diagnostic-derive-inline.rs:532:1
324+
--> $DIR/diagnostic-derive-inline.rs:520:1
333325
|
334326
LL | #[warn_("this is an example message", code = E0123)]
335327
| ^
336328
|
337329
= help: specify the message as the first argument to the `#[diag(...)]` attribute, such as `#[diag("Example error")]`
338330

339331
error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute
340-
--> $DIR/diagnostic-derive-inline.rs:539:1
341-
|
342-
LL | #[lint("this is an example message", code = E0123)]
343-
| ^
344-
345-
error: derive(Diagnostic): diagnostic message not specified
346-
--> $DIR/diagnostic-derive-inline.rs:539:1
347-
|
348-
LL | #[lint("this is an example message", code = E0123)]
349-
| ^
350-
|
351-
= help: specify the message as the first argument to the `#[diag(...)]` attribute, such as `#[diag("Example error")]`
352-
353-
error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute
354-
--> $DIR/diagnostic-derive-inline.rs:546:1
332+
--> $DIR/diagnostic-derive-inline.rs:527:1
355333
|
356334
LL | #[lint("this is an example message", code = E0123)]
357335
| ^
358336

359337
error: derive(Diagnostic): diagnostic message not specified
360-
--> $DIR/diagnostic-derive-inline.rs:546:1
338+
--> $DIR/diagnostic-derive-inline.rs:527:1
361339
|
362340
LL | #[lint("this is an example message", code = E0123)]
363341
| ^
364342
|
365343
= help: specify the message as the first argument to the `#[diag(...)]` attribute, such as `#[diag("Example error")]`
366344

367345
error: derive(Diagnostic): attribute specified multiple times
368-
--> $DIR/diagnostic-derive-inline.rs:555:53
346+
--> $DIR/diagnostic-derive-inline.rs:536:53
369347
|
370348
LL | #[suggestion("with a suggestion", code = "...", code = ",,,")]
371349
| ^^^^
372350
|
373351
note: previously specified here
374-
--> $DIR/diagnostic-derive-inline.rs:555:39
352+
--> $DIR/diagnostic-derive-inline.rs:536:39
375353
|
376354
LL | #[suggestion("with a suggestion", code = "...", code = ",,,")]
377355
| ^^^^
378356

379357
error: derive(Diagnostic): wrong types for suggestion
380-
--> $DIR/diagnostic-derive-inline.rs:564:24
358+
--> $DIR/diagnostic-derive-inline.rs:545:24
381359
|
382360
LL | suggestion: (Span, usize),
383361
| ^^^^^
384362
|
385363
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
386364

387365
error: derive(Diagnostic): wrong types for suggestion
388-
--> $DIR/diagnostic-derive-inline.rs:572:17
366+
--> $DIR/diagnostic-derive-inline.rs:553:17
389367
|
390368
LL | suggestion: (Span,),
391369
| ^^^^^^^
392370
|
393371
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
394372

395373
error: derive(Diagnostic): suggestion without `code = "..."`
396-
--> $DIR/diagnostic-derive-inline.rs:579:5
374+
--> $DIR/diagnostic-derive-inline.rs:560:5
397375
|
398376
LL | #[suggestion("with a suggestion")]
399377
| ^
400378

401379
error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute
402-
--> $DIR/diagnostic-derive-inline.rs:586:1
380+
--> $DIR/diagnostic-derive-inline.rs:567:1
403381
|
404382
LL | #[multipart_suggestion("with a suggestion")]
405383
| ^
406384
|
407385
= help: consider creating a `Subdiagnostic` instead
408386

409387
error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute
410-
--> $DIR/diagnostic-derive-inline.rs:589:1
388+
--> $DIR/diagnostic-derive-inline.rs:570:1
411389
|
412390
LL | #[multipart_suggestion()]
413391
| ^
414392
|
415393
= help: consider creating a `Subdiagnostic` instead
416394

417395
error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute
418-
--> $DIR/diagnostic-derive-inline.rs:593:5
396+
--> $DIR/diagnostic-derive-inline.rs:574:5
419397
|
420398
LL | #[multipart_suggestion("with a suggestion")]
421399
| ^
422400
|
423401
= help: consider creating a `Subdiagnostic` instead
424402

425403
error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute
426-
--> $DIR/diagnostic-derive-inline.rs:601:1
404+
--> $DIR/diagnostic-derive-inline.rs:582:1
427405
|
428406
LL | #[suggestion("with a suggestion", code = "...")]
429407
| ^
430408
|
431409
= help: `#[label]` and `#[suggestion]` can only be applied to fields
432410

433411
error: derive(Diagnostic): `#[label]` is not a valid attribute
434-
--> $DIR/diagnostic-derive-inline.rs:610:1
412+
--> $DIR/diagnostic-derive-inline.rs:591:1
435413
|
436414
LL | #[label]
437415
| ^
438416
|
439417
= help: subdiagnostic message is missing
440418

441419
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
442-
--> $DIR/diagnostic-derive-inline.rs:644:5
420+
--> $DIR/diagnostic-derive-inline.rs:625:5
443421
|
444422
LL | #[subdiagnostic(bad)]
445423
| ^
446424

447425
error: derive(Diagnostic): `#[subdiagnostic = ...]` is not a valid attribute
448-
--> $DIR/diagnostic-derive-inline.rs:652:5
426+
--> $DIR/diagnostic-derive-inline.rs:633:5
449427
|
450428
LL | #[subdiagnostic = "bad"]
451429
| ^
452430

453431
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
454-
--> $DIR/diagnostic-derive-inline.rs:660:5
432+
--> $DIR/diagnostic-derive-inline.rs:641:5
455433
|
456434
LL | #[subdiagnostic(bad, bad)]
457435
| ^
458436

459437
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
460-
--> $DIR/diagnostic-derive-inline.rs:668:5
438+
--> $DIR/diagnostic-derive-inline.rs:649:5
461439
|
462440
LL | #[subdiagnostic("bad")]
463441
| ^
464442

465443
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
466-
--> $DIR/diagnostic-derive-inline.rs:676:5
444+
--> $DIR/diagnostic-derive-inline.rs:657:5
467445
|
468446
LL | #[subdiagnostic(eager)]
469447
| ^
470448

471449
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
472-
--> $DIR/diagnostic-derive-inline.rs:684:5
473-
|
474-
LL | #[subdiagnostic(eager)]
475-
| ^
476-
477-
error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute
478-
--> $DIR/diagnostic-derive-inline.rs:705:5
450+
--> $DIR/diagnostic-derive-inline.rs:678:5
479451
|
480452
LL | #[subdiagnostic(eager)]
481453
| ^
482454

483455
error: derive(Diagnostic): expected at least one string literal for `code(...)`
484-
--> $DIR/diagnostic-derive-inline.rs:736:44
456+
--> $DIR/diagnostic-derive-inline.rs:709:44
485457
|
486458
LL | #[suggestion("with a suggestion", code())]
487459
| ^
488460

489461
error: derive(Diagnostic): `code(...)` must contain only string literals
490-
--> $DIR/diagnostic-derive-inline.rs:744:44
462+
--> $DIR/diagnostic-derive-inline.rs:717:44
491463
|
492464
LL | #[suggestion("with a suggestion", code(foo))]
493465
| ^^^
494466

495467
error: unexpected token, expected `)`
496-
--> $DIR/diagnostic-derive-inline.rs:744:44
468+
--> $DIR/diagnostic-derive-inline.rs:717:44
497469
|
498470
LL | #[suggestion("with a suggestion", code(foo))]
499471
| ^^^
500472

501473
error: expected string literal
502-
--> $DIR/diagnostic-derive-inline.rs:753:46
474+
--> $DIR/diagnostic-derive-inline.rs:726:46
503475
|
504476
LL | #[suggestion("with a suggestion", code = 3)]
505477
| ^
506478

507479
error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute
508-
--> $DIR/diagnostic-derive-inline.rs:768:5
480+
--> $DIR/diagnostic-derive-inline.rs:741:5
509481
|
510482
LL | #[suggestion("with a suggestion", code = "")]
511483
| ^
@@ -515,7 +487,7 @@ LL | #[suggestion("with a suggestion", code = "")]
515487
= help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]`
516488

517489
error: derive(Diagnostic): Variable `nosub` not found in diagnostic
518-
--> $DIR/diagnostic-derive-inline.rs:780:8
490+
--> $DIR/diagnostic-derive-inline.rs:753:8
519491
|
520492
LL | #[diag("does not exist: {$nosub}")]
521493
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -535,7 +507,7 @@ LL | #[nonsense]
535507
| ^^^^^^^^
536508

537509
error: cannot find attribute `error` in this scope
538-
--> $DIR/diagnostic-derive-inline.rs:525:3
510+
--> $DIR/diagnostic-derive-inline.rs:513:3
539511
|
540512
LL | #[error("this is an example message", code = E0123)]
541513
| ^^^^^
@@ -547,7 +519,7 @@ LL | struct ErrorAttribute {}
547519
|
548520

549521
error: cannot find attribute `warn_` in this scope
550-
--> $DIR/diagnostic-derive-inline.rs:532:3
522+
--> $DIR/diagnostic-derive-inline.rs:520:3
551523
|
552524
LL | #[warn_("this is an example message", code = E0123)]
553525
| ^^^^^
@@ -559,19 +531,7 @@ LL + #[warn("this is an example message", code = E0123)]
559531
|
560532

561533
error: cannot find attribute `lint` in this scope
562-
--> $DIR/diagnostic-derive-inline.rs:539:3
563-
|
564-
LL | #[lint("this is an example message", code = E0123)]
565-
| ^^^^
566-
|
567-
help: a built-in attribute with a similar name exists
568-
|
569-
LL - #[lint("this is an example message", code = E0123)]
570-
LL + #[link("this is an example message", code = E0123)]
571-
|
572-
573-
error: cannot find attribute `lint` in this scope
574-
--> $DIR/diagnostic-derive-inline.rs:546:3
534+
--> $DIR/diagnostic-derive-inline.rs:527:3
575535
|
576536
LL | #[lint("this is an example message", code = E0123)]
577537
| ^^^^
@@ -583,7 +543,7 @@ LL + #[link("this is an example message", code = E0123)]
583543
|
584544

585545
error: cannot find attribute `multipart_suggestion` in this scope
586-
--> $DIR/diagnostic-derive-inline.rs:586:3
546+
--> $DIR/diagnostic-derive-inline.rs:567:3
587547
|
588548
LL | #[multipart_suggestion("with a suggestion")]
589549
| ^^^^^^^^^^^^^^^^^^^^
@@ -595,7 +555,7 @@ LL | struct MultipartSuggestion {
595555
|
596556

597557
error: cannot find attribute `multipart_suggestion` in this scope
598-
--> $DIR/diagnostic-derive-inline.rs:589:3
558+
--> $DIR/diagnostic-derive-inline.rs:570:3
599559
|
600560
LL | #[multipart_suggestion()]
601561
| ^^^^^^^^^^^^^^^^^^^^
@@ -607,7 +567,7 @@ LL | struct MultipartSuggestion {
607567
|
608568

609569
error: cannot find attribute `multipart_suggestion` in this scope
610-
--> $DIR/diagnostic-derive-inline.rs:593:7
570+
--> $DIR/diagnostic-derive-inline.rs:574:7
611571
|
612572
LL | #[multipart_suggestion("with a suggestion")]
613573
| ^^^^^^^^^^^^^^^^^^^^
@@ -636,6 +596,6 @@ note: required by a bound in `Diag::<'a, G>::arg`
636596
= note: in this macro invocation
637597
= note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
638598

639-
error: aborting due to 81 previous errors
599+
error: aborting due to 76 previous errors
640600

641601
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)