Skip to content

Commit cc3dceb

Browse files
authored
Unrolled build for #144050
Rollup merge of #144050 - JonathanBrouwer:cross-crate-reexport, r=jdonszelmann Fix encoding of link_section and no_mangle cross crate Fixes #144004 ``@bjorn3`` suggested using the `codegen_fn_attrs` query but given that these attributes are not that common it's probably fine to just always encode them. I can also go for that solution if it is preferred but that would require more changes. r? ``@jdonszelmann`` ``@fmease`` (whoever feels like it)
2 parents ebd8557 + 9f16db6 commit cc3dceb

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

compiler/rustc_attr_data_structures/src/encode_cross_crate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ impl AttributeKind {
4141
Fundamental { .. } => Yes,
4242
Ignore { .. } => No,
4343
Inline(..) => No,
44-
LinkName { .. } => Yes,
44+
LinkName { .. } => Yes, // Needed for rustdoc
4545
LinkOrdinal { .. } => No,
46-
LinkSection { .. } => No,
46+
LinkSection { .. } => Yes, // Needed for rustdoc
4747
LoopMatch(..) => No,
4848
MacroTransparency(..) => Yes,
4949
Marker(..) => No,
5050
MayDangle(..) => No,
5151
MustUse { .. } => Yes,
5252
Naked(..) => No,
5353
NoImplicitPrelude(..) => No,
54-
NoMangle(..) => No,
55-
NonExhaustive(..) => Yes,
54+
NoMangle(..) => Yes, // Needed for rustdoc
55+
NonExhaustive(..) => Yes, // Needed for rustdoc
5656
OmitGdbPrettyPrinterSection => No,
5757
Optimize(..) => No,
5858
ParenSugar(..) => No,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#[unsafe(no_mangle)]
2+
pub fn f0() {}
3+
4+
#[unsafe(link_section = ".here")]
5+
pub fn f1() {}
6+
7+
#[unsafe(export_name = "f2export")]
8+
pub fn f2() {}
9+
10+
#[repr(u8)]
11+
pub enum T0 { V1 }
12+
13+
#[non_exhaustive]
14+
pub enum T1 {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ aux-build: reexports-attrs.rs
2+
3+
#![crate_name = "foo"]
4+
5+
extern crate reexports_attrs;
6+
7+
//@ has 'foo/fn.f0.html' '//pre[@class="rust item-decl"]' '#[no_mangle]'
8+
pub use reexports_attrs::f0;
9+
10+
//@ has 'foo/fn.f1.html' '//pre[@class="rust item-decl"]' '#[link_section = ".here"]'
11+
pub use reexports_attrs::f1;
12+
13+
//@ has 'foo/fn.f2.html' '//pre[@class="rust item-decl"]' '#[export_name = "f2export"]'
14+
pub use reexports_attrs::f2;
15+
16+
//@ has 'foo/enum.T0.html' '//pre[@class="rust item-decl"]' '#[repr(u8)]'
17+
pub use reexports_attrs::T0;
18+
19+
//@ has 'foo/enum.T1.html' '//pre[@class="rust item-decl"]' '#[non_exhaustive]'
20+
pub use reexports_attrs::T1;

0 commit comments

Comments
 (0)