Skip to content

Commit

Permalink
Update the syn crate and adopt let_else in three more places
Browse files Browse the repository at this point in the history
The syn crate has gained support for let_else syntax in version 1.0.76,
see dtolnay/syn#1057 .

In the three instances that use let_else, we've sent code through an
attr macro, which would create compile errors when there was no
let_else support in syn. To avoid this, we ran
`cargo +nightly update -p syn` for updating the syn crate.
  • Loading branch information
est31 committed Oct 16, 2021
1 parent 1418df5 commit ef018be
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock
Expand Up @@ -2728,9 +2728,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"

[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
dependencies = [
"unicode-xid",
]
Expand Down Expand Up @@ -5090,9 +5090,9 @@ dependencies = [

[[package]]
name = "syn"
version = "1.0.65"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663"
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
dependencies = [
"proc-macro2",
"quote",
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_resolve/src/late/lifetimes.rs
Expand Up @@ -1057,9 +1057,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
match param.kind {
GenericParamKind::Lifetime { .. } => {
let (name, reg) = Region::early(&self.tcx.hir(), &mut index, &param);
let def_id = if let Region::EarlyBound(_, def_id, _) = reg {
def_id
} else {
let Region::EarlyBound(_, def_id, _) = reg else {
bug!();
};
// We cannot predict what lifetimes are unused in opaque type.
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_typeck/src/check/coercion.rs
Expand Up @@ -521,9 +521,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {

let traits =
(self.tcx.lang_items().unsize_trait(), self.tcx.lang_items().coerce_unsized_trait());
let (unsize_did, coerce_unsized_did) = if let (Some(u), Some(cu)) = traits {
(u, cu)
} else {
let (Some(unsize_did), Some(coerce_unsized_did)) = traits else {
debug!("missing Unsize or CoerceUnsized traits");
return Err(TypeError::Mismatch);
};
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_typeck/src/check/upvar.rs
Expand Up @@ -1678,9 +1678,7 @@ impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
diag_expr_id: hir::HirId,
) {
let tcx = self.fcx.tcx;
let upvar_id = if let PlaceBase::Upvar(upvar_id) = place_with_id.place.base {
upvar_id
} else {
let PlaceBase::Upvar(upvar_id) = place_with_id.place.base else {
return;
};

Expand Down

0 comments on commit ef018be

Please sign in to comment.