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

Rollup of 12 pull requests #89549

Merged
merged 29 commits into from
Oct 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cb4519e
os current_exe using same approach as linux to get always the full ab…
devnexen Jul 30, 2021
ce450f8
Use the 64b inner:monotonize() implementation not the 128b one for aa…
AGSaidi Sep 4, 2021
f83853e
refactor: VecDeques PairSlices fields to private
DeveloperC286 Sep 25, 2021
e18a8ef
Don't ignore impls for primitive types
hkmatsumoto Aug 28, 2021
e46fc9d
Encode json files with UTF-8
hkmatsumoto Sep 29, 2021
98dde56
haiku thread affinity build fix
devnexen Oct 2, 2021
e552c0d
bootstrap: add config option for nix patching
davidtwco Oct 1, 2021
8cbcc89
Fix ICE caused by non_exaustive_omitted_patterns struct lint
DevinR528 Oct 1, 2021
f7a8980
Reorder etc check for non_exhaustive_omitted_patterns
DevinR528 Oct 2, 2021
3d83ff6
Add ui test for empty fields for omitted_patterns lint
DevinR528 Oct 2, 2021
b06409e
Rename etc -> has_rest_pat
DevinR528 Oct 2, 2021
fb0b1a5
Follow the diagnostic output style guide
hkmatsumoto Oct 3, 2021
a0cc9bb
Add a test to detect overlapping entries in overview tables
dns2utf8 Sep 10, 2021
677fb6b
Show how many tests are running in parallel
dns2utf8 Sep 11, 2021
e599e2d
Move from grid layout to table based layout because of browser limits…
dns2utf8 Sep 11, 2021
fdd8a0d
Don't suggest replacing region with 'static in NLL
Aaron1011 Oct 3, 2021
ccd2be5
fix busted JavaScript in error index generator
notriddle Oct 4, 2021
0fb0122
Rollup merge of #87631 - :solarish_upd_fs, r=joshtriplett
Manishearth Oct 5, 2021
7a09755
Rollup merge of #88234 - hkmatsumoto:rustdoc-impls-for-primitive, r=j…
Manishearth Oct 5, 2021
dd223d5
Rollup merge of #88651 - AGSaidi:monotonize-inner-64b-aarch64, r=dtolnay
Manishearth Oct 5, 2021
52d3afa
Rollup merge of #88816 - dns2utf8:rustdoc_test_gui_2k_constants, r=Gu…
Manishearth Oct 5, 2021
eeadc9d
Rollup merge of #89244 - DeveloperC286:pair_slices_fields_to_private,…
Manishearth Oct 5, 2021
27b84a9
Rollup merge of #89364 - hkmatsumoto:encode-json-with-utf-8, r=Mark-S…
Manishearth Oct 5, 2021
87f782e
Rollup merge of #89423 - DevinR528:reachable-fields, r=Nadrieril
Manishearth Oct 5, 2021
94b72f4
Rollup merge of #89426 - davidtwco:bootstrap-nix-toolchain-env-var, r…
Manishearth Oct 5, 2021
a23d7f0
Rollup merge of #89462 - devnexen:haiku_thread_aff_build_fix, r=nagisa
Manishearth Oct 5, 2021
04314a6
Rollup merge of #89482 - hkmatsumoto:patch-diagnostics, r=joshtriplett
Manishearth Oct 5, 2021
bf62c6d
Rollup merge of #89504 - Aaron1011:rpit-nll-static, r=nikomatsakis
Manishearth Oct 5, 2021
068683b
Rollup merge of #89535 - notriddle:notriddle/error-index-generator-js…
Manishearth Oct 5, 2021
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
Prev Previous commit
Next Next commit
Rename etc -> has_rest_pat
  • Loading branch information
DevinR528 committed Oct 2, 2021
commit b06409ebcde5746d36e11f323ea4dcc8bebe581c
16 changes: 8 additions & 8 deletions compiler/rustc_typeck/src/check/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.check_pat_tuple_struct(pat, qpath, subpats, ddpos, expected, def_bm, ti)
}
PatKind::Path(_) => self.check_pat_path(pat, path_res.unwrap(), expected, ti),
PatKind::Struct(ref qpath, fields, etc) => {
self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, ti)
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, def_bm, ti)
}
PatKind::Or(pats) => {
let parent_pat = Some(pat);
Expand Down Expand Up @@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pat: &'tcx Pat<'tcx>,
qpath: &hir::QPath<'_>,
fields: &'tcx [hir::PatField<'tcx>],
etc: bool,
has_rest_pat: bool,
expected: Ty<'tcx>,
def_bm: BindingMode,
ti: TopInfo<'tcx>,
Expand All @@ -707,7 +707,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.demand_eqtype_pat(pat.span, expected, pat_ty, ti);

// Type-check subpatterns.
if self.check_struct_pat_fields(pat_ty, pat, variant, fields, etc, def_bm, ti) {
if self.check_struct_pat_fields(pat_ty, &pat, variant, fields, has_rest_pat, def_bm, ti) {
pat_ty
} else {
self.tcx.ty_error()
Expand Down Expand Up @@ -1189,7 +1189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pat: &'tcx Pat<'tcx>,
variant: &'tcx ty::VariantDef,
fields: &'tcx [hir::PatField<'tcx>],
etc: bool,
has_rest_pat: bool,
def_bm: BindingMode,
ti: TopInfo<'tcx>,
) -> bool {
Expand Down Expand Up @@ -1263,7 +1263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

// Require `..` if struct has non_exhaustive attribute.
let non_exhaustive = variant.is_field_list_non_exhaustive() && !adt.did.is_local();
if non_exhaustive && !etc {
if non_exhaustive && !has_rest_pat {
self.error_foreign_non_exhaustive_spat(pat, adt.variant_descr(), fields.is_empty());
}

Expand All @@ -1275,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.struct_span_err(pat.span, "union patterns should have exactly one field")
.emit();
}
if etc {
if has_rest_pat {
tcx.sess.struct_span_err(pat.span, "`..` cannot be used in union patterns").emit();
}
} else if !unmentioned_fields.is_empty() {
Expand All @@ -1287,7 +1287,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
})
.collect();

if !etc {
if !has_rest_pat {
if accessible_unmentioned_fields.is_empty() {
unmentioned_err = Some(self.error_no_accessible_fields(pat, fields));
} else {
Expand Down