Rollup merge of #74623 - lcnr:polymorphize-functions, r=eddyb
polymorphize GlobalAlloc::Function this sadly does not change #74614 r? @eddyb
This commit is contained in:
commit
a02aecba21
@ -257,7 +257,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
(value, AddressSpace::DATA)
|
||||
}
|
||||
GlobalAlloc::Function(fn_instance) => (
|
||||
self.get_fn_addr(fn_instance),
|
||||
self.get_fn_addr(fn_instance.polymorphize(self.tcx)),
|
||||
self.data_layout().instruction_address_space,
|
||||
),
|
||||
GlobalAlloc::Static(def_id) => {
|
||||
|
13
src/test/ui/polymorphization/promoted-function.rs
Normal file
13
src/test/ui/polymorphization/promoted-function.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// run-pass
|
||||
fn fop<T>() {}
|
||||
|
||||
fn bar<T>() -> &'static fn() {
|
||||
&(fop::<T> as fn())
|
||||
}
|
||||
pub const FN: &'static fn() = &(fop::<i32> as fn());
|
||||
|
||||
fn main() {
|
||||
bar::<u32>();
|
||||
bar::<i32>();
|
||||
(FN)();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user