Likely, this also holds for non toplevel functions. It is inconvenient and probably should be fixed. Example from io.rs: obj FILE_writer(f: os::libc::FILE, res: option::t@FILE_res) { #cfg[target="macos"] fn fsync() { ret macos_os::fsync(f); } } will not compile.