From 8c589bca53fd9ce350092290fd0bf9c39994f8fb Mon Sep 17 00:00:00 2001 From: Ferdia McKeogh Date: Wed, 17 Jul 2019 15:00:14 +0200 Subject: [PATCH 1/2] Document link_section arbitrary bytes --- src/librustc_typeck/check/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 77d45cfa63c..3990946291d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1447,6 +1447,9 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span) // other executable formats. Namely we can only embed a list of bytes, // nothing with pointers to anything else or relocations. If any relocation // show up, reject them here. + // #[link_section] may contain arbitrary, or even undefined bytes, but it is + // the consumer's responsibility to ensure all bytes that have been read + // have defined values. let instance = ty::Instance::mono(tcx, id); let cid = GlobalId { instance, From 14a1f7246b27f31906dfe9c70c58fdfe863e314d Mon Sep 17 00:00:00 2001 From: Ferdia McKeogh Date: Wed, 17 Jul 2019 19:55:44 +0200 Subject: [PATCH 2/2] Requested change --- src/librustc_typeck/check/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3990946291d..1462c098b19 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1442,12 +1442,12 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span) return } - // For the wasm32 target statics with #[link_section] are placed into custom + // For the wasm32 target statics with `#[link_section]` are placed into custom // sections of the final output file, but this isn't link custom sections of // other executable formats. Namely we can only embed a list of bytes, // nothing with pointers to anything else or relocations. If any relocation // show up, reject them here. - // #[link_section] may contain arbitrary, or even undefined bytes, but it is + // `#[link_section]` may contain arbitrary, or even undefined bytes, but it is // the consumer's responsibility to ensure all bytes that have been read // have defined values. let instance = ty::Instance::mono(tcx, id);