granite-rust/compiler
Matthias Krüger e4a3627c24
Rollup merge of #94586 - sunfishcode:sunfishcode/io-lifetimes-tests, r=davidtwco
Generalize `get_nullable_type` to allow types where null is all-ones.

Generalize get_nullable_type to accept types that have an all-ones bit
pattern as their sentry "null" value.

This will allow [`OwnedFd`], [`BorrowedFd`], [`OwnedSocket`], and
[`BorrowedSocket`] to be marked with
`#[rustc_nonnull_optimization_guaranteed]`, which will allow
`Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`, and
`Option<BorrowedSocket>` to be used in FFI declarations, as described
in the [I/O safety RFC].

For example, it will allow a function like `open` on Unix and `WSASocketW`
on Windows to be declared using `Option<OwnedFd>` and `Option<OwnedSocket>`
return types, respectively.

The actual change to add `#[rustc_nonnull_optimization_guaranteed]`
to the abovementioned types will be a separate PR, as it'll depend on
having this patch in the stage0 compiler.

Also, update the diagnostics to mention that "niche optimizations" are
used in libstd as well as libcore, as `rustc_layout_scalar_valid_range_start`
and `rustc_layout_scalar_valid_range_end` are already in use in libstd.

[`OwnedFd`]: c9dc44be24/library/std/src/os/fd/owned.rs (L49)
[`BorrowedFd`]: c9dc44be24/library/std/src/os/fd/owned.rs (L29)
[`OwnedSocket`]: c9dc44be24/library/std/src/os/windows/io/socket.rs (L51)
[`BorrowedSocket`]: c9dc44be24/library/std/src/os/windows/io/socket.rs (L29)
[I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
2022-03-08 11:04:53 +01:00
..
rustc remove unused jemallocator crate 2022-01-28 16:56:05 +01:00
rustc_apfloat Stabilize iter::zip. 2021-12-14 18:50:31 -04:00
rustc_arena Remove unused dep from rustc_arena 2022-02-02 17:37:14 +01:00
rustc_ast Ignore 2022-03-05 21:20:12 -05:00
rustc_ast_lowering remove unnecessary .. patterns 2022-03-07 02:18:36 +09:00
rustc_ast_passes Rollup merge of #94617 - pierwill:update-itertools, r=Mark-Simulacrum 2022-03-06 15:41:26 +01:00
rustc_ast_pretty Change syntax for TyAlias where clauses 2022-03-05 13:13:45 -05:00
rustc_attr Improve unexpected_cfgs lint when their is no value expected 2022-03-05 12:11:05 +01:00
rustc_borrowck Erase regions when checking for missing Copy predicates 2022-03-06 17:21:39 -08:00
rustc_builtin_macros Change syntax for TyAlias where clauses 2022-03-05 13:13:45 -05:00
rustc_codegen_cranelift Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_codegen_gcc Auto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead 2022-03-07 15:25:42 +00:00
rustc_codegen_llvm Auto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead 2022-03-07 15:25:42 +00:00
rustc_codegen_ssa Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_const_eval Stabilize const_impl_trait as well 2022-03-07 08:47:18 -08:00
rustc_data_structures Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_driver Rollup merge of #93913 - bjorn3:remove_everybody_loops, r=jackh726 2022-03-04 02:06:38 +01:00
rustc_error_codes Rollup merge of #94555 - cuishuang:master, r=oli-obk 2022-03-03 20:01:48 +01:00
rustc_errors Auto merge of #87835 - xFrednet:rfc-2383-expect-attribute-with-ids, r=wesleywiser 2022-03-03 18:59:32 +00:00
rustc_expand Auto merge of #94096 - cjgillot:ensure-stability, r=lcnr 2022-03-04 05:49:14 +00:00
rustc_feature Rollup merge of #94586 - sunfishcode:sunfishcode/io-lifetimes-tests, r=davidtwco 2022-03-08 11:04:53 +01:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz eplace usages of vec![].into_iter with [].into_iter 2022-01-09 14:09:25 +11:00
rustc_hir compiler: fix some typos 2022-03-01 20:02:47 +08:00
rustc_hir_pretty resolve: Fix incorrect results of opt_def_kind query for some built-in macros 2022-02-24 22:54:36 +03:00
rustc_incremental all: fix some typos 2022-03-03 19:47:23 +08:00
rustc_index Add comment linking to closed PR for future optimizers 2022-03-07 19:06:42 +01:00
rustc_infer Rollup merge of #94555 - cuishuang:master, r=oli-obk 2022-03-03 20:01:48 +01:00
rustc_interface Rollup merge of #94362 - Urgau:check-cfg-values, r=petrochenkov 2022-03-04 22:58:34 +01:00
rustc_lexer Improve scan_escape. 2022-02-24 17:01:01 +11:00
rustc_lint Rollup merge of #94586 - sunfishcode:sunfishcode/io-lifetimes-tests, r=davidtwco 2022-03-08 11:04:53 +01:00
rustc_lint_defs Change to lint 2022-03-05 13:15:00 -05:00
rustc_llvm Remove build_helper 2022-03-05 15:31:22 +01:00
rustc_log Make rustc_log doc test runnable 2022-01-03 22:31:56 -08:00
rustc_macros Make Ord, PartialOrd opt-out in newtype_index 2022-03-03 11:52:40 -06:00
rustc_metadata Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_middle Auto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead 2022-03-07 15:25:42 +00:00
rustc_mir_build Change wording of suggestion to add missing match arm 2022-03-08 00:20:41 +00:00
rustc_mir_dataflow Rollup merge of #94087 - tmiasko:rm-ignore-borrow-on-drop, r=jackh726 2022-02-26 07:52:42 +01:00
rustc_mir_transform Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_monomorphize Introduce ConstAllocation. 2022-03-07 08:25:50 +11:00
rustc_parse Auto merge of #90076 - jackh726:wherethewhere, r=nikomatsakis 2022-03-06 07:22:09 +00:00
rustc_parse_format Correctly mark the span of captured arguments in format_args!() 2022-02-16 07:34:06 +00:00
rustc_passes Rollup merge of #94580 - xFrednet:55112-only-reason-in-lint-attr, r=lcnr 2022-03-08 11:04:52 +01:00
rustc_plugin_impl replace dynamic library module with libloading 2021-12-06 12:03:47 -05:00
rustc_privacy remove unnecessary .. patterns 2022-03-07 02:18:36 +09:00
rustc_query_impl Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillot 2022-02-27 14:04:07 +00:00
rustc_query_system rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
rustc_resolve Rollup merge of #94595 - TaKO8Ki:fix-invalid-unresolved-imports-errors-for-asterisk-wildcard-syntax, r=estebank 2022-03-04 22:58:35 +01:00
rustc_save_analysis Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
rustc_serialize Delete Decoder::read_unit 2022-02-22 18:14:51 -05:00
rustc_session Update -Z unpretty error message 2022-03-06 12:45:37 +00:00
rustc_span Rollup merge of #94614 - pierwill:localexpnid-noord, r=lcnr 2022-03-07 11:35:56 +01:00
rustc_symbol_mangling Introduce ConstAllocation. 2022-03-07 08:25:50 +11:00
rustc_target Clarify Layout interning. 2022-03-07 13:41:47 +11:00
rustc_trait_selection Try to normalize associated types before processing obligations 2022-03-07 15:56:43 -05:00
rustc_traits chalk/db: use correct debrujin index when replacing opaque type. 2022-02-22 00:16:56 +01:00
rustc_ty_utils rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
rustc_type_ir Inline UnifyKey::index and UnifyKey::from_index 2022-02-15 19:07:06 +01:00
rustc_typeck Rollup merge of #94676 - TaKO8Ki:remove-unnecessary-pattens-for-ignoring-remaining-parts, r=Dylan-DPC 2022-03-07 06:44:03 +01:00