The code for passing arguments into format strings relies on equality of function pointers. This is in conflict with the fact that we set unnamed_addr on all functions.
Global variables can be marked with unnamed_addr which indicates that the address is not significant, only the content. Constants marked like this can be merged with other constants if they have the same initializer.
|
fn as_usize(&self) -> Option<usize> { |
|
if self.formatter as usize == ArgumentV1::show_usize as usize { |
|
Some(unsafe { *(self.value as *const _ as *const usize) }) |
|
} else { |
|
None |
|
} |
|
} |
It might be possible for a user to write a function that gets merged with ArgumentV1::show_usize, and then cause bugs in the above code.
@oli-obk @eddyb
The code for passing arguments into format strings relies on equality of function pointers. This is in conflict with the fact that we set
unnamed_addron all functions.rust/src/libcore/fmt/mod.rs
Lines 295 to 301 in 618f5a0
It might be possible for a user to write a function that gets merged with
ArgumentV1::show_usize, and then cause bugs in the above code.@oli-obk @eddyb