forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.rs
More file actions
716 lines (643 loc) · 22.8 KB
/
errors.rs
File metadata and controls
716 lines (643 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
use std::io::Error;
use std::path::{Path, PathBuf};
use rustc_errors::codes::*;
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol, sym};
use rustc_target::spec::{PanicStrategy, TargetTuple};
use crate::locator::CrateFlavor;
#[derive(Diagnostic)]
#[diag(
"crate `{$crate_name}` required to be available in rlib format, but was not found in this form"
)]
pub struct RlibRequired {
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form"
)]
pub struct LibRequired<'a> {
pub crate_name: Symbol,
pub kind: &'a str,
}
#[derive(Diagnostic)]
#[diag(
"crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form"
)]
#[help("try adding `extern crate rustc_driver;` at the top level of this crate")]
pub struct RustcLibRequired<'a> {
pub crate_name: Symbol,
pub kind: &'a str,
}
#[derive(Diagnostic)]
#[diag("cannot satisfy dependencies so `{$crate_name}` only shows up once")]
#[help("having upstream crates all available in one format will likely make this go away")]
pub struct CrateDepMultiple {
pub crate_name: Symbol,
#[subdiagnostic]
pub non_static_deps: Vec<NonStaticCrateDep>,
#[help("`feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library")]
pub rustc_driver_help: bool,
}
#[derive(Subdiagnostic)]
#[note("`{$sub_crate_name}` was unavailable as a static crate, preventing fully static linking")]
pub struct NonStaticCrateDep {
/// It's different from `crate_name` in main Diagnostic.
pub sub_crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("cannot link together two panic runtimes: {$prev_name} and {$cur_name}")]
pub struct TwoPanicRuntimes {
pub prev_name: Symbol,
pub cur_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"the linked panic runtime `{$runtime}` is not compiled with this crate's panic strategy `{$strategy}`"
)]
pub struct BadPanicStrategy {
pub runtime: Symbol,
pub strategy: PanicStrategy,
}
#[derive(Diagnostic)]
#[diag(
"the crate `{$crate_name}` requires panic strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`"
)]
pub struct RequiredPanicStrategy {
pub crate_name: Symbol,
pub found_strategy: PanicStrategy,
pub desired_strategy: PanicStrategy,
}
#[derive(Diagnostic)]
#[diag(
"the crate `{$crate_name}` was compiled with a panic strategy which is incompatible with `immediate-abort`"
)]
pub struct IncompatibleWithImmediateAbort {
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"the crate `core` was compiled with a panic strategy which is incompatible with `immediate-abort`"
)]
pub struct IncompatibleWithImmediateAbortCore;
#[derive(Diagnostic)]
#[diag(
"the crate `{$crate_name}` is compiled with the panic-in-drop strategy `{$found_strategy}` which is incompatible with this crate's strategy of `{$desired_strategy}`"
)]
pub struct IncompatiblePanicInDropStrategy {
pub crate_name: Symbol,
pub found_strategy: PanicStrategy,
pub desired_strategy: PanicStrategy,
}
#[derive(Diagnostic)]
#[diag("`#[link_ordinal]` is only supported if link kind is `raw-dylib`")]
pub struct LinkOrdinalRawDylib {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("library kind `framework` is only supported on Apple targets")]
pub struct LibFrameworkApple;
#[derive(Diagnostic)]
#[diag("an empty renaming target was specified for library `{$lib_name}`")]
pub struct EmptyRenamingTarget<'a> {
pub lib_name: &'a str,
}
#[derive(Diagnostic)]
#[diag(
"renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library"
)]
pub struct RenamingNoLink<'a> {
pub lib_name: &'a str,
}
#[derive(Diagnostic)]
#[diag("multiple renamings were specified for library `{$lib_name}`")]
pub struct MultipleRenamings<'a> {
pub lib_name: &'a str,
}
#[derive(Diagnostic)]
#[diag("overriding linking modifiers from command line is not supported")]
pub struct NoLinkModOverride {
#[primary_span]
pub span: Option<Span>,
}
#[derive(Diagnostic)]
#[diag("ABI not supported by `#[link(kind = \"raw-dylib\")]` on this architecture")]
pub struct RawDylibUnsupportedAbi {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("failed to create file encoder: {$err}")]
pub struct FailCreateFileEncoder {
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("failed to write to `{$path}`: {$err}")]
pub struct FailWriteFile<'a> {
pub path: &'a Path,
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("the crate `{$crate_name}` is not a panic runtime")]
pub struct CrateNotPanicRuntime {
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"the crate `{$crate_name}` resolved as `compiler_builtins` but is not `#![compiler_builtins]`"
)]
pub struct CrateNotCompilerBuiltins {
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("the crate `{$crate_name}` does not have the panic strategy `{$strategy}`")]
pub struct NoPanicStrategy {
pub crate_name: Symbol,
pub strategy: PanicStrategy,
}
#[derive(Diagnostic)]
#[diag("the crate `{$crate_name}` is not a profiler runtime")]
pub struct NotProfilerRuntime {
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("cannot define multiple global allocators")]
pub struct NoMultipleGlobalAlloc {
#[primary_span]
#[label("cannot define a new global allocator")]
pub span2: Span,
#[label("previous global allocator defined here")]
pub span1: Span,
}
#[derive(Diagnostic)]
#[diag("cannot define multiple allocation error handlers")]
pub struct NoMultipleAllocErrorHandler {
#[primary_span]
#[label("cannot define a new allocation error handler")]
pub span2: Span,
#[label("previous allocation error handler defined here")]
pub span1: Span,
}
#[derive(Diagnostic)]
#[diag(
"the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}"
)]
pub struct ConflictingGlobalAlloc {
pub crate_name: Symbol,
pub other_crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}"
)]
pub struct ConflictingAllocErrorHandler {
pub crate_name: Symbol,
pub other_crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait"
)]
pub struct GlobalAllocRequired;
#[derive(Diagnostic)]
#[diag(
"the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`"
)]
pub struct NoTransitiveNeedsDep<'a> {
pub crate_name: Symbol,
pub needs_crate_name: &'a str,
pub deps_crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("failed to write {$filename}: {$err}")]
pub struct FailedWriteError {
pub filename: PathBuf,
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("failed to copy {$filename} to stdout: {$err}")]
pub struct FailedCopyToStdout {
pub filename: PathBuf,
pub err: Error,
}
#[derive(Diagnostic)]
#[diag(
"option `-o` or `--emit` is used to write binary output type `metadata` to stdout, but stdout is a tty"
)]
pub struct BinaryOutputToTty;
#[derive(Diagnostic)]
#[diag("could not find native static library `{$libname}`, perhaps an -L flag is missing?")]
pub struct MissingNativeLibrary<'a> {
libname: &'a str,
#[subdiagnostic]
suggest_name: Option<SuggestLibraryName<'a>>,
}
impl<'a> MissingNativeLibrary<'a> {
pub fn new(libname: &'a str, verbatim: bool) -> Self {
// if it looks like the user has provided a complete filename rather just the bare lib name,
// then provide a note that they might want to try trimming the name
let suggested_name = if !verbatim {
if let Some(libname) = libname.strip_circumfix("lib", ".a") {
// this is a unix style filename so trim prefix & suffix
Some(libname)
} else if let Some(libname) = libname.strip_suffix(".lib") {
// this is a Windows style filename so just trim the suffix
Some(libname)
} else {
None
}
} else {
None
};
Self {
libname,
suggest_name: suggested_name
.map(|suggested_name| SuggestLibraryName { suggested_name }),
}
}
}
#[derive(Subdiagnostic)]
#[help("only provide the library name `{$suggested_name}`, not the full filename")]
pub struct SuggestLibraryName<'a> {
suggested_name: &'a str,
}
#[derive(Diagnostic)]
#[diag("couldn't create a temp dir: {$err}")]
pub struct FailedCreateTempdir {
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("failed to create the file {$filename}: {$err}")]
pub struct FailedCreateFile<'a> {
pub filename: &'a Path,
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("failed to create encoded metadata from file: {$err}")]
pub struct FailedCreateEncodedMetadata {
pub err: Error,
}
#[derive(Diagnostic)]
#[diag("cannot load a crate with a non-ascii name `{$crate_name}`")]
pub struct NonAsciiName {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("extern location for {$crate_name} does not exist: {$location}")]
pub struct ExternLocationNotExist<'a> {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub location: &'a Path,
}
#[derive(Diagnostic)]
#[diag("extern location for {$crate_name} is not a file: {$location}")]
pub struct ExternLocationNotFile<'a> {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub location: &'a Path,
}
pub(crate) struct MultipleCandidates {
pub span: Span,
pub flavor: CrateFlavor,
pub crate_name: Symbol,
pub candidates: Vec<PathBuf>,
}
impl<G: EmissionGuarantee> Diagnostic<'_, G> for MultipleCandidates {
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(
dcx,
level,
msg!("multiple candidates for `{$flavor}` dependency `{$crate_name}` found"),
);
diag.arg("crate_name", self.crate_name);
diag.arg("flavor", self.flavor);
diag.code(E0464);
diag.span(self.span);
for (i, candidate) in self.candidates.iter().enumerate() {
diag.note(format!("candidate #{}: {}", i + 1, candidate.display()));
}
diag
}
}
#[derive(Diagnostic)]
#[diag(
"only metadata stub found for `{$flavor}` dependency `{$crate_name}` please provide path to the corresponding .rmeta file with full metadata"
)]
pub(crate) struct FullMetadataNotFound {
#[primary_span]
pub span: Span,
pub flavor: CrateFlavor,
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two", code = E0519)]
pub struct SymbolConflictsCurrent {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values")]
pub struct StableCrateIdCollision {
#[primary_span]
pub span: Span,
pub crate_name0: Symbol,
pub crate_name1: Symbol,
}
#[derive(Diagnostic)]
#[diag("{$path}{$err}")]
pub struct DlError {
#[primary_span]
pub span: Span,
pub path: String,
pub err: String,
}
#[derive(Diagnostic)]
#[diag("found possibly newer version of crate `{$crate_name}`{$add_info}", code = E0460)]
#[note("perhaps that crate needs to be recompiled?")]
#[note("the following crate versions were found:{$found_crates}")]
pub struct NewerCrateVersion {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub add_info: String,
pub found_crates: String,
}
#[derive(Diagnostic)]
#[diag("couldn't find crate `{$crate_name}` with expected target triple {$locator_triple}{$add_info}", code = E0461)]
#[note("the following crate versions were found:{$found_crates}")]
pub struct NoCrateWithTriple<'a> {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub locator_triple: &'a str,
pub add_info: String,
pub found_crates: String,
}
#[derive(Diagnostic)]
#[diag("found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}", code = E0462)]
#[note("the following crate versions were found:{$found_crates}")]
#[help("please recompile that crate using --crate-type lib")]
pub struct FoundStaticlib {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub add_info: String,
pub found_crates: String,
}
#[derive(Diagnostic)]
#[diag("found crate `{$crate_name}` compiled by an incompatible version of rustc{$add_info}", code = E0514)]
#[note("the following crate versions were found:{$found_crates}")]
#[help(
"please recompile that crate using this compiler ({$rustc_version}) (consider running `cargo clean` first)"
)]
pub struct IncompatibleRustc {
#[primary_span]
pub span: Span,
pub crate_name: Symbol,
pub add_info: String,
pub found_crates: String,
pub rustc_version: String,
}
pub struct InvalidMetadataFiles {
pub span: Span,
pub crate_name: Symbol,
pub add_info: String,
pub crate_rejections: Vec<String>,
}
impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidMetadataFiles {
#[track_caller]
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(
dcx,
level,
msg!("found invalid metadata files for crate `{$crate_name}`{$add_info}"),
);
diag.arg("crate_name", self.crate_name);
diag.arg("add_info", self.add_info);
diag.code(E0786);
diag.span(self.span);
for crate_rejection in self.crate_rejections {
diag.note(crate_rejection);
}
diag
}
}
pub struct CannotFindCrate {
pub span: Span,
pub crate_name: Symbol,
pub add_info: String,
pub missing_core: bool,
pub current_crate: String,
pub is_nightly_build: bool,
pub profiler_runtime: Symbol,
pub locator_triple: TargetTuple,
pub is_ui_testing: bool,
pub is_tier_3: bool,
}
impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
#[track_caller]
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
let mut diag =
Diag::new(dcx, level, msg!("can't find crate for `{$crate_name}`{$add_info}"));
diag.arg("crate_name", self.crate_name);
diag.arg("current_crate", self.current_crate);
diag.arg("add_info", self.add_info);
diag.arg("locator_triple", self.locator_triple.tuple());
diag.code(E0463);
diag.span(self.span);
if self.crate_name == sym::std || self.crate_name == sym::core {
if self.missing_core {
diag.note(msg!("the `{$locator_triple}` target may not be installed"));
} else {
diag.note(msg!(
"the `{$locator_triple}` target may not support the standard library"
));
}
let has_precompiled_std = !self.is_tier_3;
if self.missing_core {
if env!("CFG_RELEASE_CHANNEL") == "dev" && !self.is_ui_testing {
// Note: Emits the nicer suggestion only for the dev channel.
diag.help(msg!("consider adding the standard library to the sysroot with `x build library --target {$locator_triple}`"));
} else if has_precompiled_std {
// NOTE: this suggests using rustup, even though the user may not have it installed.
// That's because they could choose to install it; or this may give them a hint which
// target they need to install from their distro.
diag.help(msg!(
"consider downloading the target with `rustup target add {$locator_triple}`"
));
}
}
// Suggest using #![no_std]. #[no_core] is unstable and not really supported anyway.
// NOTE: this is a dummy span if `extern crate std` was injected by the compiler.
// If it's not a dummy, that means someone added `extern crate std` explicitly and
// `#![no_std]` won't help.
if !self.missing_core && self.span.is_dummy() {
diag.note(msg!("`std` is required by `{$current_crate}` because it does not declare `#![no_std]`"));
}
// Recommend -Zbuild-std even on stable builds for Tier 3 targets because
// it's the recommended way to use the target, the user should switch to nightly.
if self.is_nightly_build || !has_precompiled_std {
diag.help(msg!("consider building the standard library from source with `cargo build -Zbuild-std`"));
}
} else if self.crate_name == self.profiler_runtime {
diag.note(msg!("the compiler may have been built without the profiler runtime"));
} else if self.crate_name.as_str().starts_with("rustc_") {
diag.help(msg!("maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`"));
}
diag.span_label(self.span, msg!("can't find crate"));
diag
}
}
#[derive(Diagnostic)]
#[diag("extern location for {$crate_name} is of an unknown type: {$path}")]
pub struct CrateLocationUnknownType<'a> {
#[primary_span]
pub span: Span,
pub path: &'a Path,
pub crate_name: Symbol,
}
#[derive(Diagnostic)]
#[diag("file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}")]
pub struct LibFilenameForm<'a> {
#[primary_span]
pub span: Span,
pub dll_prefix: &'a str,
pub dll_suffix: &'a str,
}
#[derive(Diagnostic)]
#[diag(
"older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88"
)]
pub(crate) struct WasmCAbi {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
#[help(
"the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
)]
#[note(
"`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`"
)]
#[help(
"set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`"
)]
#[help(
"if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
)]
pub struct IncompatibleTargetModifiers {
#[primary_span]
pub span: Span,
pub extern_crate: Symbol,
pub local_crate: Symbol,
pub flag_name: String,
pub flag_name_prefixed: String,
pub local_value: String,
pub extern_value: String,
}
#[derive(Diagnostic)]
#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
#[help(
"the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
)]
#[note(
"unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`"
)]
#[help(
"set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`"
)]
#[help(
"if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
)]
pub struct IncompatibleTargetModifiersLMissed {
#[primary_span]
pub span: Span,
pub extern_crate: Symbol,
pub local_crate: Symbol,
pub flag_name: String,
pub flag_name_prefixed: String,
pub extern_value: String,
}
#[derive(Diagnostic)]
#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")]
#[help(
"the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely"
)]
#[note(
"`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`"
)]
#[help(
"unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`"
)]
#[help(
"if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error"
)]
pub struct IncompatibleTargetModifiersRMissed {
#[primary_span]
pub span: Span,
pub extern_crate: Symbol,
pub local_crate: Symbol,
pub flag_name: String,
pub flag_name_prefixed: String,
pub local_value: String,
}
#[derive(Diagnostic)]
#[diag(
"unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`"
)]
pub struct UnknownTargetModifierUnsafeAllowed {
#[primary_span]
pub span: Span,
pub flag_name: String,
}
#[derive(Diagnostic)]
#[diag(
"found async drop types in dependency `{$extern_crate}`, but async_drop feature is disabled for `{$local_crate}`"
)]
#[help(
"if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used"
)]
pub struct AsyncDropTypesInDependency {
#[primary_span]
pub span: Span,
pub extern_crate: Symbol,
pub local_crate: Symbol,
}
#[derive(Diagnostic)]
#[diag("link name must be well-formed if link kind is `raw-dylib`")]
pub struct RawDylibMalformed {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
pub(crate) struct UnusedCrateDependency {
pub extern_crate: Symbol,
pub local_crate: Symbol,
}
#[derive(Diagnostic)]
#[diag(
"your program uses the crate `{$extern_crate}`, that is not compiled with `{$mitigation_name}{$mitigation_level}` enabled"
)]
#[note(
"recompile `{$extern_crate}` with `{$mitigation_name}{$mitigation_level}` enabled, or use `-Z allow-partial-mitigations={$mitigation_name}` to allow creating an artifact that has the mitigation partially enabled "
)]
#[help(
"it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`"
)]
pub struct MitigationLessStrictInDependency {
#[primary_span]
pub span: Span,
pub mitigation_name: String,
pub mitigation_level: String,
pub extern_crate: Symbol,
}