Commit Graph

18 Commits

Author SHA1 Message Date
Antoni Boucher 2c0c25dcc1 Fix for diagnostics 2023-03-05 12:31:16 -05:00
Antoni Boucher 6bb2af0e6d Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
Peter Collingbourne 5873ebeef3 Move linkage type check to HIR analysis and fix semantics issues.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.

This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.

This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.

This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.

The update to the GCC backend is speculative and untested.
2022-12-05 15:05:43 -08:00
bjorn3 be6708428f Rewrite LLVM's archive writer in Rust
This allows it to be used by other codegen backends
2022-11-26 19:35:32 +00:00
Nilstrieb c65ebae221 Migrate all diagnostics 2022-10-23 10:09:44 +02:00
Ellis Hoag 01439c93b8 print <signal> when ranlib failed without an exit code 2022-09-28 19:02:38 -07:00
Ellis Hoag 6d01c6d9c8 lint and remove unused diagnostic 2022-09-26 19:57:40 -07:00
Ellis Hoag ac97487645 fix lifetime error 2022-09-24 11:36:16 -07:00
Ellis Hoag 5c7e629b63 rebase and update trait names 2022-09-24 11:06:05 -07:00
Ellis Hoag 249e46bfba Add monomorphization errors 2022-09-24 10:24:48 -07:00
Ellis Hoag 6fdfcb3547 lint type 2022-09-24 10:24:48 -07:00
Ellis Hoag e906ea80fe Add wrapper type for ExitCode for use in RanlibFailure 2022-09-24 10:24:48 -07:00
Ellis Hoag fb488ad366 remove IntoDiagnosticArg impl for Option 2022-09-24 10:24:48 -07:00
Ellis Hoag 5e0c53a679 Add LayoutSizeOverflow 2022-09-24 10:24:48 -07:00
Ellis Hoag d0b7e71918 Add LTONotSupported 2022-09-24 10:24:48 -07:00
Ellis Hoag d9aa635969 Add UnwindingInlineAsm 2022-09-24 10:24:48 -07:00
Ellis Hoag 7e00a48305 Add LinkageConstOrMutType 2022-09-24 10:24:48 -07:00
Ellis Hoag 9363f0fda5 Add RanlibFailure 2022-09-24 10:24:48 -07:00