1 //! Errors emitted by codegen_ssa 2 3 use crate::back::command::Command; 4 use crate::fluent_generated as fluent; 5 use rustc_errors::{ 6 DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, 7 IntoDiagnosticArg, 8 }; 9 use rustc_macros::Diagnostic; 10 use rustc_middle::ty::Ty; 11 use rustc_span::{Span, Symbol}; 12 use rustc_type_ir::FloatTy; 13 use std::borrow::Cow; 14 use std::io::Error; 15 use std::path::{Path, PathBuf}; 16 use std::process::ExitStatus; 17 18 #[derive(Diagnostic)] 19 #[diag(codegen_ssa_lib_def_write_failure)] 20 pub struct LibDefWriteFailure { 21 pub error: Error, 22 } 23 24 #[derive(Diagnostic)] 25 #[diag(codegen_ssa_version_script_write_failure)] 26 pub struct VersionScriptWriteFailure { 27 pub error: Error, 28 } 29 30 #[derive(Diagnostic)] 31 #[diag(codegen_ssa_symbol_file_write_failure)] 32 pub struct SymbolFileWriteFailure { 33 pub error: Error, 34 } 35 36 #[derive(Diagnostic)] 37 #[diag(codegen_ssa_ld64_unimplemented_modifier)] 38 pub struct Ld64UnimplementedModifier; 39 40 #[derive(Diagnostic)] 41 #[diag(codegen_ssa_linker_unsupported_modifier)] 42 pub struct LinkerUnsupportedModifier; 43 44 #[derive(Diagnostic)] 45 #[diag(codegen_ssa_L4Bender_exporting_symbols_unimplemented)] 46 pub struct L4BenderExportingSymbolsUnimplemented; 47 48 #[derive(Diagnostic)] 49 #[diag(codegen_ssa_no_natvis_directory)] 50 pub struct NoNatvisDirectory { 51 pub error: Error, 52 } 53 54 #[derive(Diagnostic)] 55 #[diag(codegen_ssa_copy_path_buf)] 56 pub struct CopyPathBuf { 57 pub source_file: PathBuf, 58 pub output_path: PathBuf, 59 pub error: Error, 60 } 61 62 // Reports Paths using `Debug` implementation rather than Path's `Display` implementation. 63 #[derive(Diagnostic)] 64 #[diag(codegen_ssa_copy_path)] 65 pub struct CopyPath<'a> { 66 from: DebugArgPath<'a>, 67 to: DebugArgPath<'a>, 68 error: Error, 69 } 70 71 impl<'a> CopyPath<'a> { new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a>72 pub fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> { 73 CopyPath { from: DebugArgPath(from), to: DebugArgPath(to), error } 74 } 75 } 76 77 struct DebugArgPath<'a>(pub &'a Path); 78 79 impl IntoDiagnosticArg for DebugArgPath<'_> { into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static>80 fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { 81 DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.0))) 82 } 83 } 84 85 #[derive(Diagnostic)] 86 #[diag(codegen_ssa_binary_output_to_tty)] 87 pub struct BinaryOutputToTty { 88 pub shorthand: &'static str, 89 } 90 91 #[derive(Diagnostic)] 92 #[diag(codegen_ssa_ignoring_emit_path)] 93 pub struct IgnoringEmitPath { 94 pub extension: String, 95 } 96 97 #[derive(Diagnostic)] 98 #[diag(codegen_ssa_ignoring_output)] 99 pub struct IgnoringOutput { 100 pub extension: String, 101 } 102 103 #[derive(Diagnostic)] 104 #[diag(codegen_ssa_create_temp_dir)] 105 pub struct CreateTempDir { 106 pub error: Error, 107 } 108 109 #[derive(Diagnostic)] 110 #[diag(codegen_ssa_incompatible_linking_modifiers)] 111 pub struct IncompatibleLinkingModifiers; 112 113 #[derive(Diagnostic)] 114 #[diag(codegen_ssa_add_native_library)] 115 pub struct AddNativeLibrary { 116 pub library_path: PathBuf, 117 pub error: Error, 118 } 119 120 #[derive(Diagnostic)] 121 #[diag(codegen_ssa_multiple_external_func_decl)] 122 pub struct MultipleExternalFuncDecl<'a> { 123 #[primary_span] 124 pub span: Span, 125 pub function: Symbol, 126 pub library_name: &'a str, 127 } 128 129 #[derive(Diagnostic)] 130 pub enum LinkRlibError { 131 #[diag(codegen_ssa_rlib_missing_format)] 132 MissingFormat, 133 134 #[diag(codegen_ssa_rlib_only_rmeta_found)] 135 OnlyRmetaFound { crate_name: Symbol }, 136 137 #[diag(codegen_ssa_rlib_not_found)] 138 NotFound { crate_name: Symbol }, 139 140 #[diag(codegen_ssa_rlib_incompatible_dependency_formats)] 141 IncompatibleDependencyFormats { ty1: String, ty2: String, list1: String, list2: String }, 142 } 143 144 pub struct ThorinErrorWrapper(pub thorin::Error); 145 146 impl IntoDiagnostic<'_> for ThorinErrorWrapper { into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed>147 fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> { 148 let mut diag; 149 match self.0 { 150 thorin::Error::ReadInput(_) => { 151 diag = handler.struct_err(fluent::codegen_ssa_thorin_read_input_failure); 152 diag 153 } 154 thorin::Error::ParseFileKind(_) => { 155 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_file_kind); 156 diag 157 } 158 thorin::Error::ParseObjectFile(_) => { 159 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_object_file); 160 diag 161 } 162 thorin::Error::ParseArchiveFile(_) => { 163 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_input_archive_file); 164 diag 165 } 166 thorin::Error::ParseArchiveMember(_) => { 167 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_archive_member); 168 diag 169 } 170 thorin::Error::InvalidInputKind => { 171 diag = handler.struct_err(fluent::codegen_ssa_thorin_invalid_input_kind); 172 diag 173 } 174 thorin::Error::DecompressData(_) => { 175 diag = handler.struct_err(fluent::codegen_ssa_thorin_decompress_data); 176 diag 177 } 178 thorin::Error::NamelessSection(_, offset) => { 179 diag = handler.struct_err(fluent::codegen_ssa_thorin_section_without_name); 180 diag.set_arg("offset", format!("0x{:08x}", offset)); 181 diag 182 } 183 thorin::Error::RelocationWithInvalidSymbol(section, offset) => { 184 diag = 185 handler.struct_err(fluent::codegen_ssa_thorin_relocation_with_invalid_symbol); 186 diag.set_arg("section", section); 187 diag.set_arg("offset", format!("0x{:08x}", offset)); 188 diag 189 } 190 thorin::Error::MultipleRelocations(section, offset) => { 191 diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_relocations); 192 diag.set_arg("section", section); 193 diag.set_arg("offset", format!("0x{:08x}", offset)); 194 diag 195 } 196 thorin::Error::UnsupportedRelocation(section, offset) => { 197 diag = handler.struct_err(fluent::codegen_ssa_thorin_unsupported_relocation); 198 diag.set_arg("section", section); 199 diag.set_arg("offset", format!("0x{:08x}", offset)); 200 diag 201 } 202 thorin::Error::MissingDwoName(id) => { 203 diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_dwo_name); 204 diag.set_arg("id", format!("0x{:08x}", id)); 205 diag 206 } 207 thorin::Error::NoCompilationUnits => { 208 diag = handler.struct_err(fluent::codegen_ssa_thorin_no_compilation_units); 209 diag 210 } 211 thorin::Error::NoDie => { 212 diag = handler.struct_err(fluent::codegen_ssa_thorin_no_die); 213 diag 214 } 215 thorin::Error::TopLevelDieNotUnit => { 216 diag = handler.struct_err(fluent::codegen_ssa_thorin_top_level_die_not_unit); 217 diag 218 } 219 thorin::Error::MissingRequiredSection(section) => { 220 diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_required_section); 221 diag.set_arg("section", section); 222 diag 223 } 224 thorin::Error::ParseUnitAbbreviations(_) => { 225 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_abbreviations); 226 diag 227 } 228 thorin::Error::ParseUnitAttribute(_) => { 229 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_attribute); 230 diag 231 } 232 thorin::Error::ParseUnitHeader(_) => { 233 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit_header); 234 diag 235 } 236 thorin::Error::ParseUnit(_) => { 237 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_unit); 238 diag 239 } 240 thorin::Error::IncompatibleIndexVersion(section, format, actual) => { 241 diag = handler.struct_err(fluent::codegen_ssa_thorin_incompatible_index_version); 242 diag.set_arg("section", section); 243 diag.set_arg("actual", actual); 244 diag.set_arg("format", format); 245 diag 246 } 247 thorin::Error::OffsetAtIndex(_, index) => { 248 diag = handler.struct_err(fluent::codegen_ssa_thorin_offset_at_index); 249 diag.set_arg("index", index); 250 diag 251 } 252 thorin::Error::StrAtOffset(_, offset) => { 253 diag = handler.struct_err(fluent::codegen_ssa_thorin_str_at_offset); 254 diag.set_arg("offset", format!("0x{:08x}", offset)); 255 diag 256 } 257 thorin::Error::ParseIndex(_, section) => { 258 diag = handler.struct_err(fluent::codegen_ssa_thorin_parse_index); 259 diag.set_arg("section", section); 260 diag 261 } 262 thorin::Error::UnitNotInIndex(unit) => { 263 diag = handler.struct_err(fluent::codegen_ssa_thorin_unit_not_in_index); 264 diag.set_arg("unit", format!("0x{:08x}", unit)); 265 diag 266 } 267 thorin::Error::RowNotInIndex(_, row) => { 268 diag = handler.struct_err(fluent::codegen_ssa_thorin_row_not_in_index); 269 diag.set_arg("row", row); 270 diag 271 } 272 thorin::Error::SectionNotInRow => { 273 diag = handler.struct_err(fluent::codegen_ssa_thorin_section_not_in_row); 274 diag 275 } 276 thorin::Error::EmptyUnit(unit) => { 277 diag = handler.struct_err(fluent::codegen_ssa_thorin_empty_unit); 278 diag.set_arg("unit", format!("0x{:08x}", unit)); 279 diag 280 } 281 thorin::Error::MultipleDebugInfoSection => { 282 diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_debug_info_section); 283 diag 284 } 285 thorin::Error::MultipleDebugTypesSection => { 286 diag = handler.struct_err(fluent::codegen_ssa_thorin_multiple_debug_types_section); 287 diag 288 } 289 thorin::Error::NotSplitUnit => { 290 diag = handler.struct_err(fluent::codegen_ssa_thorin_not_split_unit); 291 diag 292 } 293 thorin::Error::DuplicateUnit(unit) => { 294 diag = handler.struct_err(fluent::codegen_ssa_thorin_duplicate_unit); 295 diag.set_arg("unit", format!("0x{:08x}", unit)); 296 diag 297 } 298 thorin::Error::MissingReferencedUnit(unit) => { 299 diag = handler.struct_err(fluent::codegen_ssa_thorin_missing_referenced_unit); 300 diag.set_arg("unit", format!("0x{:08x}", unit)); 301 diag 302 } 303 thorin::Error::NoOutputObjectCreated => { 304 diag = handler.struct_err(fluent::codegen_ssa_thorin_not_output_object_created); 305 diag 306 } 307 thorin::Error::MixedInputEncodings => { 308 diag = handler.struct_err(fluent::codegen_ssa_thorin_mixed_input_encodings); 309 diag 310 } 311 thorin::Error::Io(e) => { 312 diag = handler.struct_err(fluent::codegen_ssa_thorin_io); 313 diag.set_arg("error", format!("{e}")); 314 diag 315 } 316 thorin::Error::ObjectRead(e) => { 317 diag = handler.struct_err(fluent::codegen_ssa_thorin_object_read); 318 diag.set_arg("error", format!("{e}")); 319 diag 320 } 321 thorin::Error::ObjectWrite(e) => { 322 diag = handler.struct_err(fluent::codegen_ssa_thorin_object_write); 323 diag.set_arg("error", format!("{e}")); 324 diag 325 } 326 thorin::Error::GimliRead(e) => { 327 diag = handler.struct_err(fluent::codegen_ssa_thorin_gimli_read); 328 diag.set_arg("error", format!("{e}")); 329 diag 330 } 331 thorin::Error::GimliWrite(e) => { 332 diag = handler.struct_err(fluent::codegen_ssa_thorin_gimli_write); 333 diag.set_arg("error", format!("{e}")); 334 diag 335 } 336 _ => unimplemented!("Untranslated thorin error"), 337 } 338 } 339 } 340 341 pub struct LinkingFailed<'a> { 342 pub linker_path: &'a PathBuf, 343 pub exit_status: ExitStatus, 344 pub command: &'a Command, 345 pub escaped_output: String, 346 } 347 348 impl IntoDiagnostic<'_> for LinkingFailed<'_> { into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed>349 fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, ErrorGuaranteed> { 350 let mut diag = handler.struct_err(fluent::codegen_ssa_linking_failed); 351 diag.set_arg("linker_path", format!("{}", self.linker_path.display())); 352 diag.set_arg("exit_status", format!("{}", self.exit_status)); 353 354 let contains_undefined_ref = self.escaped_output.contains("undefined reference to"); 355 356 diag.note(format!("{:?}", self.command)).note(self.escaped_output.to_string()); 357 358 // Trying to match an error from OS linkers 359 // which by now we have no way to translate. 360 if contains_undefined_ref { 361 diag.note(fluent::codegen_ssa_extern_funcs_not_found) 362 .note(fluent::codegen_ssa_specify_libraries_to_link) 363 .note(fluent::codegen_ssa_use_cargo_directive); 364 } 365 diag 366 } 367 } 368 369 #[derive(Diagnostic)] 370 #[diag(codegen_ssa_link_exe_unexpected_error)] 371 pub struct LinkExeUnexpectedError; 372 373 #[derive(Diagnostic)] 374 #[diag(codegen_ssa_repair_vs_build_tools)] 375 pub struct RepairVSBuildTools; 376 377 #[derive(Diagnostic)] 378 #[diag(codegen_ssa_missing_cpp_build_tool_component)] 379 pub struct MissingCppBuildToolComponent; 380 381 #[derive(Diagnostic)] 382 #[diag(codegen_ssa_select_cpp_build_tool_workload)] 383 pub struct SelectCppBuildToolWorkload; 384 385 #[derive(Diagnostic)] 386 #[diag(codegen_ssa_visual_studio_not_installed)] 387 pub struct VisualStudioNotInstalled; 388 389 #[derive(Diagnostic)] 390 #[diag(codegen_ssa_linker_not_found)] 391 #[note] 392 pub struct LinkerNotFound { 393 pub linker_path: PathBuf, 394 pub error: Error, 395 } 396 397 #[derive(Diagnostic)] 398 #[diag(codegen_ssa_unable_to_exe_linker)] 399 #[note] 400 #[note(codegen_ssa_command_note)] 401 pub struct UnableToExeLinker { 402 pub linker_path: PathBuf, 403 pub error: Error, 404 pub command_formatted: String, 405 } 406 407 #[derive(Diagnostic)] 408 #[diag(codegen_ssa_msvc_missing_linker)] 409 pub struct MsvcMissingLinker; 410 411 #[derive(Diagnostic)] 412 #[diag(codegen_ssa_check_installed_visual_studio)] 413 pub struct CheckInstalledVisualStudio; 414 415 #[derive(Diagnostic)] 416 #[diag(codegen_ssa_insufficient_vs_code_product)] 417 pub struct InsufficientVSCodeProduct; 418 419 #[derive(Diagnostic)] 420 #[diag(codegen_ssa_processing_dymutil_failed)] 421 #[note] 422 pub struct ProcessingDymutilFailed { 423 pub status: ExitStatus, 424 pub output: String, 425 } 426 427 #[derive(Diagnostic)] 428 #[diag(codegen_ssa_unable_to_run_dsymutil)] 429 #[note] 430 pub struct UnableToRunDsymutil { 431 pub error: Error, 432 } 433 434 #[derive(Diagnostic)] 435 #[diag(codegen_ssa_stripping_debug_info_failed)] 436 #[note] 437 pub struct StrippingDebugInfoFailed<'a> { 438 pub util: &'a str, 439 pub status: ExitStatus, 440 pub output: String, 441 } 442 443 #[derive(Diagnostic)] 444 #[diag(codegen_ssa_unable_to_run)] 445 pub struct UnableToRun<'a> { 446 pub util: &'a str, 447 pub error: Error, 448 } 449 450 #[derive(Diagnostic)] 451 #[diag(codegen_ssa_linker_file_stem)] 452 pub struct LinkerFileStem; 453 454 #[derive(Diagnostic)] 455 #[diag(codegen_ssa_static_library_native_artifacts)] 456 pub struct StaticLibraryNativeArtifacts; 457 458 #[derive(Diagnostic)] 459 #[diag(codegen_ssa_link_script_unavailable)] 460 pub struct LinkScriptUnavailable; 461 462 #[derive(Diagnostic)] 463 #[diag(codegen_ssa_link_script_write_failure)] 464 pub struct LinkScriptWriteFailure { 465 pub path: PathBuf, 466 pub error: Error, 467 } 468 469 #[derive(Diagnostic)] 470 #[diag(codegen_ssa_failed_to_write)] 471 pub struct FailedToWrite { 472 pub path: PathBuf, 473 pub error: Error, 474 } 475 476 #[derive(Diagnostic)] 477 #[diag(codegen_ssa_unable_to_write_debugger_visualizer)] 478 pub struct UnableToWriteDebuggerVisualizer { 479 pub path: PathBuf, 480 pub error: Error, 481 } 482 483 #[derive(Diagnostic)] 484 #[diag(codegen_ssa_rlib_archive_build_failure)] 485 pub struct RlibArchiveBuildFailure { 486 pub error: Error, 487 } 488 489 #[derive(Diagnostic)] 490 #[diag(codegen_ssa_option_gcc_only)] 491 pub struct OptionGccOnly; 492 493 #[derive(Diagnostic)] 494 pub enum ExtractBundledLibsError<'a> { 495 #[diag(codegen_ssa_extract_bundled_libs_open_file)] 496 OpenFile { rlib: &'a Path, error: Box<dyn std::error::Error> }, 497 498 #[diag(codegen_ssa_extract_bundled_libs_mmap_file)] 499 MmapFile { rlib: &'a Path, error: Box<dyn std::error::Error> }, 500 501 #[diag(codegen_ssa_extract_bundled_libs_parse_archive)] 502 ParseArchive { rlib: &'a Path, error: Box<dyn std::error::Error> }, 503 504 #[diag(codegen_ssa_extract_bundled_libs_read_entry)] 505 ReadEntry { rlib: &'a Path, error: Box<dyn std::error::Error> }, 506 507 #[diag(codegen_ssa_extract_bundled_libs_archive_member)] 508 ArchiveMember { rlib: &'a Path, error: Box<dyn std::error::Error> }, 509 510 #[diag(codegen_ssa_extract_bundled_libs_convert_name)] 511 ConvertName { rlib: &'a Path, error: Box<dyn std::error::Error> }, 512 513 #[diag(codegen_ssa_extract_bundled_libs_write_file)] 514 WriteFile { rlib: &'a Path, error: Box<dyn std::error::Error> }, 515 516 #[diag(codegen_ssa_extract_bundled_libs_write_file)] 517 ExtractSection { rlib: &'a Path, error: Box<dyn std::error::Error> }, 518 } 519 520 #[derive(Diagnostic)] 521 #[diag(codegen_ssa_unsupported_arch)] 522 pub struct UnsupportedArch<'a> { 523 pub arch: &'a str, 524 pub os: &'a str, 525 } 526 527 #[derive(Diagnostic)] 528 pub enum AppleSdkRootError<'a> { 529 #[diag(codegen_ssa_apple_sdk_error_sdk_path)] 530 SdkPath { sdk_name: &'a str, error: Error }, 531 } 532 533 #[derive(Diagnostic)] 534 #[diag(codegen_ssa_read_file)] 535 pub struct ReadFileError { 536 pub message: std::io::Error, 537 } 538 539 #[derive(Diagnostic)] 540 #[diag(codegen_ssa_unsupported_link_self_contained)] 541 pub struct UnsupportedLinkSelfContained; 542 543 #[derive(Diagnostic)] 544 #[diag(codegen_ssa_archive_build_failure)] 545 // Public for rustc_codegen_llvm::back::archive 546 pub struct ArchiveBuildFailure { 547 pub error: std::io::Error, 548 } 549 550 #[derive(Diagnostic)] 551 #[diag(codegen_ssa_unknown_archive_kind)] 552 // Public for rustc_codegen_llvm::back::archive 553 pub struct UnknownArchiveKind<'a> { 554 pub kind: &'a str, 555 } 556 557 #[derive(Diagnostic)] 558 #[diag(codegen_ssa_expected_used_symbol)] 559 pub struct ExpectedUsedSymbol { 560 #[primary_span] 561 pub span: Span, 562 } 563 564 #[derive(Diagnostic)] 565 #[diag(codegen_ssa_multiple_main_functions)] 566 #[help] 567 pub struct MultipleMainFunctions { 568 #[primary_span] 569 pub span: Span, 570 } 571 572 #[derive(Diagnostic)] 573 #[diag(codegen_ssa_metadata_object_file_write)] 574 pub struct MetadataObjectFileWrite { 575 pub error: Error, 576 } 577 578 #[derive(Diagnostic)] 579 #[diag(codegen_ssa_invalid_windows_subsystem)] 580 pub struct InvalidWindowsSubsystem { 581 pub subsystem: Symbol, 582 } 583 584 #[derive(Diagnostic)] 585 #[diag(codegen_ssa_erroneous_constant)] 586 pub struct ErroneousConstant { 587 #[primary_span] 588 pub span: Span, 589 } 590 591 #[derive(Diagnostic)] 592 #[diag(codegen_ssa_polymorphic_constant_too_generic)] 593 pub struct PolymorphicConstantTooGeneric { 594 #[primary_span] 595 pub span: Span, 596 } 597 598 #[derive(Diagnostic)] 599 #[diag(codegen_ssa_shuffle_indices_evaluation)] 600 pub struct ShuffleIndicesEvaluation { 601 #[primary_span] 602 pub span: Span, 603 } 604 605 #[derive(Diagnostic)] 606 #[diag(codegen_ssa_missing_memory_ordering)] 607 pub struct MissingMemoryOrdering; 608 609 #[derive(Diagnostic)] 610 #[diag(codegen_ssa_unknown_atomic_ordering)] 611 pub struct UnknownAtomicOrdering; 612 613 #[derive(Diagnostic)] 614 #[diag(codegen_ssa_atomic_compare_exchange)] 615 pub struct AtomicCompareExchange; 616 617 #[derive(Diagnostic)] 618 #[diag(codegen_ssa_unknown_atomic_operation)] 619 pub struct UnknownAtomicOperation; 620 621 #[derive(Diagnostic)] 622 pub enum InvalidMonomorphization<'tcx> { 623 #[diag(codegen_ssa_invalid_monomorphization_basic_integer_type, code = "E0511")] 624 BasicIntegerType { 625 #[primary_span] 626 span: Span, 627 name: Symbol, 628 ty: Ty<'tcx>, 629 }, 630 631 #[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = "E0511")] 632 BasicFloatType { 633 #[primary_span] 634 span: Span, 635 name: Symbol, 636 ty: Ty<'tcx>, 637 }, 638 639 #[diag(codegen_ssa_invalid_monomorphization_float_to_int_unchecked, code = "E0511")] 640 FloatToIntUnchecked { 641 #[primary_span] 642 span: Span, 643 ty: Ty<'tcx>, 644 }, 645 646 #[diag(codegen_ssa_invalid_monomorphization_floating_point_vector, code = "E0511")] 647 FloatingPointVector { 648 #[primary_span] 649 span: Span, 650 name: Symbol, 651 f_ty: FloatTy, 652 in_ty: Ty<'tcx>, 653 }, 654 655 #[diag(codegen_ssa_invalid_monomorphization_floating_point_type, code = "E0511")] 656 FloatingPointType { 657 #[primary_span] 658 span: Span, 659 name: Symbol, 660 in_ty: Ty<'tcx>, 661 }, 662 663 #[diag(codegen_ssa_invalid_monomorphization_unrecognized_intrinsic, code = "E0511")] 664 UnrecognizedIntrinsic { 665 #[primary_span] 666 span: Span, 667 name: Symbol, 668 }, 669 670 #[diag(codegen_ssa_invalid_monomorphization_simd_argument, code = "E0511")] 671 SimdArgument { 672 #[primary_span] 673 span: Span, 674 name: Symbol, 675 ty: Ty<'tcx>, 676 }, 677 678 #[diag(codegen_ssa_invalid_monomorphization_simd_input, code = "E0511")] 679 SimdInput { 680 #[primary_span] 681 span: Span, 682 name: Symbol, 683 ty: Ty<'tcx>, 684 }, 685 686 #[diag(codegen_ssa_invalid_monomorphization_simd_first, code = "E0511")] 687 SimdFirst { 688 #[primary_span] 689 span: Span, 690 name: Symbol, 691 ty: Ty<'tcx>, 692 }, 693 694 #[diag(codegen_ssa_invalid_monomorphization_simd_second, code = "E0511")] 695 SimdSecond { 696 #[primary_span] 697 span: Span, 698 name: Symbol, 699 ty: Ty<'tcx>, 700 }, 701 702 #[diag(codegen_ssa_invalid_monomorphization_simd_third, code = "E0511")] 703 SimdThird { 704 #[primary_span] 705 span: Span, 706 name: Symbol, 707 ty: Ty<'tcx>, 708 }, 709 710 #[diag(codegen_ssa_invalid_monomorphization_simd_return, code = "E0511")] 711 SimdReturn { 712 #[primary_span] 713 span: Span, 714 name: Symbol, 715 ty: Ty<'tcx>, 716 }, 717 718 #[diag(codegen_ssa_invalid_monomorphization_invalid_bitmask, code = "E0511")] 719 InvalidBitmask { 720 #[primary_span] 721 span: Span, 722 name: Symbol, 723 mask_ty: Ty<'tcx>, 724 expected_int_bits: u64, 725 expected_bytes: u64, 726 }, 727 728 #[diag(codegen_ssa_invalid_monomorphization_return_length_input_type, code = "E0511")] 729 ReturnLengthInputType { 730 #[primary_span] 731 span: Span, 732 name: Symbol, 733 in_len: u64, 734 in_ty: Ty<'tcx>, 735 ret_ty: Ty<'tcx>, 736 out_len: u64, 737 }, 738 739 #[diag(codegen_ssa_invalid_monomorphization_second_argument_length, code = "E0511")] 740 SecondArgumentLength { 741 #[primary_span] 742 span: Span, 743 name: Symbol, 744 in_len: u64, 745 in_ty: Ty<'tcx>, 746 arg_ty: Ty<'tcx>, 747 out_len: u64, 748 }, 749 750 #[diag(codegen_ssa_invalid_monomorphization_third_argument_length, code = "E0511")] 751 ThirdArgumentLength { 752 #[primary_span] 753 span: Span, 754 name: Symbol, 755 in_len: u64, 756 in_ty: Ty<'tcx>, 757 arg_ty: Ty<'tcx>, 758 out_len: u64, 759 }, 760 761 #[diag(codegen_ssa_invalid_monomorphization_return_integer_type, code = "E0511")] 762 ReturnIntegerType { 763 #[primary_span] 764 span: Span, 765 name: Symbol, 766 ret_ty: Ty<'tcx>, 767 out_ty: Ty<'tcx>, 768 }, 769 770 #[diag(codegen_ssa_invalid_monomorphization_simd_shuffle, code = "E0511")] 771 SimdShuffle { 772 #[primary_span] 773 span: Span, 774 name: Symbol, 775 ty: Ty<'tcx>, 776 }, 777 778 #[diag(codegen_ssa_invalid_monomorphization_return_length, code = "E0511")] 779 ReturnLength { 780 #[primary_span] 781 span: Span, 782 name: Symbol, 783 in_len: u64, 784 ret_ty: Ty<'tcx>, 785 out_len: u64, 786 }, 787 788 #[diag(codegen_ssa_invalid_monomorphization_return_element, code = "E0511")] 789 ReturnElement { 790 #[primary_span] 791 span: Span, 792 name: Symbol, 793 in_elem: Ty<'tcx>, 794 in_ty: Ty<'tcx>, 795 ret_ty: Ty<'tcx>, 796 out_ty: Ty<'tcx>, 797 }, 798 799 #[diag(codegen_ssa_invalid_monomorphization_shuffle_index_not_constant, code = "E0511")] 800 ShuffleIndexNotConstant { 801 #[primary_span] 802 span: Span, 803 name: Symbol, 804 arg_idx: u64, 805 }, 806 807 #[diag(codegen_ssa_invalid_monomorphization_shuffle_index_out_of_bounds, code = "E0511")] 808 ShuffleIndexOutOfBounds { 809 #[primary_span] 810 span: Span, 811 name: Symbol, 812 arg_idx: u64, 813 total_len: u128, 814 }, 815 816 #[diag(codegen_ssa_invalid_monomorphization_inserted_type, code = "E0511")] 817 InsertedType { 818 #[primary_span] 819 span: Span, 820 name: Symbol, 821 in_elem: Ty<'tcx>, 822 in_ty: Ty<'tcx>, 823 out_ty: Ty<'tcx>, 824 }, 825 826 #[diag(codegen_ssa_invalid_monomorphization_return_type, code = "E0511")] 827 ReturnType { 828 #[primary_span] 829 span: Span, 830 name: Symbol, 831 in_elem: Ty<'tcx>, 832 in_ty: Ty<'tcx>, 833 ret_ty: Ty<'tcx>, 834 }, 835 836 #[diag(codegen_ssa_invalid_monomorphization_expected_return_type, code = "E0511")] 837 ExpectedReturnType { 838 #[primary_span] 839 span: Span, 840 name: Symbol, 841 in_ty: Ty<'tcx>, 842 ret_ty: Ty<'tcx>, 843 }, 844 845 #[diag(codegen_ssa_invalid_monomorphization_mismatched_lengths, code = "E0511")] 846 MismatchedLengths { 847 #[primary_span] 848 span: Span, 849 name: Symbol, 850 m_len: u64, 851 v_len: u64, 852 }, 853 854 #[diag(codegen_ssa_invalid_monomorphization_mask_type, code = "E0511")] 855 MaskType { 856 #[primary_span] 857 span: Span, 858 name: Symbol, 859 ty: Ty<'tcx>, 860 }, 861 862 #[diag(codegen_ssa_invalid_monomorphization_vector_argument, code = "E0511")] 863 VectorArgument { 864 #[primary_span] 865 span: Span, 866 name: Symbol, 867 in_ty: Ty<'tcx>, 868 in_elem: Ty<'tcx>, 869 }, 870 871 #[diag(codegen_ssa_invalid_monomorphization_cannot_return, code = "E0511")] 872 CannotReturn { 873 #[primary_span] 874 span: Span, 875 name: Symbol, 876 ret_ty: Ty<'tcx>, 877 expected_int_bits: u64, 878 expected_bytes: u64, 879 }, 880 881 #[diag(codegen_ssa_invalid_monomorphization_expected_element_type, code = "E0511")] 882 ExpectedElementType { 883 #[primary_span] 884 span: Span, 885 name: Symbol, 886 expected_element: Ty<'tcx>, 887 second_arg: Ty<'tcx>, 888 in_elem: Ty<'tcx>, 889 in_ty: Ty<'tcx>, 890 mutability: ExpectedPointerMutability, 891 }, 892 893 #[diag(codegen_ssa_invalid_monomorphization_third_arg_element_type, code = "E0511")] 894 ThirdArgElementType { 895 #[primary_span] 896 span: Span, 897 name: Symbol, 898 expected_element: Ty<'tcx>, 899 third_arg: Ty<'tcx>, 900 }, 901 902 #[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol_of_size, code = "E0511")] 903 UnsupportedSymbolOfSize { 904 #[primary_span] 905 span: Span, 906 name: Symbol, 907 symbol: Symbol, 908 in_ty: Ty<'tcx>, 909 in_elem: Ty<'tcx>, 910 size: u64, 911 ret_ty: Ty<'tcx>, 912 }, 913 914 #[diag(codegen_ssa_invalid_monomorphization_unsupported_symbol, code = "E0511")] 915 UnsupportedSymbol { 916 #[primary_span] 917 span: Span, 918 name: Symbol, 919 symbol: Symbol, 920 in_ty: Ty<'tcx>, 921 in_elem: Ty<'tcx>, 922 ret_ty: Ty<'tcx>, 923 }, 924 925 #[diag(codegen_ssa_invalid_monomorphization_cast_fat_pointer, code = "E0511")] 926 CastFatPointer { 927 #[primary_span] 928 span: Span, 929 name: Symbol, 930 ty: Ty<'tcx>, 931 }, 932 933 #[diag(codegen_ssa_invalid_monomorphization_expected_pointer, code = "E0511")] 934 ExpectedPointer { 935 #[primary_span] 936 span: Span, 937 name: Symbol, 938 ty: Ty<'tcx>, 939 }, 940 941 #[diag(codegen_ssa_invalid_monomorphization_expected_usize, code = "E0511")] 942 ExpectedUsize { 943 #[primary_span] 944 span: Span, 945 name: Symbol, 946 ty: Ty<'tcx>, 947 }, 948 949 #[diag(codegen_ssa_invalid_monomorphization_unsupported_cast, code = "E0511")] 950 UnsupportedCast { 951 #[primary_span] 952 span: Span, 953 name: Symbol, 954 in_ty: Ty<'tcx>, 955 in_elem: Ty<'tcx>, 956 ret_ty: Ty<'tcx>, 957 out_elem: Ty<'tcx>, 958 }, 959 960 #[diag(codegen_ssa_invalid_monomorphization_unsupported_operation, code = "E0511")] 961 UnsupportedOperation { 962 #[primary_span] 963 span: Span, 964 name: Symbol, 965 in_ty: Ty<'tcx>, 966 in_elem: Ty<'tcx>, 967 }, 968 969 #[diag(codegen_ssa_invalid_monomorphization_expected_vector_element_type, code = "E0511")] 970 ExpectedVectorElementType { 971 #[primary_span] 972 span: Span, 973 name: Symbol, 974 expected_element: Ty<'tcx>, 975 vector_type: Ty<'tcx>, 976 }, 977 } 978 979 pub enum ExpectedPointerMutability { 980 Mut, 981 Not, 982 } 983 984 impl IntoDiagnosticArg for ExpectedPointerMutability { into_diagnostic_arg(self) -> DiagnosticArgValue<'static>985 fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { 986 match self { 987 ExpectedPointerMutability::Mut => DiagnosticArgValue::Str(Cow::Borrowed("*mut")), 988 ExpectedPointerMutability::Not => DiagnosticArgValue::Str(Cow::Borrowed("*_")), 989 } 990 } 991 } 992 993 #[derive(Diagnostic)] 994 #[diag(codegen_ssa_invalid_no_sanitize)] 995 #[note] 996 pub struct InvalidNoSanitize { 997 #[primary_span] 998 pub span: Span, 999 } 1000 1001 #[derive(Diagnostic)] 1002 #[diag(codegen_ssa_invalid_link_ordinal_nargs)] 1003 #[note] 1004 pub struct InvalidLinkOrdinalNargs { 1005 #[primary_span] 1006 pub span: Span, 1007 } 1008 1009 #[derive(Diagnostic)] 1010 #[diag(codegen_ssa_illegal_link_ordinal_format)] 1011 #[note] 1012 pub struct InvalidLinkOrdinalFormat { 1013 #[primary_span] 1014 pub span: Span, 1015 } 1016 1017 #[derive(Diagnostic)] 1018 #[diag(codegen_ssa_target_feature_safe_trait)] 1019 pub struct TargetFeatureSafeTrait { 1020 #[primary_span] 1021 #[label] 1022 pub span: Span, 1023 #[label(codegen_ssa_label_def)] 1024 pub def: Span, 1025 } 1026 1027 #[derive(Diagnostic)] 1028 #[diag(codegen_ssa_error_creating_remark_dir)] 1029 pub struct ErrorCreatingRemarkDir { 1030 pub error: std::io::Error, 1031 } 1032