Closed
Description
Example:
#![feature(fn_delegation)]
extern "C" {
fn f();
}
reuse f as g;
//~^ ERROR call to unsafe function `f` is unsafe and requires unsafe function or block
The synthesized fn g
ought to be marked unsafe
as f
is implicitly unsafe1 but that doesn't happen.
Footnotes
-
Unless marked
safe
under featureunsafe_extern_blocks
, these are possible toreuse
for obvious reasons. ↩
Activity
fmease commentedon Jul 6, 2024
Tangentially related: We should probably start wrapping a delegation's target expr (→→ return expr) in an
unsafe
block to accommodate lintunsafe_op_in_unsafe_fn
(allow-by-default in Rust <2024, warn-by-default in Rust 2024):Edit: Ah, not quite. Forgot about lint
unused_unsafe
for a sec. We're in a bit of pickle here unless we inspect the lint levels at that node which feels ... hacky?Edit 2: Well, we could just skip delegation items in both lints.
fmease commentedon Jul 6, 2024
Ah, furthermore we don't seem to "inherit" the parameters of foreign fns. So it seems like we don't handle foreign fns correctly at all (dropping params and header (safety, ...)).
workingjubilee commentedon Jul 6, 2024
awesome.
reuse
#138399Rollup merge of rust-lang#138399 - Bryanskiy:delegation-extern-fn, r=…
Rollup merge of rust-lang#138399 - Bryanskiy:delegation-extern-fn, r=…
Unrolled build for rust-lang#138399