rust/compiler
bors c70b35efd8 Auto merge of #84267 - dtolnay:ptrunit, r=nagisa
Make *const (), *mut () okay for FFI

Pointer-to-() is used occasionally in the standard library to mean "pointer to none-of-your-business". Examples:

- `RawWakerVTable::new` https://doc.rust-lang.org/1.51.0/std/task/struct.RawWakerVTable.html#method.new
- `<*const T>::to_raw_parts` https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.to_raw_parts

I believe it's useful for the same purpose in FFI signatures, even while `()` itself is not FFI safe. The following should be allowed:

```rust
extern "C" {
    fn demo(pc: *const (), pm: *mut ());
}
```

Prior to this PR, those pointers were not considered okay for an extern signature.

```console
warning: `extern` block uses type `()`, which is not FFI-safe
 --> src/main.rs:2:17
  |
2 |     fn demo(pc: *const (), pm: *mut ());
  |                 ^^^^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes)]` on by default
  = help: consider using a struct instead
  = note: tuples have unspecified layout

warning: `extern` block uses type `()`, which is not FFI-safe
 --> src/main.rs:2:32
  |
2 |     fn demo(pc: *const (), pm: *mut ());
  |                                ^^^^^^^ not FFI-safe
  |
  = help: consider using a struct instead
  = note: tuples have unspecified layout
```
2021-10-03 00:41:49 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast
rustc_ast_lowering Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillot 2021-09-30 23:41:09 -07:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_borrowck Fix clippy lints 2021-10-01 23:17:19 +02:00
rustc_builtin_macros Auto merge of #89341 - audunhalland:derive-type-params-with-bound-generic-params, r=jackh726 2021-10-02 18:46:27 +00:00
rustc_codegen_cranelift Update compiler/rustc_codegen_cranelift/scripts/filter_profile.rs 2021-09-30 19:41:32 +02:00
rustc_codegen_gcc Rebase fallout. 2021-09-30 20:22:42 +02:00
rustc_codegen_llvm Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot 2021-10-02 10:52:09 +00:00
rustc_codegen_ssa Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov 2021-10-01 09:18:16 -07:00
rustc_const_eval Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk 2021-10-01 14:46:48 -07:00
rustc_data_structures More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_driver Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot 2021-10-02 10:52:09 +00:00
rustc_error_codes
rustc_errors
rustc_expand Improve help for recursion limit errors 2021-09-28 22:17:13 +02:00
rustc_feature Stabilize feature(macro_attributes_in_derive_output) 2021-09-24 21:48:30 +03:00
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #88880 - cjgillot:no-krate, r=oli-obk 2021-10-01 20:06:34 +00:00
rustc_hir_pretty Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_incremental Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_index
rustc_infer More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_interface Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot 2021-10-02 10:52:09 +00:00
rustc_lexer
rustc_lint Auto merge of #84267 - dtolnay:ptrunit, r=nagisa 2021-10-03 00:41:49 +00:00
rustc_lint_defs
rustc_llvm Fix clippy lints 2021-10-01 23:17:19 +02:00
rustc_macros
rustc_metadata Auto merge of #88880 - cjgillot:no-krate, r=oli-obk 2021-10-01 20:06:34 +00:00
rustc_middle Auto merge of #89408 - Mark-Simulacrum:fix-query-nondet, r=petrochenkov 2021-10-02 13:36:27 +00:00
rustc_mir_build Rollup merge of #89441 - Nadrieril:fix-89393, r=tmandry 2021-10-01 14:46:52 -07:00
rustc_mir_dataflow More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_mir_transform Auto merge of #88880 - cjgillot:no-krate, r=oli-obk 2021-10-01 20:06:34 +00:00
rustc_monomorphize Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_parse Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank 2021-10-01 09:18:17 -07:00
rustc_parse_format
rustc_passes Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_plugin_impl
rustc_privacy Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot 2021-10-02 10:52:09 +00:00
rustc_query_impl Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank 2021-09-24 05:29:49 +00:00
rustc_query_system
rustc_resolve resolve: Avoid comparing modules by optional def-id 2021-10-02 18:31:50 +03:00
rustc_save_analysis Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_serialize
rustc_session Rollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoerister 2021-10-01 09:18:18 -07:00
rustc_span rustc_span: Make hygiene debug printing reproducible 2021-10-02 18:31:50 +03:00
rustc_symbol_mangling Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
rustc_target Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov 2021-10-01 09:18:16 -07:00
rustc_trait_selection Auto merge of #89345 - jackh726:89333, r=estebank 2021-10-02 21:30:51 +00:00
rustc_traits Improve cause information for NLL higher-ranked errors 2021-09-27 10:23:45 -05:00
rustc_ty_utils Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakis 2021-09-26 19:36:00 +00:00
rustc_type_ir
rustc_typeck Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot 2021-10-02 10:52:09 +00:00