rust-lang/rust · error
unsupported Apple pointer width
Error message
unsupported Apple pointer width {pointer_width:?} What it means
An `unimplemented!("unsupported Apple pointer width {pointer_width:?}")` panic in rustc_codegen_ssa's Apple relocation emitter (`add_data_and_relocation`). It chooses the relocation placeholder bytes (4 for 32-bit, 8 for 64-bit, plus an arm64e authenticated-pointer form). Any other `pointer_width` (e.g. a hypothetical 16-bit or 128-bit Apple target) has no defined placeholder and panics. This is a defensive guard, not normally reachable.
Solutions
- Verify your `--target`/target spec has `pointer_width` set to `32` or `64` (the only supported Apple widths).
- If you defined a custom target spec, fix its `pointer_width` field to a supported value.
- Use a built-in Apple target triple (`aarch64-apple-darwin`, `x86_64-apple-darwin`, etc.) instead of a hand-rolled spec.
Example fix
// before — custom spec with bad width
// { "pointer-width": 128, ... }
rustc --target custom-apple.json crate.rs
// after — standard 64-bit Apple target
rustc --target aarch64-apple-darwin crate.rs Defensive patterns
Strategy: validation
Validate before calling
# Validate Apple target spec pointer width before building
python3 - <<'PY'
import json,sys
spec=json.load(open('custom-apple.json'))
assert spec.get('pointer-width') in (32,64), f"unsupported Apple pointer width: {spec.get('pointer-width')}"
PY Prevention
- Use a built-in Apple target triple rather than a custom spec.
- If you author a target spec, set `pointer-width` to 32 or 64 only.
- Validate target-spec JSON before first compile.
When it happens
Trigger: Targeting an Apple platform whose target spec sets `pointer_width` to a value other than 32, 64, or the arm64e authenticated case. Triggered during linker-object emission for an undefined-symbol relocation.
Common situations: Almost never in practice: would require a custom/buggy Apple target spec with an invalid `pointer_width`, or a future Apple architecture with a non-standard pointer size that the linker object format cannot describe.
Related errors
- Accessing live loans requires `-Zpolonius=next`
- `async gen` closures not supported yet
- AsyncFn* are not yet const
- Can't have a type error relating to itself
- coroutine lowered from async gen fn should be in fn
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/c992c6c66dd1d636.
Report an issue: GitHub.
Appendix: source
Thrown at compiler/rustc_codegen_ssa/src/back/apple.rs:95
/// ```console
/// objdump --macho --reloc foo.o
/// objdump --macho --full-contents foo.o
/// ```
pub(super) fn add_data_and_relocation(
file: &mut object::write::Object<'_>,
section: object::write::SectionId,
symbol: object::write::SymbolId,
target: &Target,
kind: SymbolExportKind,
) -> object::write::Result<()> {
let authenticated_pointer =
kind == SymbolExportKind::Text && target.llvm_target.starts_with("arm64e");
let data: &[u8] = match target.pointer_width {
_ if authenticated_pointer => &[0, 0, 0, 0, 0, 0, 0, 0x80],
32 => &[0; 4],
64 => &[0; 8],
pointer_width => unimplemented!("unsupported Apple pointer width {pointer_width:?}"),
};
if target.arch == Arch::X86_64 {
// Force alignment for the entire section to be 16 on x86_64.
file.section_mut(section).append_data(&[], 16);
} else {
// Elsewhere, the section alignment is the same as the pointer width.
file.section_mut(section).append_data(&[], target.pointer_width as u64);
}
let offset = file.section_mut(section).append_data(data, data.len() as u64);
let flags = if authenticated_pointer {
object::write::RelocationFlags::MachO {
r_type: object::macho::ARM64_RELOC_AUTHENTICATED_POINTER,
r_pcrel: false,
r_length: 3,
}View on GitHub (pinned to 7088e4b63a)