Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: fix auto builds and make sure that we always have at least a single CI job #124739

Closed
wants to merge 118 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
3fd8c64
doc note that f16 and f128 hardware support is limited
ultrabear Apr 13, 2024
fc37633
Support Result<T, E> across FFI when niche optimization can be used
MasterAwesome Mar 9, 2024
b3e6d52
We don't need to check for non-exhaustive fields
MasterAwesome Mar 9, 2024
08b85a1
Don't lint niche optimized variants in enums
MasterAwesome Mar 9, 2024
223d5eb
Add tests
MasterAwesome Mar 9, 2024
014ddac
Disallow single-variant enums
MasterAwesome Mar 9, 2024
b3f6511
Add a test against Result<(), ()>
MasterAwesome Mar 19, 2024
764f64f
Reword `is_niche_optimization_candidate` doc
MasterAwesome Mar 19, 2024
437ca26
Remove comment out of RFC's scope
MasterAwesome Mar 19, 2024
ed532cc
Put the RFC behind a feature gate `result_ffi_guarantees`
MasterAwesome Mar 19, 2024
2681edf
josh rustc-pull: check that no new root commits get created
RalfJung Apr 27, 2024
39f7a46
fix: usage of `deprecated` version of `Node.js`
hamirmahal Apr 27, 2024
f5ceb4e
Auto merge of #3519 - hamirmahal:fix/usage-of-deprecated-version-of-n…
bors Apr 27, 2024
45d9394
Auto merge of #3520 - RalfJung:josh-check, r=RalfJung
bors Apr 27, 2024
ee47a8e
Add doc comment to `pack_generic`
eduardosm Apr 27, 2024
b3b1b49
Clarify behavior of AVX2 gather when dest and offsets have different …
eduardosm Apr 27, 2024
b261535
Do not implement x86 SIMD abs with host integers
eduardosm Apr 27, 2024
5c6f95c
Auto merge of #3521 - eduardosm:avx2-2, r=RalfJung
bors Apr 28, 2024
b5482aa
file descriptors: make write take &mut self
RalfJung Apr 28, 2024
bc8ea93
Auto merge of #3524 - RalfJung:fd-write, r=RalfJung
bors Apr 28, 2024
622f697
Use the interpreted program's TZ variable in localtime_r
saethlin Apr 27, 2024
39dc6c1
Fix unwinding on 32-bit watchOS ARM
madsmtm Apr 28, 2024
9bed19e
Refactor UnixEnvVars::get so that it can be reused by getenv
saethlin Apr 28, 2024
7afef08
don't leak UnixEnvVars impl details into get_env_var
RalfJung Apr 29, 2024
1c7e827
Auto merge of #3523 - saethlin:localtime_r-env, r=RalfJung
bors Apr 29, 2024
1cf951e
Don’t print `Preparing a sysroot` when `-q`/`--quiet` is passed
narpfel May 1, 2024
4b42626
fix usage example for `--print-sysroot`
narpfel May 1, 2024
a2b3211
no longer strip `Preparing a sysroot` message from test output
narpfel May 1, 2024
b0bdbcc
Auto merge of #3531 - narpfel:quiet-sysroot, r=RalfJung
bors May 1, 2024
aa986f0
Tree Borrows: first apply transition, then check protector with new '…
RalfJung May 2, 2024
ca3defe
Auto merge of #3532 - RalfJung:tb-protectors, r=RalfJung
bors May 2, 2024
36caaa9
update host-float comments
RalfJung May 2, 2024
f6c0090
Auto merge of #3535 - RalfJung:host-float, r=RalfJung
bors May 2, 2024
c8e2336
Use sum type for `WorkflowRunType`
Kobzol May 2, 2024
92a3052
Parse try build CI job name from commit message
Kobzol May 2, 2024
3efdb4d
Make the regex more robust
Kobzol May 2, 2024
56bb517
Add assign
tiif May 2, 2024
6967d1c
Stabilize exclusive_range
RossSmyth Apr 28, 2024
57f00ce
Update clippy tests for stable exclusive_range
RossSmyth Apr 28, 2024
aeef180
Preparing for merge from rustc
May 3, 2024
3e2164f
Merge from rustc
May 3, 2024
b348e41
update comments and URL
RalfJung May 3, 2024
3c6d194
Auto merge of #3536 - tiif:add_rustbot_feat, r=RalfJung
bors May 3, 2024
4af1ba0
update lockfile
RalfJung May 3, 2024
5ce8532
Auto merge of #3537 - rust-lang:rustup-2024-05-03, r=RalfJung
bors May 3, 2024
fc218f2
Address review comments
Kobzol May 3, 2024
03589bf
run clippy on a Windows host
RalfJung May 3, 2024
8a31014
Auto merge of #3542 - RalfJung:clippy-win, r=RalfJung
bors May 3, 2024
0de07d8
Preparing for merge from rustc
RalfJung May 3, 2024
dcf956c
Auto merge of #3544 - RalfJung:rustup, r=RalfJung
bors May 3, 2024
eaf30ce
./miri run: support -v flag to print what it is doing
RalfJung May 3, 2024
692b769
Auto merge of #3545 - RalfJung:miri-run, r=RalfJung
bors May 3, 2024
aa71f9b
CI: no need to surround if: condition in expansion braces
RalfJung May 3, 2024
74701dc
Auto merge of #3547 - RalfJung:ci, r=RalfJung
bors May 3, 2024
6ce00aa
make many-seeds a mode of ./miri run rather than a separate command
RalfJung May 3, 2024
f7a3aa9
remove a hack that is no longer needed
RalfJung May 4, 2024
38715f7
Auto merge of #3548 - RalfJung:many-seeds, r=RalfJung
bors May 4, 2024
6559342
tls dtors: treat all unixes uniformly
RalfJung May 4, 2024
82456b4
Auto merge of #3550 - RalfJung:unix-tls, r=RalfJung
bors May 4, 2024
07a517a
macos: use getentropy from libc
RalfJung May 4, 2024
705d48c
Auto merge of #3551 - RalfJung:getentropy, r=RalfJung
bors May 4, 2024
459c6ce
Make file descriptors into refcount references
Luv-Ray May 4, 2024
d130eaa
speed up Windows runner: don't run GC_STRESS test
RalfJung May 4, 2024
502ed49
show time taken in run_tests_minimal
RalfJung May 4, 2024
7b57f12
Auto merge of #3533 - Luv-Ray:file-descriptors-to-refcount-references…
bors May 4, 2024
be874a4
move available-parallelism tests into shims/ folder
RalfJung May 4, 2024
57ff16b
rename integer test
RalfJung May 4, 2024
3046dbe
move intrinsics implementations and tests into dedicated folder
RalfJung May 4, 2024
a4355bb
fix grouping of target-specific LLVM shims
RalfJung May 4, 2024
52bf84f
move some minimal targets over to the macOS runner, to even out CI times
RalfJung May 4, 2024
9d4eea1
Auto merge of #3556 - RalfJung:intrinsics, r=RalfJung
bors May 4, 2024
49cd705
Auto merge of #3552 - RalfJung:ci, r=RalfJung
bors May 4, 2024
e1c3d67
Revert "moving out sched_getaffinity interception from linux'shim, Fr…
RalfJung May 4, 2024
8b4b259
update 'unsupported' message
RalfJung May 4, 2024
6df585a
freebsd: test std threadname and fs APIs
RalfJung May 4, 2024
38598e6
document unofficially supported OSes
RalfJung May 4, 2024
05e7850
make some tests not need output (so they work on wasm)
RalfJung May 4, 2024
fd15dc3
Auto merge of #3558 - RalfJung:unsupported, r=RalfJung
bors May 4, 2024
3a6faee
Auto merge of #3554 - RalfJung:freebsd, r=RalfJung
bors May 4, 2024
823e31d
add helper function to declare an extern static for a weak symbol
RalfJung May 4, 2024
19aa8a0
make statx a regular function (so we don't need to support the syscall)
RalfJung May 4, 2024
37537d1
Auto merge of #3559 - RalfJung:weak-extern-static, r=RalfJung
bors May 4, 2024
98bb8ac
sync: better error in invalid synchronization primitive ID
RalfJung May 4, 2024
86d7dff
factor some pthread offset into constants
RalfJung May 4, 2024
9503c41
also test pthread_condattr_getclock
RalfJung May 4, 2024
c3f2701
Auto merge of #3560 - RalfJung:sync-check-id, r=RalfJung
bors May 4, 2024
adb74ae
Preparing for merge from rustc
RalfJung May 4, 2024
0c98929
Merge from rustc
RalfJung May 4, 2024
c6e273c
bless and fmt
RalfJung May 4, 2024
a040df7
remove some dead code
RalfJung May 4, 2024
7eda989
Auto merge of #3557 - RalfJung:getaffinity, r=RalfJung
bors May 4, 2024
d0e7772
Auto merge of #3561 - RalfJung:rustup, r=RalfJung
bors May 4, 2024
43e6600
Implement lldb formattter for "clang encoded" enums (LLDB 18.1+)
Apr 23, 2024
cdf3f3c
only show the 'basic API common for this target' message when this is…
RalfJung May 4, 2024
82a8059
Auto merge of #3562 - RalfJung:unsupported, r=RalfJung
bors May 4, 2024
94f922a
Meta: Enable the triagebot transfer command
fmease May 4, 2024
89e8288
Preparing for merge from rustc
RalfJung May 4, 2024
8db37a3
Merge from rustc
RalfJung May 4, 2024
ef5a574
rustc_pull: explain order of operations
RalfJung May 4, 2024
85e061a
fix/extend some comments
RalfJung May 4, 2024
745e3f2
make ExitProcess Windows-only
RalfJung May 4, 2024
e3fe30d
Auto merge of #3563 - RalfJung:rustup, r=RalfJung
bors May 4, 2024
7ba8144
Implement `edition` method on `Rustdoc` type as well
GuillaumeGomez May 4, 2024
a64ba04
Migrate `run-make/doctests-runtool` to rmake
GuillaumeGomez May 4, 2024
b5051c5
update lockfile
RalfJung May 4, 2024
e30ad6f
Tgross feedback tweaks
ultrabear Apr 14, 2024
3ef2528
Make f16 and f128 docs clearer on platform support
ultrabear Apr 15, 2024
5aa2f9a
Make f128 docs mention lack of any normal platform support
ultrabear May 4, 2024
d9d6315
Auto merge of #124631 - Kobzol:arbitrary-try-build, r=pietroalbini
bors May 5, 2024
654afe3
Auto merge of #122253 - MasterAwesome:master, r=davidtwco
bors May 5, 2024
6e146c0
Auto merge of #124458 - VladimirMakaev:lldb-enum-formatter, r=Mark-Si…
bors May 5, 2024
8994315
Auto merge of #124459 - RossSmyth:stable_range, r=davidtwco
bors May 5, 2024
1867f48
Auto merge of #124494 - madsmtm:fix-32bit-watchos-unwind, r=Mark-Simu…
bors May 5, 2024
8b6f931
Auto merge of #124727 - RalfJung:miri-sync, r=RalfJung
bors May 5, 2024
3fbeedb
Auto merge of #123892 - ultrabear:ultrabear_softfloatdoc, r=workingju…
bors May 5, 2024
2e0982d
Auto merge of #124711 - GuillaumeGomez:migrate-doctests-runtool, r=ji…
bors May 5, 2024
69ffc0d
Auto merge of #124725 - fmease:enable-triagebot-transfer, r=jackh726
bors May 5, 2024
394f21c
CI: fix auto builds and make sure that we always have at least a sing…
Kobzol May 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
- name: Checkout the source code
uses: actions/checkout@v4
- name: Calculate the CI job matrix
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
id: jobs
job:
Expand All @@ -75,14 +77,6 @@ jobs:
matrix:
# Check the `calculate_matrix` job to see how is the matrix defined.
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
# GitHub Actions fails the workflow if an empty list of jobs is provided to
# the workflow, so we need to skip this job if nothing was produced by
# the Python script.
#
# Unfortunately checking whether a list is empty is not possible in a nice
# way due to GitHub Actions expressions limits.
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
steps:
- if: contains(matrix.os, 'windows')
uses: msys2/setup-msys2@v2.22.0
Expand Down
88 changes: 79 additions & 9 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,28 @@ dependencies = [
"windows-targets 0.52.4",
]

[[package]]
name = "chrono-tz"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb"
dependencies = [
"chrono",
"chrono-tz-build",
"phf 0.11.2",
]

[[package]]
name = "chrono-tz-build"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1"
dependencies = [
"parse-zoneinfo",
"phf 0.11.2",
"phf_codegen 0.11.2",
]

[[package]]
name = "cipher"
version = "0.4.4"
Expand Down Expand Up @@ -2318,8 +2340,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
dependencies = [
"log",
"phf",
"phf_codegen",
"phf 0.10.1",
"phf_codegen 0.10.0",
"string_cache",
"string_cache_codegen",
"tendril",
Expand Down Expand Up @@ -2480,6 +2502,7 @@ version = "0.1.0"
dependencies = [
"aes",
"chrono",
"chrono-tz",
"colored",
"ctrlc",
"directories",
Expand Down Expand Up @@ -2835,6 +2858,15 @@ dependencies = [
"windows-targets 0.48.5",
]

[[package]]
name = "parse-zoneinfo"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24"
dependencies = [
"regex",
]

[[package]]
name = "pathdiff"
version = "0.2.1"
Expand Down Expand Up @@ -2907,7 +2939,16 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
dependencies = [
"phf_shared",
"phf_shared 0.10.0",
]

[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_shared 0.11.2",
]

[[package]]
Expand All @@ -2916,8 +2957,18 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
dependencies = [
"phf_generator",
"phf_shared",
"phf_generator 0.10.0",
"phf_shared 0.10.0",
]

[[package]]
name = "phf_codegen"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
dependencies = [
"phf_generator 0.11.2",
"phf_shared 0.11.2",
]

[[package]]
Expand All @@ -2926,7 +2977,17 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [
"phf_shared",
"phf_shared 0.10.0",
"rand",
]

[[package]]
name = "phf_generator"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
"phf_shared 0.11.2",
"rand",
]

Expand All @@ -2939,6 +3000,15 @@ dependencies = [
"siphasher",
]

[[package]]
name = "phf_shared"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]

[[package]]
name = "pin-project-lite"
version = "0.2.14"
Expand Down Expand Up @@ -5285,7 +5355,7 @@ dependencies = [
"new_debug_unreachable",
"once_cell",
"parking_lot",
"phf_shared",
"phf_shared 0.10.0",
"precomputed-hash",
"serde",
]
Expand All @@ -5296,8 +5366,8 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
dependencies = [
"phf_generator",
"phf_shared",
"phf_generator 0.10.0",
"phf_shared 0.10.0",
"proc-macro2",
"quote",
]
Expand Down
15 changes: 1 addition & 14 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_ast as ast;
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId};
use rustc_ast::{token, PatKind, RangeEnd};
use rustc_ast::{token, PatKind};
use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
use rustc_session::Session;
Expand Down Expand Up @@ -418,15 +418,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
PatKind::Box(..) => {
gate!(&self, box_patterns, pattern.span, "box pattern syntax is experimental");
}
PatKind::Range(_, Some(_), Spanned { node: RangeEnd::Excluded, .. }) => {
gate!(
&self,
exclusive_range_pattern,
pattern.span,
"exclusive range pattern syntax is experimental",
"use an inclusive range pattern, like N..=M"
);
}
_ => {}
}
visit::walk_pat(self, pattern)
Expand Down Expand Up @@ -619,10 +610,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
// be too.
gate_all_legacy_dont_use!(return_type_notation, "return type notation is experimental");
gate_all_legacy_dont_use!(decl_macro, "`macro` is experimental");
gate_all_legacy_dont_use!(
exclusive_range_pattern,
"exclusive range pattern syntax is experimental"
);
gate_all_legacy_dont_use!(try_blocks, "`try` blocks are unstable");
gate_all_legacy_dont_use!(auto_traits, "`auto` traits are unstable");

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0579.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ A lower range wasn't less than the upper range.
Erroneous code example:

```compile_fail,E0579
#![feature(exclusive_range_pattern)]

fn main() {
match 5u32 {
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ declare_features! (
(accepted, drop_types_in_const, "1.22.0", Some(33156)),
/// Allows using `dyn Trait` as a syntax for trait objects.
(accepted, dyn_trait, "1.27.0", Some(44662)),
/// Allows `X..Y` patterns.
(accepted, exclusive_range_pattern, "CURRENT_RUSTC_VERSION", Some(37854)),
/// Allows integer match exhaustiveness checking (RFC 2591).
(accepted, exhaustive_integer_patterns, "1.33.0", Some(50907)),
/// Allows explicit generic arguments specification with `impl Trait` present.
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ declare_features! (
(incomplete, dyn_star, "1.65.0", Some(102425)),
/// Uses generic effect parameters for ~const bounds
(unstable, effects, "1.72.0", Some(102090)),
/// Allows `X..Y` patterns.
(unstable, exclusive_range_pattern, "1.11.0", Some(37854)),
/// Allows exhaustive pattern matching on types that contain uninhabited types.
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
/// Allows explicit tail calls via `become` expression.
Expand Down Expand Up @@ -581,6 +579,9 @@ 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, "CURRENT_RUSTC_VERSION", Some(110503)),
/// Allows bounding the return type of AFIT/RPITIT.
(incomplete, return_type_notation, "1.70.0", Some(109417)),
/// Allows `extern "rust-cold"`.
Expand Down
69 changes: 56 additions & 13 deletions compiler/rustc_lint/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,32 @@ fn get_nullable_type<'tcx>(
})
}

/// A type is niche-optimization candidate iff:
/// - Is a zero-sized type with alignment 1 (a “1-ZST”).
/// - Has no fields.
/// - Does not have the `#[non_exhaustive]` attribute.
fn is_niche_optimization_candidate<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
ty: Ty<'tcx>,
) -> bool {
if tcx.layout_of(param_env.and(ty)).is_ok_and(|layout| !layout.is_1zst()) {
return false;
}

match ty.kind() {
ty::Adt(ty_def, _) => {
let non_exhaustive = ty_def.is_variant_list_non_exhaustive();
let empty = (ty_def.is_struct() && ty_def.all_fields().next().is_none())
|| (ty_def.is_enum() && ty_def.variants().is_empty());

!non_exhaustive && empty
}
ty::Tuple(tys) => tys.is_empty(),
_ => false,
}
}

/// Check if this enum can be safely exported based on the "nullable pointer optimization". If it
/// can, return the type that `ty` can be safely converted to, otherwise return `None`.
/// Currently restricted to function pointers, boxes, references, `core::num::NonZero`,
Expand All @@ -1117,6 +1143,22 @@ pub(crate) fn repr_nullable_ptr<'tcx>(
let field_ty = match &ty_def.variants().raw[..] {
[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);

if is_niche_optimization_candidate(tcx, param_env, ty1) {
ty2
} else if is_niche_optimization_candidate(tcx, param_env, ty2) {
ty1
} else {
return None;
}
}
_ => return None,
},
_ => return None,
Expand Down Expand Up @@ -1202,7 +1244,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
args: GenericArgsRef<'tcx>,
) -> FfiResult<'tcx> {
use FfiResult::*;

let transparent_with_all_zst_fields = if def.repr().transparent() {
if let Some(field) = transparent_newtype_field(self.cx.tcx, variant) {
// Transparent newtypes have at most one non-ZST field which needs to be checked..
Expand Down Expand Up @@ -1329,27 +1370,29 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
return FfiSafe;
}

if def.is_variant_list_non_exhaustive() && !def.did().is_local() {
return FfiUnsafe {
ty,
reason: fluent::lint_improper_ctypes_non_exhaustive,
help: None,
};
}

// Check for a repr() attribute to specify the size of the
// discriminant.
if !def.repr().c() && !def.repr().transparent() && def.repr().int.is_none()
{
// Special-case types like `Option<extern fn()>`.
if repr_nullable_ptr(self.cx.tcx, self.cx.param_env, ty, self.mode)
.is_none()
// Special-case types like `Option<extern fn()>` and `Result<extern fn(), ()>`
if let Some(ty) =
repr_nullable_ptr(self.cx.tcx, self.cx.param_env, ty, self.mode)
{
return FfiUnsafe {
ty,
reason: fluent::lint_improper_ctypes_enum_repr_reason,
help: Some(fluent::lint_improper_ctypes_enum_repr_help),
};
return self.check_type_for_ffi(cache, ty);
}
}

if def.is_variant_list_non_exhaustive() && !def.did().is_local() {
return FfiUnsafe {
ty,
reason: fluent::lint_improper_ctypes_non_exhaustive,
help: None,
reason: fluent::lint_improper_ctypes_enum_repr_reason,
help: Some(fluent::lint_improper_ctypes_enum_repr_help),
};
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// # #![feature(exclusive_range_pattern)]
/// let x = 123u32;
/// match x {
/// 0..100 => { println!("small"); }
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_pattern_analysis/src/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
//! This is enough to compute usefulness: a pattern in a `match` expression is redundant iff it is
//! not useful w.r.t. the patterns above it:
//! ```compile_fail,E0004
//! # #![feature(exclusive_range_pattern)]
//! # fn foo() {
//! match Some(0u32) {
//! Some(0..100) => {},
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ symbols! {
require,
residual,
result,
result_ffi_guarantees,
resume,
return_position_impl_trait_in_trait,
return_type_notation,
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
//
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(exclusive_range_pattern))]
#![cfg_attr(not(test), feature(coroutine_trait))]
#![cfg_attr(test, feature(panic_update_hook))]
#![cfg_attr(test, feature(test))]
Expand All @@ -179,7 +180,6 @@
#![feature(const_try)]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]
#![feature(exclusive_range_pattern)]
#![feature(fundamental)]
#![feature(hashmap_internals)]
#![feature(lang_items)]
Expand Down
Loading
Loading