rustc_codegen_ssa/
errors.rs

1//! Errors emitted by codegen_ssa
2
3use std::borrow::Cow;
4use std::ffi::OsString;
5use std::io::Error;
6use std::num::ParseIntError;
7use std::path::{Path, PathBuf};
8use std::process::ExitStatus;
9
10use rustc_errors::codes::*;
11use rustc_errors::{
12    Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
13};
14use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
15use rustc_middle::ty::layout::LayoutError;
16use rustc_middle::ty::{FloatTy, Ty};
17use rustc_span::{Span, Symbol};
18
19use crate::assert_module_sources::CguReuse;
20use crate::back::command::Command;
21use crate::fluent_generated as fluent;
22
23#[derive(Diagnostic)]
24#[diag(codegen_ssa_incorrect_cgu_reuse_type)]
25pub(crate) struct IncorrectCguReuseType<'a> {
26    #[primary_span]
27    pub span: Span,
28    pub cgu_user_name: &'a str,
29    pub actual_reuse: CguReuse,
30    pub expected_reuse: CguReuse,
31    pub at_least: u8,
32}
33
34#[derive(Diagnostic)]
35#[diag(codegen_ssa_cgu_not_recorded)]
36pub(crate) struct CguNotRecorded<'a> {
37    pub cgu_user_name: &'a str,
38    pub cgu_name: &'a str,
39}
40
41#[derive(Diagnostic)]
42#[diag(codegen_ssa_autodiff_without_lto)]
43pub struct AutodiffWithoutLto;
44
45#[derive(Diagnostic)]
46#[diag(codegen_ssa_unknown_reuse_kind)]
47pub(crate) struct UnknownReuseKind {
48    #[primary_span]
49    pub span: Span,
50    pub kind: Symbol,
51}
52
53#[derive(Diagnostic)]
54#[diag(codegen_ssa_missing_query_depgraph)]
55pub(crate) struct MissingQueryDepGraph {
56    #[primary_span]
57    pub span: Span,
58}
59
60#[derive(Diagnostic)]
61#[diag(codegen_ssa_malformed_cgu_name)]
62pub(crate) struct MalformedCguName {
63    #[primary_span]
64    pub span: Span,
65    pub user_path: String,
66    pub crate_name: String,
67}
68
69#[derive(Diagnostic)]
70#[diag(codegen_ssa_no_module_named)]
71pub(crate) struct NoModuleNamed<'a> {
72    #[primary_span]
73    pub span: Span,
74    pub user_path: &'a str,
75    pub cgu_name: Symbol,
76    pub cgu_names: String,
77}
78
79#[derive(Diagnostic)]
80#[diag(codegen_ssa_field_associated_value_expected)]
81pub(crate) struct FieldAssociatedValueExpected {
82    #[primary_span]
83    pub span: Span,
84    pub name: Symbol,
85}
86
87#[derive(Diagnostic)]
88#[diag(codegen_ssa_no_field)]
89pub(crate) struct NoField {
90    #[primary_span]
91    pub span: Span,
92    pub name: Symbol,
93}
94
95#[derive(Diagnostic)]
96#[diag(codegen_ssa_lib_def_write_failure)]
97pub(crate) struct LibDefWriteFailure {
98    pub error: Error,
99}
100
101#[derive(Diagnostic)]
102#[diag(codegen_ssa_version_script_write_failure)]
103pub(crate) struct VersionScriptWriteFailure {
104    pub error: Error,
105}
106
107#[derive(Diagnostic)]
108#[diag(codegen_ssa_symbol_file_write_failure)]
109pub(crate) struct SymbolFileWriteFailure {
110    pub error: Error,
111}
112
113#[derive(Diagnostic)]
114#[diag(codegen_ssa_ld64_unimplemented_modifier)]
115pub(crate) struct Ld64UnimplementedModifier;
116
117#[derive(Diagnostic)]
118#[diag(codegen_ssa_linker_unsupported_modifier)]
119pub(crate) struct LinkerUnsupportedModifier;
120
121#[derive(Diagnostic)]
122#[diag(codegen_ssa_L4Bender_exporting_symbols_unimplemented)]
123pub(crate) struct L4BenderExportingSymbolsUnimplemented;
124
125#[derive(Diagnostic)]
126#[diag(codegen_ssa_no_natvis_directory)]
127pub(crate) struct NoNatvisDirectory {
128    pub error: Error,
129}
130
131#[derive(Diagnostic)]
132#[diag(codegen_ssa_no_saved_object_file)]
133pub(crate) struct NoSavedObjectFile<'a> {
134    pub cgu_name: &'a str,
135}
136
137#[derive(Diagnostic)]
138#[diag(codegen_ssa_requires_rust_abi, code = E0737)]
139pub(crate) struct RequiresRustAbi {
140    #[primary_span]
141    pub span: Span,
142}
143
144#[derive(Diagnostic)]
145#[diag(codegen_ssa_null_on_export, code = E0648)]
146pub(crate) struct NullOnExport {
147    #[primary_span]
148    pub span: Span,
149}
150
151#[derive(Diagnostic)]
152#[diag(codegen_ssa_unsupported_instruction_set, code = E0779)]
153pub(crate) struct UnsuportedInstructionSet {
154    #[primary_span]
155    pub span: Span,
156}
157
158#[derive(Diagnostic)]
159#[diag(codegen_ssa_invalid_instruction_set, code = E0779)]
160pub(crate) struct InvalidInstructionSet {
161    #[primary_span]
162    pub span: Span,
163}
164
165#[derive(Diagnostic)]
166#[diag(codegen_ssa_bare_instruction_set, code = E0778)]
167pub(crate) struct BareInstructionSet {
168    #[primary_span]
169    pub span: Span,
170}
171
172#[derive(Diagnostic)]
173#[diag(codegen_ssa_multiple_instruction_set, code = E0779)]
174pub(crate) struct MultipleInstructionSet {
175    #[primary_span]
176    pub span: Span,
177}
178
179#[derive(Diagnostic)]
180#[diag(codegen_ssa_expected_name_value_pair)]
181pub(crate) struct ExpectedNameValuePair {
182    #[primary_span]
183    pub span: Span,
184}
185
186#[derive(Diagnostic)]
187#[diag(codegen_ssa_unexpected_parameter_name)]
188pub(crate) struct UnexpectedParameterName {
189    #[primary_span]
190    #[label]
191    pub span: Span,
192    pub prefix_nops: Symbol,
193    pub entry_nops: Symbol,
194}
195
196#[derive(Diagnostic)]
197#[diag(codegen_ssa_invalid_literal_value)]
198pub(crate) struct InvalidLiteralValue {
199    #[primary_span]
200    #[label]
201    pub span: Span,
202}
203
204#[derive(Diagnostic)]
205#[diag(codegen_ssa_out_of_range_integer)]
206pub(crate) struct OutOfRangeInteger {
207    #[primary_span]
208    #[label]
209    pub span: Span,
210}
211
212#[derive(Diagnostic)]
213#[diag(codegen_ssa_expected_one_argument, code = E0534)]
214pub(crate) struct ExpectedOneArgument {
215    #[primary_span]
216    pub span: Span,
217}
218
219#[derive(Diagnostic)]
220#[diag(codegen_ssa_expected_one_argument, code = E0722)]
221pub(crate) struct ExpectedOneArgumentOptimize {
222    #[primary_span]
223    pub span: Span,
224}
225
226#[derive(Diagnostic)]
227#[diag(codegen_ssa_invalid_argument, code = E0535)]
228#[help]
229pub(crate) struct InvalidArgument {
230    #[primary_span]
231    pub span: Span,
232}
233
234#[derive(Diagnostic)]
235#[diag(codegen_ssa_invalid_argument, code = E0722)]
236pub(crate) struct InvalidArgumentOptimize {
237    #[primary_span]
238    pub span: Span,
239}
240
241#[derive(Diagnostic)]
242#[diag(codegen_ssa_copy_path_buf)]
243pub(crate) struct CopyPathBuf {
244    pub source_file: PathBuf,
245    pub output_path: PathBuf,
246    pub error: Error,
247}
248
249// Reports Paths using `Debug` implementation rather than Path's `Display` implementation.
250#[derive(Diagnostic)]
251#[diag(codegen_ssa_copy_path)]
252pub struct CopyPath<'a> {
253    from: DebugArgPath<'a>,
254    to: DebugArgPath<'a>,
255    error: Error,
256}
257
258impl<'a> CopyPath<'a> {
259    pub fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> {
260        CopyPath { from: DebugArgPath(from), to: DebugArgPath(to), error }
261    }
262}
263
264struct DebugArgPath<'a>(pub &'a Path);
265
266impl IntoDiagArg for DebugArgPath<'_> {
267    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> rustc_errors::DiagArgValue {
268        DiagArgValue::Str(Cow::Owned(format!("{:?}", self.0)))
269    }
270}
271
272#[derive(Diagnostic)]
273#[diag(codegen_ssa_binary_output_to_tty)]
274pub struct BinaryOutputToTty {
275    pub shorthand: &'static str,
276}
277
278#[derive(Diagnostic)]
279#[diag(codegen_ssa_ignoring_emit_path)]
280pub struct IgnoringEmitPath {
281    pub extension: String,
282}
283
284#[derive(Diagnostic)]
285#[diag(codegen_ssa_ignoring_output)]
286pub struct IgnoringOutput {
287    pub extension: String,
288}
289
290#[derive(Diagnostic)]
291#[diag(codegen_ssa_create_temp_dir)]
292pub(crate) struct CreateTempDir {
293    pub error: Error,
294}
295
296#[derive(Diagnostic)]
297#[diag(codegen_ssa_add_native_library)]
298pub(crate) struct AddNativeLibrary {
299    pub library_path: PathBuf,
300    pub error: Error,
301}
302
303#[derive(Diagnostic)]
304#[diag(codegen_ssa_multiple_external_func_decl)]
305pub(crate) struct MultipleExternalFuncDecl<'a> {
306    #[primary_span]
307    pub span: Span,
308    pub function: Symbol,
309    pub library_name: &'a str,
310}
311
312#[derive(Diagnostic)]
313pub enum LinkRlibError {
314    #[diag(codegen_ssa_rlib_missing_format)]
315    MissingFormat,
316
317    #[diag(codegen_ssa_rlib_only_rmeta_found)]
318    OnlyRmetaFound { crate_name: Symbol },
319
320    #[diag(codegen_ssa_rlib_not_found)]
321    NotFound { crate_name: Symbol },
322
323    #[diag(codegen_ssa_rlib_incompatible_dependency_formats)]
324    IncompatibleDependencyFormats { ty1: String, ty2: String, list1: String, list2: String },
325}
326
327pub(crate) struct ThorinErrorWrapper(pub thorin::Error);
328
329impl<G: EmissionGuarantee> Diagnostic<'_, G> for ThorinErrorWrapper {
330    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
331        let build = |msg| Diag::new(dcx, level, msg);
332        match self.0 {
333            thorin::Error::ReadInput(_) => build(fluent::codegen_ssa_thorin_read_input_failure),
334            thorin::Error::ParseFileKind(_) => {
335                build(fluent::codegen_ssa_thorin_parse_input_file_kind)
336            }
337            thorin::Error::ParseObjectFile(_) => {
338                build(fluent::codegen_ssa_thorin_parse_input_object_file)
339            }
340            thorin::Error::ParseArchiveFile(_) => {
341                build(fluent::codegen_ssa_thorin_parse_input_archive_file)
342            }
343            thorin::Error::ParseArchiveMember(_) => {
344                build(fluent::codegen_ssa_thorin_parse_archive_member)
345            }
346            thorin::Error::InvalidInputKind => build(fluent::codegen_ssa_thorin_invalid_input_kind),
347            thorin::Error::DecompressData(_) => build(fluent::codegen_ssa_thorin_decompress_data),
348            thorin::Error::NamelessSection(_, offset) => {
349                build(fluent::codegen_ssa_thorin_section_without_name)
350                    .with_arg("offset", format!("0x{offset:08x}"))
351            }
352            thorin::Error::RelocationWithInvalidSymbol(section, offset) => {
353                build(fluent::codegen_ssa_thorin_relocation_with_invalid_symbol)
354                    .with_arg("section", section)
355                    .with_arg("offset", format!("0x{offset:08x}"))
356            }
357            thorin::Error::MultipleRelocations(section, offset) => {
358                build(fluent::codegen_ssa_thorin_multiple_relocations)
359                    .with_arg("section", section)
360                    .with_arg("offset", format!("0x{offset:08x}"))
361            }
362            thorin::Error::UnsupportedRelocation(section, offset) => {
363                build(fluent::codegen_ssa_thorin_unsupported_relocation)
364                    .with_arg("section", section)
365                    .with_arg("offset", format!("0x{offset:08x}"))
366            }
367            thorin::Error::MissingDwoName(id) => build(fluent::codegen_ssa_thorin_missing_dwo_name)
368                .with_arg("id", format!("0x{id:08x}")),
369            thorin::Error::NoCompilationUnits => {
370                build(fluent::codegen_ssa_thorin_no_compilation_units)
371            }
372            thorin::Error::NoDie => build(fluent::codegen_ssa_thorin_no_die),
373            thorin::Error::TopLevelDieNotUnit => {
374                build(fluent::codegen_ssa_thorin_top_level_die_not_unit)
375            }
376            thorin::Error::MissingRequiredSection(section) => {
377                build(fluent::codegen_ssa_thorin_missing_required_section)
378                    .with_arg("section", section)
379            }
380            thorin::Error::ParseUnitAbbreviations(_) => {
381                build(fluent::codegen_ssa_thorin_parse_unit_abbreviations)
382            }
383            thorin::Error::ParseUnitAttribute(_) => {
384                build(fluent::codegen_ssa_thorin_parse_unit_attribute)
385            }
386            thorin::Error::ParseUnitHeader(_) => {
387                build(fluent::codegen_ssa_thorin_parse_unit_header)
388            }
389            thorin::Error::ParseUnit(_) => build(fluent::codegen_ssa_thorin_parse_unit),
390            thorin::Error::IncompatibleIndexVersion(section, format, actual) => {
391                build(fluent::codegen_ssa_thorin_incompatible_index_version)
392                    .with_arg("section", section)
393                    .with_arg("actual", actual)
394                    .with_arg("format", format)
395            }
396            thorin::Error::OffsetAtIndex(_, index) => {
397                build(fluent::codegen_ssa_thorin_offset_at_index).with_arg("index", index)
398            }
399            thorin::Error::StrAtOffset(_, offset) => {
400                build(fluent::codegen_ssa_thorin_str_at_offset)
401                    .with_arg("offset", format!("0x{offset:08x}"))
402            }
403            thorin::Error::ParseIndex(_, section) => {
404                build(fluent::codegen_ssa_thorin_parse_index).with_arg("section", section)
405            }
406            thorin::Error::UnitNotInIndex(unit) => {
407                build(fluent::codegen_ssa_thorin_unit_not_in_index)
408                    .with_arg("unit", format!("0x{unit:08x}"))
409            }
410            thorin::Error::RowNotInIndex(_, row) => {
411                build(fluent::codegen_ssa_thorin_row_not_in_index).with_arg("row", row)
412            }
413            thorin::Error::SectionNotInRow => build(fluent::codegen_ssa_thorin_section_not_in_row),
414            thorin::Error::EmptyUnit(unit) => build(fluent::codegen_ssa_thorin_empty_unit)
415                .with_arg("unit", format!("0x{unit:08x}")),
416            thorin::Error::MultipleDebugInfoSection => {
417                build(fluent::codegen_ssa_thorin_multiple_debug_info_section)
418            }
419            thorin::Error::MultipleDebugTypesSection => {
420                build(fluent::codegen_ssa_thorin_multiple_debug_types_section)
421            }
422            thorin::Error::NotSplitUnit => build(fluent::codegen_ssa_thorin_not_split_unit),
423            thorin::Error::DuplicateUnit(unit) => build(fluent::codegen_ssa_thorin_duplicate_unit)
424                .with_arg("unit", format!("0x{unit:08x}")),
425            thorin::Error::MissingReferencedUnit(unit) => {
426                build(fluent::codegen_ssa_thorin_missing_referenced_unit)
427                    .with_arg("unit", format!("0x{unit:08x}"))
428            }
429            thorin::Error::NoOutputObjectCreated => {
430                build(fluent::codegen_ssa_thorin_not_output_object_created)
431            }
432            thorin::Error::MixedInputEncodings => {
433                build(fluent::codegen_ssa_thorin_mixed_input_encodings)
434            }
435            thorin::Error::Io(e) => {
436                build(fluent::codegen_ssa_thorin_io).with_arg("error", format!("{e}"))
437            }
438            thorin::Error::ObjectRead(e) => {
439                build(fluent::codegen_ssa_thorin_object_read).with_arg("error", format!("{e}"))
440            }
441            thorin::Error::ObjectWrite(e) => {
442                build(fluent::codegen_ssa_thorin_object_write).with_arg("error", format!("{e}"))
443            }
444            thorin::Error::GimliRead(e) => {
445                build(fluent::codegen_ssa_thorin_gimli_read).with_arg("error", format!("{e}"))
446            }
447            thorin::Error::GimliWrite(e) => {
448                build(fluent::codegen_ssa_thorin_gimli_write).with_arg("error", format!("{e}"))
449            }
450            _ => unimplemented!("Untranslated thorin error"),
451        }
452    }
453}
454
455pub(crate) struct LinkingFailed<'a> {
456    pub linker_path: &'a Path,
457    pub exit_status: ExitStatus,
458    pub command: Command,
459    pub escaped_output: String,
460    pub verbose: bool,
461    pub sysroot_dir: PathBuf,
462}
463
464impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
465    fn into_diag(mut self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
466        let mut diag = Diag::new(dcx, level, fluent::codegen_ssa_linking_failed);
467        diag.arg("linker_path", format!("{}", self.linker_path.display()));
468        diag.arg("exit_status", format!("{}", self.exit_status));
469
470        let contains_undefined_ref = self.escaped_output.contains("undefined reference to");
471
472        if self.verbose {
473            diag.note(format!("{:?}", self.command));
474        } else {
475            self.command.env_clear();
476
477            enum ArgGroup {
478                Regular(OsString),
479                Objects(usize),
480                Rlibs(PathBuf, Vec<OsString>),
481            }
482
483            // Omit rust object files and fold rlibs in the error by default to make linker errors a
484            // bit less verbose.
485            let orig_args = self.command.take_args();
486            let mut args: Vec<ArgGroup> = vec![];
487            for arg in orig_args {
488                if arg.as_encoded_bytes().ends_with(b".rcgu.o") {
489                    if let Some(ArgGroup::Objects(n)) = args.last_mut() {
490                        *n += 1;
491                    } else {
492                        args.push(ArgGroup::Objects(1));
493                    }
494                } else if arg.as_encoded_bytes().ends_with(b".rlib") {
495                    let rlib_path = Path::new(&arg);
496                    let dir = rlib_path.parent().unwrap();
497                    let filename = rlib_path.file_name().unwrap().to_owned();
498                    if let Some(ArgGroup::Rlibs(parent, rlibs)) = args.last_mut() {
499                        if parent == dir {
500                            rlibs.push(filename);
501                        } else {
502                            args.push(ArgGroup::Rlibs(dir.to_owned(), vec![filename]));
503                        }
504                    } else {
505                        args.push(ArgGroup::Rlibs(dir.to_owned(), vec![filename]));
506                    }
507                } else {
508                    args.push(ArgGroup::Regular(arg));
509                }
510            }
511            let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+\.rlib$").unwrap();
512            self.command.args(args.into_iter().map(|arg_group| {
513                match arg_group {
514                    // SAFETY: we are only matching on ASCII, not any surrogate pairs, so any replacements we do will still be valid.
515                    ArgGroup::Regular(arg) => unsafe {
516                        use bstr::ByteSlice;
517                        OsString::from_encoded_bytes_unchecked(
518                            arg.as_encoded_bytes().replace(
519                                self.sysroot_dir.as_os_str().as_encoded_bytes(),
520                                b"<sysroot>",
521                            ),
522                        )
523                    },
524                    ArgGroup::Objects(n) => OsString::from(format!("<{n} object files omitted>")),
525                    ArgGroup::Rlibs(mut dir, rlibs) => {
526                        let is_sysroot_dir = match dir.strip_prefix(&self.sysroot_dir) {
527                            Ok(short) => {
528                                dir = Path::new("<sysroot>").join(short);
529                                true
530                            }
531                            Err(_) => false,
532                        };
533                        let mut arg = dir.into_os_string();
534                        arg.push("/{");
535                        let mut first = true;
536                        for mut rlib in rlibs {
537                            if !first {
538                                arg.push(",");
539                            }
540                            first = false;
541                            if is_sysroot_dir {
542                                // SAFETY: Regex works one byte at a type, and our regex will not match surrogate pairs (because it only matches ascii).
543                                rlib = unsafe {
544                                    OsString::from_encoded_bytes_unchecked(
545                                        crate_hash
546                                            .replace(rlib.as_encoded_bytes(), b"-*")
547                                            .into_owned(),
548                                    )
549                                };
550                            }
551                            arg.push(rlib);
552                        }
553                        arg.push("}.rlib");
554                        arg
555                    }
556                }
557            }));
558
559            diag.note(format!("{:?}", self.command).trim_start_matches("env -i").to_owned());
560            diag.note("some arguments are omitted. use `--verbose` to show all linker arguments");
561        }
562
563        diag.note(self.escaped_output);
564
565        // Trying to match an error from OS linkers
566        // which by now we have no way to translate.
567        if contains_undefined_ref {
568            diag.note(fluent::codegen_ssa_extern_funcs_not_found)
569                .note(fluent::codegen_ssa_specify_libraries_to_link);
570
571            if rustc_session::utils::was_invoked_from_cargo() {
572                diag.note(fluent::codegen_ssa_use_cargo_directive);
573            }
574        }
575        diag
576    }
577}
578
579#[derive(Diagnostic)]
580#[diag(codegen_ssa_link_exe_unexpected_error)]
581pub(crate) struct LinkExeUnexpectedError;
582
583#[derive(Diagnostic)]
584#[diag(codegen_ssa_repair_vs_build_tools)]
585pub(crate) struct RepairVSBuildTools;
586
587#[derive(Diagnostic)]
588#[diag(codegen_ssa_missing_cpp_build_tool_component)]
589pub(crate) struct MissingCppBuildToolComponent;
590
591#[derive(Diagnostic)]
592#[diag(codegen_ssa_select_cpp_build_tool_workload)]
593pub(crate) struct SelectCppBuildToolWorkload;
594
595#[derive(Diagnostic)]
596#[diag(codegen_ssa_visual_studio_not_installed)]
597pub(crate) struct VisualStudioNotInstalled;
598
599#[derive(Diagnostic)]
600#[diag(codegen_ssa_linker_not_found)]
601#[note]
602pub(crate) struct LinkerNotFound {
603    pub linker_path: PathBuf,
604    pub error: Error,
605}
606
607#[derive(Diagnostic)]
608#[diag(codegen_ssa_unable_to_exe_linker)]
609#[note]
610#[note(codegen_ssa_command_note)]
611pub(crate) struct UnableToExeLinker {
612    pub linker_path: PathBuf,
613    pub error: Error,
614    pub command_formatted: String,
615}
616
617#[derive(Diagnostic)]
618#[diag(codegen_ssa_msvc_missing_linker)]
619pub(crate) struct MsvcMissingLinker;
620
621#[derive(Diagnostic)]
622#[diag(codegen_ssa_self_contained_linker_missing)]
623pub(crate) struct SelfContainedLinkerMissing;
624
625#[derive(Diagnostic)]
626#[diag(codegen_ssa_check_installed_visual_studio)]
627pub(crate) struct CheckInstalledVisualStudio;
628
629#[derive(Diagnostic)]
630#[diag(codegen_ssa_insufficient_vs_code_product)]
631pub(crate) struct InsufficientVSCodeProduct;
632
633#[derive(Diagnostic)]
634#[diag(codegen_ssa_cpu_required)]
635pub(crate) struct CpuRequired;
636
637#[derive(Diagnostic)]
638#[diag(codegen_ssa_processing_dymutil_failed)]
639#[note]
640pub(crate) struct ProcessingDymutilFailed {
641    pub status: ExitStatus,
642    pub output: String,
643}
644
645#[derive(Diagnostic)]
646#[diag(codegen_ssa_unable_to_run_dsymutil)]
647pub(crate) struct UnableToRunDsymutil {
648    pub error: Error,
649}
650
651#[derive(Diagnostic)]
652#[diag(codegen_ssa_stripping_debug_info_failed)]
653#[note]
654pub(crate) struct StrippingDebugInfoFailed<'a> {
655    pub util: &'a str,
656    pub status: ExitStatus,
657    pub output: String,
658}
659
660#[derive(Diagnostic)]
661#[diag(codegen_ssa_unable_to_run)]
662pub(crate) struct UnableToRun<'a> {
663    pub util: &'a str,
664    pub error: Error,
665}
666
667#[derive(Diagnostic)]
668#[diag(codegen_ssa_linker_file_stem)]
669pub(crate) struct LinkerFileStem;
670
671#[derive(Diagnostic)]
672#[diag(codegen_ssa_static_library_native_artifacts)]
673pub(crate) struct StaticLibraryNativeArtifacts;
674
675#[derive(Diagnostic)]
676#[diag(codegen_ssa_static_library_native_artifacts_to_file)]
677pub(crate) struct StaticLibraryNativeArtifactsToFile<'a> {
678    pub path: &'a Path,
679}
680
681#[derive(Diagnostic)]
682#[diag(codegen_ssa_link_script_unavailable)]
683pub(crate) struct LinkScriptUnavailable;
684
685#[derive(Diagnostic)]
686#[diag(codegen_ssa_link_script_write_failure)]
687pub(crate) struct LinkScriptWriteFailure {
688    pub path: PathBuf,
689    pub error: Error,
690}
691
692#[derive(Diagnostic)]
693#[diag(codegen_ssa_failed_to_write)]
694pub(crate) struct FailedToWrite {
695    pub path: PathBuf,
696    pub error: Error,
697}
698
699#[derive(Diagnostic)]
700#[diag(codegen_ssa_unable_to_write_debugger_visualizer)]
701pub(crate) struct UnableToWriteDebuggerVisualizer {
702    pub path: PathBuf,
703    pub error: Error,
704}
705
706#[derive(Diagnostic)]
707#[diag(codegen_ssa_rlib_archive_build_failure)]
708pub(crate) struct RlibArchiveBuildFailure {
709    pub path: PathBuf,
710    pub error: Error,
711}
712
713#[derive(Diagnostic)]
714// Public for rustc_codegen_llvm::back::archive
715pub enum ExtractBundledLibsError<'a> {
716    #[diag(codegen_ssa_extract_bundled_libs_open_file)]
717    OpenFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
718
719    #[diag(codegen_ssa_extract_bundled_libs_mmap_file)]
720    MmapFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
721
722    #[diag(codegen_ssa_extract_bundled_libs_parse_archive)]
723    ParseArchive { rlib: &'a Path, error: Box<dyn std::error::Error> },
724
725    #[diag(codegen_ssa_extract_bundled_libs_read_entry)]
726    ReadEntry { rlib: &'a Path, error: Box<dyn std::error::Error> },
727
728    #[diag(codegen_ssa_extract_bundled_libs_archive_member)]
729    ArchiveMember { rlib: &'a Path, error: Box<dyn std::error::Error> },
730
731    #[diag(codegen_ssa_extract_bundled_libs_convert_name)]
732    ConvertName { rlib: &'a Path, error: Box<dyn std::error::Error> },
733
734    #[diag(codegen_ssa_extract_bundled_libs_write_file)]
735    WriteFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
736
737    #[diag(codegen_ssa_extract_bundled_libs_write_file)]
738    ExtractSection { rlib: &'a Path, error: Box<dyn std::error::Error> },
739}
740
741#[derive(Diagnostic)]
742pub(crate) enum AppleDeploymentTarget {
743    #[diag(codegen_ssa_apple_deployment_target_invalid)]
744    Invalid { env_var: &'static str, error: ParseIntError },
745    #[diag(codegen_ssa_apple_deployment_target_too_low)]
746    TooLow { env_var: &'static str, version: String, os_min: String },
747}
748
749#[derive(Diagnostic)]
750#[diag(codegen_ssa_read_file)]
751pub(crate) struct ReadFileError {
752    pub message: std::io::Error,
753}
754
755#[derive(Diagnostic)]
756#[diag(codegen_ssa_unsupported_link_self_contained)]
757pub(crate) struct UnsupportedLinkSelfContained;
758
759#[derive(Diagnostic)]
760#[diag(codegen_ssa_archive_build_failure)]
761// Public for rustc_codegen_llvm::back::archive
762pub struct ArchiveBuildFailure {
763    pub path: PathBuf,
764    pub error: std::io::Error,
765}
766
767#[derive(Diagnostic)]
768#[diag(codegen_ssa_unknown_archive_kind)]
769// Public for rustc_codegen_llvm::back::archive
770pub struct UnknownArchiveKind<'a> {
771    pub kind: &'a str,
772}
773
774#[derive(Diagnostic)]
775#[diag(codegen_ssa_expected_used_symbol)]
776pub(crate) struct ExpectedUsedSymbol {
777    #[primary_span]
778    pub span: Span,
779}
780
781#[derive(Diagnostic)]
782#[diag(codegen_ssa_multiple_main_functions)]
783#[help]
784pub(crate) struct MultipleMainFunctions {
785    #[primary_span]
786    pub span: Span,
787}
788
789#[derive(Diagnostic)]
790#[diag(codegen_ssa_metadata_object_file_write)]
791pub(crate) struct MetadataObjectFileWrite {
792    pub error: Error,
793}
794
795#[derive(Diagnostic)]
796#[diag(codegen_ssa_invalid_windows_subsystem)]
797pub(crate) struct InvalidWindowsSubsystem {
798    pub subsystem: Symbol,
799}
800
801#[derive(Diagnostic)]
802#[diag(codegen_ssa_shuffle_indices_evaluation)]
803pub(crate) struct ShuffleIndicesEvaluation {
804    #[primary_span]
805    pub span: Span,
806}
807
808#[derive(Diagnostic)]
809#[diag(codegen_ssa_missing_memory_ordering)]
810pub(crate) struct MissingMemoryOrdering;
811
812#[derive(Diagnostic)]
813#[diag(codegen_ssa_unknown_atomic_ordering)]
814pub(crate) struct UnknownAtomicOrdering;
815
816#[derive(Diagnostic)]
817#[diag(codegen_ssa_atomic_compare_exchange)]
818pub(crate) struct AtomicCompareExchange;
819
820#[derive(Diagnostic)]
821#[diag(codegen_ssa_unknown_atomic_operation)]
822pub(crate) struct UnknownAtomicOperation;
823
824#[derive(Diagnostic)]
825pub enum InvalidMonomorphization<'tcx> {
826    #[diag(codegen_ssa_invalid_monomorphization_basic_integer_type, code = E0511)]
827    BasicIntegerType {
828        #[primary_span]
829        span: Span,
830        name: Symbol,
831        ty: Ty<'tcx>,
832    },
833
834    #[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = E0511)]
835    BasicFloatType {
836        #[primary_span]
837        span: Span,
838        name: Symbol,
839        ty: Ty<'tcx>,
840    },
841
842    #[diag(codegen_ssa_invalid_monomorphization_float_to_int_unchecked, code = E0511)]
843    FloatToIntUnchecked {
844        #[primary_span]
845        span: Span,
846        ty: Ty<'tcx>,
847    },
848
849    #[diag(codegen_ssa_invalid_monomorphization_floating_point_vector, code = E0511)]
850    FloatingPointVector {
851        #[primary_span]
852        span: Span,
853        name: Symbol,
854        f_ty: FloatTy,
855        in_ty: Ty<'tcx>,
856    },
857
858    #[diag(codegen_ssa_invalid_monomorphization_floating_point_type, code = E0511)]
859    FloatingPointType {
860        #[primary_span]
861        span: Span,
862        name: Symbol,
863        in_ty: Ty<'tcx>,
864    },
865
866    #[diag(codegen_ssa_invalid_monomorphization_unrecognized_intrinsic, code = E0511)]
867    UnrecognizedIntrinsic {
868        #[primary_span]
869        span: Span,
870        name: Symbol,
871    },
872
873    #[diag(codegen_ssa_invalid_monomorphization_simd_argument, code = E0511)]
874    SimdArgument {
875        #[primary_span]
876        span: Span,
877        name: Symbol,
878        ty: Ty<'tcx>,
879    },
880
881    #[diag(codegen_ssa_invalid_monomorphization_simd_input, code = E0511)]
882    SimdInput {
883        #[primary_span]
884        span: Span,
885        name: Symbol,
886        ty: Ty<'tcx>,
887    },
888
889    #[diag(codegen_ssa_invalid_monomorphization_simd_first, code = E0511)]
890    SimdFirst {
891        #[primary_span]
892        span: Span,
893        name: Symbol,
894        ty: Ty<'tcx>,
895    },
896
897    #[diag(codegen_ssa_invalid_monomorphization_simd_second, code = E0511)]
898    SimdSecond {
899        #[primary_span]
900        span: Span,
901        name: Symbol,
902        ty: Ty<'tcx>,
903    },
904
905    #[diag(codegen_ssa_invalid_monomorphization_simd_third, code = E0511)]
906    SimdThird {
907        #[primary_span]
908        span: Span,
909        name: Symbol,
910        ty: Ty<'tcx>,
911    },
912
913    #[diag(codegen_ssa_invalid_monomorphization_simd_return, code = E0511)]
914    SimdReturn {
915        #[primary_span]
916        span: Span,
917        name: Symbol,
918        ty: Ty<'tcx>,
919    },
920
921    #[diag(codegen_ssa_invalid_monomorphization_invalid_bitmask, code = E0511)]
922    InvalidBitmask {
923        #[primary_span]
924        span: Span,
925        name: Symbol,
926        mask_ty: Ty<'tcx>,
927        expected_int_bits: u64,
928        expected_bytes: u64,
929    },
930
931    #[diag(codegen_ssa_invalid_monomorphization_return_length_input_type, code = E0511)]
932    ReturnLengthInputType {
933        #[primary_span]
934        span: Span,
935        name: Symbol,
936        in_len: u64,
937        in_ty: Ty<'tcx>,
938        ret_ty: Ty<'tcx>,
939        out_len: u64,
940    },
941
942    #[diag(codegen_ssa_invalid_monomorphization_second_argument_length, code = E0511)]
943    SecondArgumentLength {
944        #[primary_span]
945        span: Span,
946        name: Symbol,
947        in_len: u64,
948        in_ty: Ty<'tcx>,
949        arg_ty: Ty<'tcx>,
950        out_len: u64,
951    },
952
953    #[diag(codegen_ssa_invalid_monomorphization_third_argument_length, code = E0511)]
954    ThirdArgumentLength {
955        #[primary_span]
956        span: Span,
957        name: Symbol,
958        in_len: u64,
959        in_ty: Ty<'tcx>,
960        arg_ty: Ty<'tcx>,
961        out_len: u64,
962    },
963
964    #[diag(codegen_ssa_invalid_monomorphization_return_integer_type, code = E0511)]
965    ReturnIntegerType {
966        #[primary_span]
967        span: Span,
968        name: Symbol,
969        ret_ty: Ty<'tcx>,
970        out_ty: Ty<'tcx>,
971    },
972
973    #[diag(codegen_ssa_invalid_monomorphization_simd_shuffle, code = E0511)]
974    SimdShuffle {
975        #[primary_span]
976        span: Span,
977        name: Symbol,
978        ty: Ty<'tcx>,
979    },
980
981    #[diag(codegen_ssa_invalid_monomorphization_return_length, code = E0511)]
982    ReturnLength {
983        #[primary_span]
984        span: Span,
985        name: Symbol,
986        in_len: u64,
987        ret_ty: Ty<'tcx>,
988        out_len: u64,
989    },
990
991    #[diag(codegen_ssa_invalid_monomorphization_return_element, code = E0511)]
992    ReturnElement {
993        #[primary_span]
994        span: Span,
995        name: Symbol,
996        in_elem: Ty<'tcx>,
997        in_ty: Ty<'tcx>,
998        ret_ty: Ty<'tcx>,
999        out_ty: Ty<'tcx>,
1000    },
1001
1002    #[diag(codegen_ssa_invalid_monomorphization_simd_index_out_of_bounds, code = E0511)]
1003    SimdIndexOutOfBounds {
1004        #[primary_span]
1005        span: Span,
1006        name: Symbol,
1007        arg_idx: u64,
1008        total_len: u128,
1009    },
1010
1011    #[diag(codegen_ssa_invalid_monomorphization_inserted_type, code = E0511)]
1012    InsertedType {
1013        #[primary_span]
1014        span: Span,
1015        name: Symbol,
1016        in_elem: Ty<'tcx>,
1017        in_ty: Ty<'tcx>,
1018        out_ty: Ty<'tcx>,
1019    },
1020
1021    #[diag(codegen_ssa_invalid_monomorphization_return_type, code = E0511)]
1022    ReturnType {
1023        #[primary_span]
1024        span: Span,
1025        name: Symbol,
1026        in_elem: Ty<'tcx>,
1027        in_ty: Ty<'tcx>,
1028        ret_ty: Ty<'tcx>,
1029    },
1030
1031    #[diag(codegen_ssa_invalid_monomorphization_expected_return_type, code = E0511)]
1032    ExpectedReturnType {
1033        #[primary_span]
1034        span: Span,
1035        name: Symbol,
1036        in_ty: Ty<'tcx>,
1037        ret_ty: Ty<'tcx>,
1038    },
1039
1040    #[diag(codegen_ssa_invalid_monomorphization_mismatched_lengths, code = E0511)]
1041    MismatchedLengths {
1042        #[primary_span]
1043        span: Span,
1044        name: Symbol,
1045        m_len: u64,
1046        v_len: u64,
1047    },
1048
1049    #[diag(codegen_ssa_invalid_monomorphization_mask_type, code = E0511)]
1050    #[note]
1051    MaskType {
1052        #[primary_span]
1053        span: Span,
1054        name: Symbol,
1055        ty: Ty<'tcx>,
1056    },
1057
1058    #[diag(codegen_ssa_invalid_monomorphization_vector_argument, code = E0511)]
1059    VectorArgument {
1060        #[primary_span]
1061        span: Span,
1062        name: Symbol,
1063        in_ty: Ty<'tcx>,
1064        in_elem: Ty<'tcx>,
1065    },
1066
1067    #[diag(codegen_ssa_invalid_monomorphization_cannot_return, code = E0511)]
1068    CannotReturn {
1069        #[primary_span]
1070        span: Span,
1071        name: Symbol,
1072        ret_ty: Ty<'tcx>,
1073        expected_int_bits: u64,
1074        expected_bytes: u64,
1075    },
1076
1077    #[diag(codegen_ssa_invalid_monomorphization_expected_element_type, code = E0511)]
1078    ExpectedElementType {
1079        #[primary_span]
1080        span: Span,
1081        name: Symbol,
1082        expected_element: Ty<'tcx>,
1083        second_arg: Ty<'tcx>,
1084        in_elem: Ty<'tcx>,
1085        in_ty: Ty<'tcx>,
1086        mutability: ExpectedPointerMutability,
1087    },
1088
1089    #[diag(codegen_ssa_invalid_monomorphization_third_arg_element_type, code = E0511)]
1090    ThirdArgElementType {
1091        #[primary_span]
1092        span: Span,
1093        name: Symbol,
1094        expected_element: Ty<'tcx>,
1095        third_arg: Ty<'tcx>,
1096    },
1097
1098    #[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size, code = E0511)]
1099    UnsupportedSymbolOfSize {
1100        #[primary_span]
1101        span: Span,
1102        name: Symbol,
1103        symbol: Symbol,
1104        in_ty: Ty<'tcx>,
1105        in_elem: Ty<'tcx>,
1106        size: u64,
1107        ret_ty: Ty<'tcx>,
1108    },
1109
1110    #[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol, code = E0511)]
1111    UnsupportedSymbol {
1112        #[primary_span]
1113        span: Span,
1114        name: Symbol,
1115        symbol: Symbol,
1116        in_ty: Ty<'tcx>,
1117        in_elem: Ty<'tcx>,
1118        ret_ty: Ty<'tcx>,
1119    },
1120
1121    #[diag(codegen_ssa_invalid_monomorphization_cast_wide_pointer, code = E0511)]
1122    CastWidePointer {
1123        #[primary_span]
1124        span: Span,
1125        name: Symbol,
1126        ty: Ty<'tcx>,
1127    },
1128
1129    #[diag(codegen_ssa_invalid_monomorphization_expected_pointer, code = E0511)]
1130    ExpectedPointer {
1131        #[primary_span]
1132        span: Span,
1133        name: Symbol,
1134        ty: Ty<'tcx>,
1135    },
1136
1137    #[diag(codegen_ssa_invalid_monomorphization_expected_usize, code = E0511)]
1138    ExpectedUsize {
1139        #[primary_span]
1140        span: Span,
1141        name: Symbol,
1142        ty: Ty<'tcx>,
1143    },
1144
1145    #[diag(codegen_ssa_invalid_monomorphization_unsupported_cast, code = E0511)]
1146    UnsupportedCast {
1147        #[primary_span]
1148        span: Span,
1149        name: Symbol,
1150        in_ty: Ty<'tcx>,
1151        in_elem: Ty<'tcx>,
1152        ret_ty: Ty<'tcx>,
1153        out_elem: Ty<'tcx>,
1154    },
1155
1156    #[diag(codegen_ssa_invalid_monomorphization_unsupported_operation, code = E0511)]
1157    UnsupportedOperation {
1158        #[primary_span]
1159        span: Span,
1160        name: Symbol,
1161        in_ty: Ty<'tcx>,
1162        in_elem: Ty<'tcx>,
1163    },
1164
1165    #[diag(codegen_ssa_invalid_monomorphization_expected_vector_element_type, code = E0511)]
1166    ExpectedVectorElementType {
1167        #[primary_span]
1168        span: Span,
1169        name: Symbol,
1170        expected_element: Ty<'tcx>,
1171        vector_type: Ty<'tcx>,
1172    },
1173}
1174
1175pub enum ExpectedPointerMutability {
1176    Mut,
1177    Not,
1178}
1179
1180impl IntoDiagArg for ExpectedPointerMutability {
1181    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
1182        match self {
1183            ExpectedPointerMutability::Mut => DiagArgValue::Str(Cow::Borrowed("*mut")),
1184            ExpectedPointerMutability::Not => DiagArgValue::Str(Cow::Borrowed("*_")),
1185        }
1186    }
1187}
1188
1189#[derive(Diagnostic)]
1190#[diag(codegen_ssa_invalid_no_sanitize)]
1191#[note]
1192pub(crate) struct InvalidNoSanitize {
1193    #[primary_span]
1194    pub span: Span,
1195}
1196
1197#[derive(Diagnostic)]
1198#[diag(codegen_ssa_invalid_link_ordinal_nargs)]
1199#[note]
1200pub(crate) struct InvalidLinkOrdinalNargs {
1201    #[primary_span]
1202    pub span: Span,
1203}
1204
1205#[derive(Diagnostic)]
1206#[diag(codegen_ssa_illegal_link_ordinal_format)]
1207#[note]
1208pub(crate) struct InvalidLinkOrdinalFormat {
1209    #[primary_span]
1210    pub span: Span,
1211}
1212
1213#[derive(Diagnostic)]
1214#[diag(codegen_ssa_target_feature_safe_trait)]
1215pub(crate) struct TargetFeatureSafeTrait {
1216    #[primary_span]
1217    #[label]
1218    pub span: Span,
1219    #[label(codegen_ssa_label_def)]
1220    pub def: Span,
1221}
1222
1223#[derive(Diagnostic)]
1224#[diag(codegen_ssa_forbidden_target_feature_attr)]
1225pub struct ForbiddenTargetFeatureAttr<'a> {
1226    #[primary_span]
1227    pub span: Span,
1228    pub feature: &'a str,
1229    pub reason: &'a str,
1230}
1231
1232#[derive(Diagnostic)]
1233#[diag(codegen_ssa_failed_to_get_layout)]
1234pub struct FailedToGetLayout<'tcx> {
1235    #[primary_span]
1236    pub span: Span,
1237    pub ty: Ty<'tcx>,
1238    pub err: LayoutError<'tcx>,
1239}
1240
1241#[derive(Diagnostic)]
1242#[diag(codegen_ssa_dlltool_fail_import_library)]
1243pub(crate) struct DlltoolFailImportLibrary<'a> {
1244    pub dlltool_path: Cow<'a, str>,
1245    pub dlltool_args: String,
1246    pub stdout: Cow<'a, str>,
1247    pub stderr: Cow<'a, str>,
1248}
1249
1250#[derive(Diagnostic)]
1251#[diag(codegen_ssa_error_writing_def_file)]
1252pub(crate) struct ErrorWritingDEFFile {
1253    pub error: std::io::Error,
1254}
1255
1256#[derive(Diagnostic)]
1257#[diag(codegen_ssa_error_calling_dlltool)]
1258pub(crate) struct ErrorCallingDllTool<'a> {
1259    pub dlltool_path: Cow<'a, str>,
1260    pub error: std::io::Error,
1261}
1262
1263#[derive(Diagnostic)]
1264#[diag(codegen_ssa_error_creating_remark_dir)]
1265pub(crate) struct ErrorCreatingRemarkDir {
1266    pub error: std::io::Error,
1267}
1268
1269#[derive(Diagnostic)]
1270#[diag(codegen_ssa_compiler_builtins_cannot_call)]
1271pub struct CompilerBuiltinsCannotCall {
1272    pub caller: String,
1273    pub callee: String,
1274    #[primary_span]
1275    pub span: Span,
1276}
1277
1278#[derive(Diagnostic)]
1279#[diag(codegen_ssa_error_creating_import_library)]
1280pub(crate) struct ErrorCreatingImportLibrary<'a> {
1281    pub lib_name: &'a str,
1282    pub error: String,
1283}
1284
1285pub struct TargetFeatureDisableOrEnable<'a> {
1286    pub features: &'a [&'a str],
1287    pub span: Option<Span>,
1288    pub missing_features: Option<MissingFeatures>,
1289}
1290
1291#[derive(Subdiagnostic)]
1292#[help(codegen_ssa_missing_features)]
1293pub struct MissingFeatures;
1294
1295impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
1296    fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
1297        let mut diag = Diag::new(dcx, level, fluent::codegen_ssa_target_feature_disable_or_enable);
1298        if let Some(span) = self.span {
1299            diag.span(span);
1300        };
1301        if let Some(missing_features) = self.missing_features {
1302            diag.subdiagnostic(missing_features);
1303        }
1304        diag.arg("features", self.features.join(", "));
1305        diag
1306    }
1307}
1308
1309#[derive(Diagnostic)]
1310#[diag(codegen_ssa_aix_strip_not_used)]
1311pub(crate) struct AixStripNotUsed;
1312
1313#[derive(LintDiagnostic)]
1314#[diag(codegen_ssa_mixed_export_name_and_no_mangle)]
1315pub(crate) struct MixedExportNameAndNoMangle {
1316    #[label]
1317    pub no_mangle: Span,
1318    pub no_mangle_attr: String,
1319    #[note]
1320    pub export_name: Span,
1321    #[suggestion(style = "verbose", code = "", applicability = "machine-applicable")]
1322    pub removal_span: Span,
1323}
1324
1325#[derive(Diagnostic, Debug)]
1326pub(crate) enum XcrunError {
1327    #[diag(codegen_ssa_xcrun_failed_invoking)]
1328    FailedInvoking { sdk_name: &'static str, command_formatted: String, error: std::io::Error },
1329
1330    #[diag(codegen_ssa_xcrun_unsuccessful)]
1331    #[note]
1332    Unsuccessful {
1333        sdk_name: &'static str,
1334        command_formatted: String,
1335        stdout: String,
1336        stderr: String,
1337    },
1338}
1339
1340#[derive(Diagnostic, Debug)]
1341#[diag(codegen_ssa_xcrun_sdk_path_warning)]
1342#[note]
1343pub(crate) struct XcrunSdkPathWarning {
1344    pub sdk_name: &'static str,
1345    pub stderr: String,
1346}