Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit e3cc478

Browse files
committed
Auto merge of #274 - jdisanti:rustups, r=JohnTitor
Upgrade rust toolchain
2 parents 22514cc + a4e492a commit e3cc478

File tree

6 files changed

+29
-26
lines changed

6 files changed

+29
-26
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ repository and compiled from source or installed from
2727
of the nightly toolchain is supported at any given time.
2828

2929
<!-- NOTE: Keep in sync with nightly date on rust-toolchain. -->
30-
It's recommended to use `nightly-2021-10-25` toolchain.
31-
You can install it by using `rustup install nightly-2021-10-25` if you already have rustup.
30+
It's recommended to use `nightly-2021-11-30` toolchain.
31+
You can install it by using `rustup install nightly-2021-11-30` if you already have rustup.
3232
Then you can do:
3333

3434
```sh
35-
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2021-10-25
36-
$ cargo +nightly-2021-10-25 install --git https://github.com/rust-lang/rust-semverver
35+
$ rustup component add rustc-dev llvm-tools-preview --toolchain nightly-2021-11-30
36+
$ cargo +nightly-2021-11-30 install --git https://github.com/rust-lang/rust-semverver
3737
```
3838

3939
You'd also need `cmake` for some dependencies, and a few common libraries (if you hit

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# NOTE: Keep in sync with nightly date on README
22
[toolchain]
3-
channel = "nightly-2021-10-25"
3+
channel = "nightly-2021-11-30"
44
components = ["llvm-tools-preview", "rustc-dev"]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(rustc_private)]
2+
#![feature(exhaustive_patterns)]
23
#![allow(clippy::similar_names)]
34
#![allow(clippy::single_match_else)]
45
#![allow(clippy::too_many_lines)]

src/mapping.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ impl NameMapping {
374374
Use |
375375
ForeignMod |
376376
AnonConst |
377+
InlineConst |
377378
Field |
378379
LifetimeParam |
379380
GlobalAsm |

src/translate.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
166166
use rustc_middle::ty::TypeAndMut;
167167
use rustc_middle::ty::{AdtDef, Binder, ExistentialProjection, ExistentialTraitRef};
168168

169-
orig.fold_with(&mut BottomUpFolder {
169+
let Ok(result) = orig.fold_with(&mut BottomUpFolder {
170170
tcx: self.tcx,
171171
ty_op: |ty| {
172172
match *ty.kind() {
@@ -327,7 +327,8 @@ impl<'a, 'tcx> TranslationContext<'a, 'tcx> {
327327
},
328328
lt_op: |region| self.translate_region(region),
329329
ct_op: |konst| konst, // TODO: translate consts
330-
})
330+
});
331+
result
331332
}
332333

333334
/// Translate a region.
@@ -558,12 +559,12 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> {
558559
self.infcx.tcx
559560
}
560561

561-
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
562+
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
562563
use rustc_middle::ty::TyKind;
563564
use rustc_middle::ty::TypeAndMut;
564565

565-
let t1 = ty.super_fold_with(self);
566-
match *t1.kind() {
566+
let t1 = ty.super_fold_with(self)?;
567+
Ok(match *t1.kind() {
567568
TyKind::Ref(region, ty, mutbl) if region.needs_infer() => {
568569
let ty_and_mut = TypeAndMut { ty, mutbl };
569570
self.infcx
@@ -572,15 +573,15 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceCleanupFolder<'a, 'tcx> {
572573
}
573574
TyKind::Infer(_) => self.infcx.tcx.ty_error(),
574575
_ => t1,
575-
}
576+
})
576577
}
577578

578-
fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx> {
579-
let r1 = r.super_fold_with(self);
580-
if r1.needs_infer() {
579+
fn fold_region(&mut self, r: Region<'tcx>) -> Result<Region<'tcx>, Self::Error> {
580+
let r1 = r.super_fold_with(self)?;
581+
Ok(if r1.needs_infer() {
581582
self.infcx.tcx.lifetimes.re_erased
582583
} else {
583584
r1
584-
}
585+
})
585586
}
586587
}

src/typeck.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ impl<'a, 'tcx> BoundContext<'a, 'tcx> {
8888

8989
/// Return inference errors, if any.
9090
pub fn get_errors(&mut self) -> Option<Vec<FulfillmentError<'tcx>>> {
91-
if let Err(err) = self.fulfill_cx.select_all_or_error(self.infcx) {
92-
debug!("err: {:?}", err);
93-
Some(err)
91+
let errors = self.fulfill_cx.select_all_or_error(self.infcx);
92+
if !errors.is_empty() {
93+
debug!("err: {:?}", errors);
94+
Some(errors)
9495
} else {
9596
None
9697
}
@@ -253,12 +254,11 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
253254
RegionckMode::default(),
254255
);
255256

256-
let err = self
257+
let Ok(folded) = self
257258
.infcx
258259
.resolve_vars_if_possible(err)
259-
.fold_with(&mut self.folder.clone())
260-
.lift_to_tcx(lift_tcx)
261-
.unwrap();
260+
.fold_with(&mut self.folder.clone());
261+
let err = folded.lift_to_tcx(lift_tcx).unwrap();
262262

263263
Some(err)
264264
} else {
@@ -287,11 +287,11 @@ impl<'a, 'tcx> TypeComparisonContext<'a, 'tcx> {
287287
errors
288288
.iter()
289289
.map(|err| {
290-
self.infcx
290+
let Ok(folded) = self
291+
.infcx
291292
.resolve_vars_if_possible(err.obligation.predicate)
292-
.fold_with(&mut self.folder.clone())
293-
.lift_to_tcx(lift_tcx)
294-
.unwrap()
293+
.fold_with(&mut self.folder.clone());
294+
folded.lift_to_tcx(lift_tcx).unwrap()
295295
})
296296
.collect()
297297
})

0 commit comments

Comments
 (0)