Skip to content

Rollup of 9 pull requests #61296

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

Merged
merged 40 commits into from
May 29, 2019
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
53e0474
Add better tests for hidden lifetimes in impl trait
matthewjasper May 17, 2019
fb52aea
tests: Centralize proc macros commonly used for testing
petrochenkov May 21, 2019
f27ec0f
Add test that impl Seek for BufReader correctly invalidates buffer be…
czipperz May 25, 2019
b1ae49c
Annotate test with #[test]
czipperz May 25, 2019
04e45c8
Print file mode of PermissionExt in octal in Examples
oberien May 26, 2019
7bba62c
Fixing mailmap for Carol
JosephTLyons May 28, 2019
2a6490c
Adding mailmap for myself
JosephTLyons May 28, 2019
b0c3385
Alphabetized lines with Atom's Sort Lines package
JosephTLyons May 28, 2019
ce76892
mention that MaybeUninit is a bit like Option
RalfJung May 28, 2019
2bf80cf
Update src/libcore/mem.rs
RalfJung May 28, 2019
6e5e0da
Changes the type `mir::Mir` into `mir::Body`
May 17, 2019
9c34473
Special-case `.llvm` in mangler to fix segfaults
davidtwco May 25, 2019
73f7e42
Relate identical parameters in array lengths
varkor May 11, 2019
5a585fe
Add a test for a function taking a const param array as an argument
varkor May 11, 2019
4ad5c62
Resolve consts in OpportunisticTypeResolver
varkor May 11, 2019
55dcc20
Add tests for uninferred consts during codegen
varkor May 11, 2019
c94ba63
Rename `OpportunisticTypeResolver` to `OpportunisticVarResolver`
varkor May 11, 2019
908d97d
Update test output
varkor May 12, 2019
d5c6cb8
Eagerly evaluate in `super_relate_consts`
varkor May 13, 2019
193b748
Remove FixedArraySize error
varkor May 13, 2019
57ff589
Add broken MIR regression tests
varkor May 20, 2019
cfa1f80
Fix test after rebase
varkor May 21, 2019
f865b7d
Update tests after pretty printing
varkor May 25, 2019
f13317c
Use Display rather than Debug printing for const mismatch
varkor May 25, 2019
8549953
Reintroduce `TypeError::FixedArraySize`
varkor May 27, 2019
56181cf
Correct pluralisation of tuple/array/associated type binding mismatch…
varkor May 27, 2019
b3a13fd
Make sure array length diagnostic doesn't regress
varkor May 27, 2019
2949160
Fix nits
varkor May 28, 2019
6233d1f
Use assert_eq! instead of println! in tests
varkor May 28, 2019
3e5beb2
rustc: rename Mir to mir::Body in comments and to MIR in error strings.
eddyb May 28, 2019
95013e6
syntax: bail out of `find_width_of_character_at_span` if the span doe…
eddyb May 28, 2019
d85e256
Rollup merge of #60742 - varkor:fn-const-array-parameter, r=eddyb
Centril May 28, 2019
e19a229
Rollup merge of #60756 - matthewjasper:extra-impl-trait-tests, r=niko…
Centril May 28, 2019
ee08261
Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb
Centril May 28, 2019
bfe9080
Rollup merge of #61024 - petrochenkov:proctest, r=nikomatsakis
Centril May 28, 2019
745af72
Rollup merge of #61157 - czipperz:BufReader-Seek-remove-extra-discard…
Centril May 28, 2019
dae331d
Rollup merge of #61195 - davidtwco:seg-fault-mangler, r=eddyb
Centril May 28, 2019
21684c0
Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkor
Centril May 28, 2019
2d01c91
Rollup merge of #61259 - JosephTLyons:mailmap-fixes, r=nikomatsakis
Centril May 28, 2019
9121a73
Rollup merge of #61273 - RalfJung:maybe-uninit, r=Centril
Centril May 28, 2019
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
29 changes: 16 additions & 13 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
# email addresses.
#

Aaron Todd <[email protected]>
Aaron Power <[email protected]> Erin Power <[email protected]>
Aaron Todd <[email protected]>
Abhishek Chanda <[email protected]> Abhishek Chanda <[email protected]>
Adolfo Ochagavía <[email protected]>
Adrien Tétar <[email protected]>
@@ -29,8 +29,8 @@ Ariel Ben-Yehuda <[email protected]> Ariel Ben-Yehuda <[email protected]>
Ariel Ben-Yehuda <[email protected]> arielb1 <[email protected]>
Austin Seipp <[email protected]> <[email protected]>
Aydin Kim <[email protected]> aydin.kim <[email protected]>
Bastian Kauschke <[email protected]>
Barosl Lee <[email protected]> Barosl LEE <[email protected]>
Bastian Kauschke <[email protected]>
Ben Alpert <[email protected]> <[email protected]>
Ben Sago <[email protected]> Ben S <[email protected]>
Ben Sago <[email protected]> Ben S <[email protected]>
@@ -46,22 +46,23 @@ Brian Anderson <[email protected]> <[email protected]>
Brian Dawn <[email protected]>
Brian Leibig <[email protected]> Brian Leibig <[email protected]>
Carl-Anton Ingmarsson <[email protected]> <[email protected]>
Carol (Nichols || Goulding) <[email protected]> <[email protected]>
Carol (Nichols || Goulding) <[email protected]> <[email protected]>
Carol (Nichols || Goulding) <[email protected]> <[email protected]>
Carol (Nichols || Goulding) <[email protected]> Carol Nichols <[email protected]>
Carol Willing <[email protected]>
Chris C Cerami <[email protected]> Chris C Cerami <[email protected]>
Chris Pressey <[email protected]>
Chris Thorn <[email protected]> Chris Thorn <[email protected]>
Chris Vittal <[email protected]> Christopher Vittal <[email protected]>
Christian Poveda <[email protected]> <[email protected]>
Christian Poveda <[email protected]> <[email protected]>
Christian Poveda <[email protected]> <[email protected]>
Clark Gaebel <[email protected]> <[email protected]>
Clinton Ryan <[email protected]>
Corey Richardson <[email protected]> Elaine "See More" Nemo <[email protected]>
Cyryl Płotnicki <[email protected]>
Damien Schoof <[email protected]>
Daniel Ramos <[email protected]>
Daniel J Rollins <[email protected]>
Daniel Ramos <[email protected]>
David Klein <[email protected]>
David Manescu <[email protected]> <[email protected]>
David Ross <[email protected]>
@@ -70,18 +71,18 @@ Diggory Hardy <[email protected]> Diggory Hardy <[email protected]>
Dylan Braithwaite <[email protected]> <[email protected]>
Dzmitry Malyshau <[email protected]>
E. Dunham <[email protected]> edunham <[email protected]>
Eduard-Mihai Burtescu <[email protected]>
Eduardo Bautista <[email protected]> <=>
Eduardo Bautista <[email protected]> <[email protected]>
Eduard-Mihai Burtescu <[email protected]>
Elliott Slaughter <[email protected]> <[email protected]>
Elly Fong-Jones <[email protected]>
Eric Holk <[email protected]> <[email protected]>
Eric Holk <[email protected]> <[email protected]>
Eric Holmes <[email protected]>
Eric Reed <[email protected]> <[email protected]>
Erick Tryzelaar <[email protected]> <[email protected]>
Esteban Küber <[email protected]> <[email protected]>
Esteban Küber <[email protected]> <[email protected]>
Esteban Küber <[email protected]> <[email protected]>
Esteban Küber <[email protected]> <[email protected]>
Evgeny Sologubov
Falco Hirschenberger <[email protected]> <[email protected]>
@@ -102,9 +103,9 @@ Herman J. Radtke III <[email protected]> Herman J. Radtke III <hermanradtk
Ilyong Cho <[email protected]>
Ivan Ivaschenko <[email protected]>
J. J. Weber <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
James Deng <[email protected]> <[email protected]>
James Miller <[email protected]> <[email protected]>
James Perry <[email protected]>
@@ -119,6 +120,7 @@ Jethro Beekman <[email protected]>
Jihyun Yu <[email protected]> <[email protected]>
Jihyun Yu <[email protected]> jihyun <[email protected]>
Jihyun Yu <[email protected]> Jihyun Yu <[email protected]>
João Oliveira <[email protected]> joaoxsouls <[email protected]>
Johann Hofmann <[email protected]> Johann <[email protected]>
John Clements <[email protected]> <[email protected]>
John Hodge <[email protected]> John Hodge <[email protected]>
@@ -129,7 +131,8 @@ Jonathan S <[email protected]> Jonathan S <[email protected]>
Jonathan Turner <[email protected]>
Jorge Aparicio <[email protected]> <[email protected]>
Joseph Martin <[email protected]>
João Oliveira <[email protected]> joaoxsouls <[email protected]>
Joseph T. Lyons <[email protected]> <[email protected]>
Joseph T. Lyons <[email protected]> <[email protected]>
Junyoung Cho <[email protected]>
Jyun-Yan You <[email protected]> <[email protected]>
Kang Seonghoon <[email protected]> <[email protected]>
@@ -145,8 +148,6 @@ Lindsey Kuper <[email protected]> <[email protected]>
Luke Metz <[email protected]>
Luqman Aden <[email protected]> <[email protected]>
Luqman Aden <[email protected]> <[email protected]>
NAKASHIMA, Makoto <[email protected]> <[email protected]>
NAKASHIMA, Makoto <[email protected]> <[email protected]>
Marcell Pardavi <[email protected]>
Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
Mark Rousskov <[email protected]>
@@ -167,12 +168,14 @@ Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
Mickaël Raybaud-Roig <[email protected]> m-r-r <[email protected]>
Ms2ger <[email protected]> <[email protected]>
Mukilan Thiagarajan <[email protected]>
NAKASHIMA, Makoto <[email protected]> <[email protected]>
NAKASHIMA, Makoto <[email protected]> <[email protected]>
Nathan West <[email protected]> <[email protected]>
Nathan Wilson <[email protected]>
Nathaniel Herman <[email protected]> Nathaniel Herman <[email protected]>
Neil Pankey <[email protected]> <[email protected]>
Nicole Mazzuca <[email protected]>
Nick Platt <[email protected]>
Nicole Mazzuca <[email protected]>
Nif Ward <[email protected]>
Oliver Schneider <[email protected]> oli-obk <[email protected]>
Oliver Schneider <[email protected]> Oliver 'ker' Schneider <[email protected]>
@@ -230,8 +233,8 @@ Tim JIANG <[email protected]>
Tim Joseph Dumol <[email protected]>
Torsten Weber <[email protected]> <[email protected]>
Ty Overby <[email protected]>
Ulrik Sverdrup <[email protected]> bluss <bluss>
Ulrik Sverdrup <[email protected]> bluss <[email protected]>
Ulrik Sverdrup <[email protected]> bluss <bluss>
Ulrik Sverdrup <[email protected]> Ulrik Sverdrup <root@localhost>
Vadim Petrochenkov <[email protected]>
Vadim Petrochenkov <[email protected]> petrochenkov <[email protected]>
3 changes: 3 additions & 0 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
@@ -966,6 +966,9 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
///
/// The compiler then knows to not make any incorrect assumptions or optimizations on this code.
///
/// You can think of `MaybeUninit<T>` as being a bit like `Option<T>` but without
/// any of the run-time tracking and without any of the safety checks.
///
/// ## out-pointers
///
/// You can use `MaybeUninit<T>` to implement "out-pointers": instead of returning data
6 changes: 3 additions & 3 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
@@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
for sp in prior_arms {
err.span_label(*sp, format!(
"this is found to be of type `{}`",
self.resolve_type_vars_if_possible(&last_ty),
self.resolve_vars_if_possible(&last_ty),
));
}
} else if let Some(sp) = prior_arms.last() {
@@ -1278,7 +1278,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
&self,
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
let exp_found = self.resolve_type_vars_if_possible(exp_found);
let exp_found = self.resolve_vars_if_possible(exp_found);
if exp_found.references_error() {
return None;
}
@@ -1291,7 +1291,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
&self,
exp_found: &ty::error::ExpectedFound<T>,
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
let exp_found = self.resolve_type_vars_if_possible(exp_found);
let exp_found = self.resolve_vars_if_possible(exp_found);
if exp_found.references_error() {
return None;
}
6 changes: 3 additions & 3 deletions src/librustc/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
});
match ty_opt {
Some(ty) => {
let ty = self.infcx.resolve_type_vars_if_possible(&ty);
let ty = self.infcx.resolve_vars_if_possible(&ty);
ty.walk().any(|inner_ty| {
inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
@@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx> {
let ty = self.resolve_type_vars_if_possible(&ty);
let ty = self.resolve_vars_if_possible(&ty);
let name = self.extract_type_name(&ty, None);

let mut err_span = span;
@@ -166,7 +166,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
span: Span,
ty: Ty<'tcx>
) -> DiagnosticBuilder<'gcx> {
let ty = self.resolve_type_vars_if_possible(&ty);
let ty = self.resolve_vars_if_possible(&ty);
let name = self.extract_type_name(&ty, None);

let mut err = struct_span_err!(self.tcx.sess,
Original file line number Diff line number Diff line change
@@ -210,11 +210,11 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
_ => (),
}

let expected_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef {
let expected_trait_ref = self.infcx.resolve_vars_if_possible(&ty::TraitRef {
def_id: trait_def_id,
substs: expected_substs,
});
let actual_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef {
let actual_trait_ref = self.infcx.resolve_vars_if_possible(&ty::TraitRef {
def_id: trait_def_id,
substs: actual_substs,
});
2 changes: 1 addition & 1 deletion src/librustc/infer/fudge.rs
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let (mut fudger, value) = self.probe(|snapshot| {
match f() {
Ok(value) => {
let value = self.resolve_type_vars_if_possible(&value);
let value = self.resolve_vars_if_possible(&value);

// At this point, `value` could in principle refer
// to inference variables that have been created during
20 changes: 10 additions & 10 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
@@ -1174,7 +1174,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
/// Process the region constraints and report any errors that
/// result. After this, no more unification operations should be
/// done -- or the compiler will panic -- but it is legal to use
/// `resolve_type_vars_if_possible` as well as `fully_resolve`.
/// `resolve_vars_if_possible` as well as `fully_resolve`.
pub fn resolve_regions_and_report_errors(
&self,
region_context: DefId,
@@ -1262,7 +1262,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}

pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {
self.resolve_type_vars_if_possible(&t).to_string()
self.resolve_vars_if_possible(&t).to_string()
}

pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {
@@ -1271,7 +1271,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}

pub fn trait_ref_to_string(&self, t: &ty::TraitRef<'tcx>) -> String {
self.resolve_type_vars_if_possible(t).to_string()
self.resolve_vars_if_possible(t).to_string()
}

/// If `TyVar(vid)` resolves to a type, return that type. Else, return the
@@ -1297,28 +1297,28 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
self.type_variables.borrow_mut().root_var(var)
}

/// Where possible, replaces type/int/float variables in
/// Where possible, replaces type/const variables in
/// `value` with their final value. Note that region variables
/// are unaffected. If a type variable has not been unified, it
/// are unaffected. If a type/const variable has not been unified, it
/// is left as is. This is an idempotent operation that does
/// not affect inference state in any way and so you can do it
/// at will.
pub fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T
pub fn resolve_vars_if_possible<T>(&self, value: &T) -> T
where
T: TypeFoldable<'tcx>,
{
if !value.needs_infer() {
return value.clone(); // avoid duplicated subst-folding
}
let mut r = resolve::OpportunisticTypeResolver::new(self);
let mut r = resolve::OpportunisticVarResolver::new(self);
value.fold_with(&mut r)
}

/// Returns first unresolved variable contained in `T`. In the
/// process of visiting `T`, this will resolve (where possible)
/// type variables in `T`, but it never constructs the final,
/// resolved type, so it's more efficient than
/// `resolve_type_vars_if_possible()`.
/// `resolve_vars_if_possible()`.
pub fn unresolved_type_vars<T>(&self, value: &T) -> Option<(Ty<'tcx>, Option<Span>)>
where
T: TypeFoldable<'tcx>,
@@ -1389,7 +1389,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
where
M: FnOnce(String) -> DiagnosticBuilder<'tcx>,
{
let actual_ty = self.resolve_type_vars_if_possible(&actual_ty);
let actual_ty = self.resolve_vars_if_possible(&actual_ty);
debug!("type_error_struct_with_diag({:?}, {:?})", sp, actual_ty);

// Don't report an error if actual type is `Error`.
@@ -1446,7 +1446,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
ty: Ty<'tcx>,
span: Span,
) -> bool {
let ty = self.resolve_type_vars_if_possible(&ty);
let ty = self.resolve_vars_if_possible(&ty);

// Even if the type may have no inference variables, during
// type-checking closure types are in local tables only.
2 changes: 1 addition & 1 deletion src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
@@ -286,7 +286,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {

let tcx = self.tcx;

let concrete_ty = self.resolve_type_vars_if_possible(&opaque_defn.concrete_ty);
let concrete_ty = self.resolve_vars_if_possible(&opaque_defn.concrete_ty);

debug!("constrain_opaque_type: concrete_ty={:?}", concrete_ty);

2 changes: 1 addition & 1 deletion src/librustc/infer/outlives/env.rs
Original file line number Diff line number Diff line change
@@ -168,7 +168,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> {
debug!("add_implied_bounds()");

for &ty in fn_sig_tys {
let ty = infcx.resolve_type_vars_if_possible(&ty);
let ty = infcx.resolve_vars_if_possible(&ty);
debug!("add_implied_bounds: ty = {}", ty);
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
self.add_outlives_bounds(Some(infcx), implied_bounds)
4 changes: 2 additions & 2 deletions src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
sup_type, sub_region, origin
);

let sup_type = self.resolve_type_vars_if_possible(&sup_type);
let sup_type = self.resolve_vars_if_possible(&sup_type);

if let Some(region_bound_pairs) = region_bound_pairs_map.get(&body_id) {
let outlives = &mut TypeOutlives::new(
@@ -215,7 +215,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
implicit_region_bound,
param_env,
);
let ty = self.resolve_type_vars_if_possible(&ty);
let ty = self.resolve_vars_if_possible(&ty);
outlives.type_must_outlive(origin, ty, region);
}
}
29 changes: 19 additions & 10 deletions src/librustc/infer/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
use super::{InferCtxt, FixupError, FixupResult, Span, type_variable::TypeVariableOrigin};
use crate::mir::interpret::ConstValue;
use crate::ty::{self, Ty, TyCtxt, TypeFoldable, InferConst};
use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst, TypeFlags};
use crate::ty::fold::{TypeFolder, TypeVisitor};

///////////////////////////////////////////////////////////////////////////
// OPPORTUNISTIC TYPE RESOLVER
// OPPORTUNISTIC VAR RESOLVER

/// The opportunistic type resolver can be used at any time. It simply replaces
/// type variables that have been unified with the things they have
/// The opportunistic resolver can be used at any time. It simply replaces
/// type/const variables that have been unified with the things they have
/// been unified with (similar to `shallow_resolve`, but deep). This is
/// useful for printing messages etc but also required at various
/// points for correctness.
pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
pub struct OpportunisticVarResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
}

impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> {
#[inline]
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
OpportunisticTypeResolver { infcx }
OpportunisticVarResolver { infcx }
}
}

impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> {
self.infcx.tcx
}
@@ -31,8 +31,17 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'g
if !t.has_infer_types() {
t // micro-optimize -- if there is nothing in this type that this fold affects...
} else {
let t0 = self.infcx.shallow_resolve(t);
t0.super_fold_with(self)
let t = self.infcx.shallow_resolve(t);
t.super_fold_with(self)
}
}

fn fold_const(&mut self, ct: &'tcx Const<'tcx>) -> &'tcx Const<'tcx> {
if !ct.has_type_flags(TypeFlags::HAS_CT_INFER) {
ct // micro-optimize -- if there is nothing in this const that this fold affects...
} else {
let ct = self.infcx.shallow_resolve(ct);
ct.super_fold_with(self)
}
}
}
Loading