Skip to content

Commit

Permalink
Auto merge of #130628 - workingjubilee:clean-up-result-ffi-guarantees…
Browse files Browse the repository at this point in the history
…, r=RalfJung

Finish stabilization of `result_ffi_guarantees`

The internal linting has been changed, so all that is left is making sure we stabilize what we want to stabilize.
  • Loading branch information
bors committed Oct 21, 2024
2 parents 93742bd + 7baf066 commit 3e33bda
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 500 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ declare_features! (
(accepted, repr_packed, "1.33.0", Some(33158)),
/// Allows `#[repr(transparent)]` attribute on newtype structs.
(accepted, repr_transparent, "1.28.0", Some(43036)),
/// Allows enums like Result<T, E> to be used across FFI, if T's niche value can
/// be used to describe E or vice-versa.
(accepted, result_ffi_guarantees, "CURRENT_RUSTC_VERSION", Some(110503)),
/// Allows return-position `impl Trait` in traits.
(accepted, return_position_impl_trait_in_trait, "1.75.0", Some(91611)),
/// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,6 @@ declare_features! (
(incomplete, repr128, "1.16.0", Some(56071)),
/// Allows `repr(simd)` and importing the various simd intrinsics.
(unstable, repr_simd, "1.4.0", Some(27731)),
/// Allows enums like Result<T, E> to be used across FFI, if T's niche value can
/// be used to describe E or vise-versa.
(unstable, result_ffi_guarantees, "1.80.0", Some(110503)),
/// Allows bounding the return type of AFIT/RPITIT.
(unstable, return_type_notation, "1.70.0", Some(109417)),
/// Allows `extern "rust-cold"`.
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_lint/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ fn is_niche_optimization_candidate<'tcx>(
/// can, return the type that `ty` can be safely converted to, otherwise return `None`.
/// Currently restricted to function pointers, boxes, references, `core::num::NonZero`,
/// `core::ptr::NonNull`, and `#[repr(transparent)]` newtypes.
/// FIXME: This duplicates code in codegen.
pub(crate) fn repr_nullable_ptr<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -743,10 +742,6 @@ pub(crate) fn repr_nullable_ptr<'tcx>(
[var_one, var_two] => match (&var_one.fields.raw[..], &var_two.fields.raw[..]) {
([], [field]) | ([field], []) => field.ty(tcx, args),
([field1], [field2]) => {
if !tcx.features().result_ffi_guarantees {
return None;
}

let ty1 = field1.ty(tcx, args);
let ty2 = field2.ty(tcx, args);

Expand Down

This file was deleted.

99 changes: 0 additions & 99 deletions tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs

This file was deleted.

Loading

0 comments on commit 3e33bda

Please sign in to comment.