Skip to content

Commit 9acc050

Browse files
author
Jorge Aparicio
committed
fix a bug where max_atomic_width: 0 was lost during ...
the Target <-> JSON roundtrip.
1 parent 40f94c0 commit 9acc050

File tree

1 file changed

+7
-1
lines changed
  • src/librustc_back/target

1 file changed

+7
-1
lines changed

src/librustc_back/target/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,13 @@ impl Default for TargetOptions {
397397
allow_asm: true,
398398
has_elf_tls: false,
399399
obj_is_bitcode: false,
400-
max_atomic_width: 0,
400+
/// NOTE this is *not* the real default value. The default value of max_atomic_width is
401+
/// actually the pointer width of the target. This default is injected in the
402+
/// Target::from_json function. Still, we have to pick some value to put here. We'll pick
403+
/// an impossible value: u64::max_value() because using a valid value like 0 or 8 as the
404+
/// default would cause the max-atomic-width field to be "lost" (it would get replaced
405+
/// by target_pointer_width) during the Target <-> JSON round trip
406+
max_atomic_width: u64::max_value(),
401407
}
402408
}
403409
}

0 commit comments

Comments
 (0)