Closed
Description
STR:
fn main() {
let _ = &*"string";
}
Result:
@ref2649 = internal unnamed_addr constant %str_slice { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str2648, i32 0, i32 0), i64 6 }, align 8
{ i8*, i8* } undef
error: internal compiler error: const expr(10: &*"string") of type &'static str has size 8 instead of 16
This is from trans/consts.rs
around line 462. I did some poking around in gdb; for "string"
and *"string"
the value of llconst
is the pointer/len tuple, but for &*"string"
it's a pointer to that tuple (seen above), which is wrong.
The value of opt_adj
is always None
(assuming the breakpoints and debug info are working as expected), which… it's been a long time since I looked at anything in this area, but I vaguely remember adjustments as being about this kind of situation, and it particular it looks like AdjustDerefRef
ought to be relevant?