2019-04-10 18:40:12 -05:00
|
|
|
error[E0658]: the `linkage` attribute is experimental and not portable across platforms
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/feature-gate-linkage.rs:2:5
|
2017-12-06 03:18:03 -06:00
|
|
|
|
|
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-11-23 20:13:30 -06:00
|
|
|
LL | #[linkage = "extern_weak"] static foo: *mut isize;
|
2017-12-06 03:18:03 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2020-02-07 06:07:02 -06:00
|
|
|
= note: see issue #29603 <https://github.com/rust-lang/rust/issues/29603> for more information
|
2019-07-09 04:32:08 -05:00
|
|
|
= help: add `#![feature(linkage)]` to the crate attributes to enable
|
2017-12-06 03:18:03 -06:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about this error, try `rustc --explain E0658`.
|