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
Show file tree
Hide file tree
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
Expand Up @@ -5,8 +5,8 @@
# email addresses.
#

Aaron Todd <github@opprobrio.us>
Aaron Power <theaaronepower@gmail.com> Erin Power <xampprocky@gmail.com>
Aaron Todd <github@opprobrio.us>
Abhishek Chanda <abhishek.becs@gmail.com> Abhishek Chanda <abhishek@cloudscaling.com>
Adolfo Ochagavía <aochagavia92@gmail.com>
Adrien Tétar <adri-from-59@hotmail.fr>
Expand All @@ -29,8 +29,8 @@ Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> Ariel Ben-Yehuda <ariel.byd@gmail.com>
Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> arielb1 <arielb1@mail.tau.ac.il>
Austin Seipp <mad.one@gmail.com> <as@hacks.yi.org>
Aydin Kim <ladinjin@hanmail.net> aydin.kim <aydin.kim@samsung.com>
Bastian Kauschke <bastian_kauschke@hotmail.de>
Barosl Lee <vcs@barosl.com> Barosl LEE <github@barosl.com>
Bastian Kauschke <bastian_kauschke@hotmail.de>
Ben Alpert <ben@benalpert.com> <spicyjalapeno@gmail.com>
Ben Sago <ogham@users.noreply.github.com> Ben S <ogham@bsago.me>
Ben Sago <ogham@users.noreply.github.com> Ben S <ogham@users.noreply.github.com>
Expand All @@ -46,22 +46,23 @@ Brian Anderson <banderson@mozilla.com> <banderson@mozilla.org>
Brian Dawn <brian.t.dawn@gmail.com>
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <193874+carols10cents@users.noreply.github.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <carol.nichols@gmail.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <cnichols@thinkthroughmath.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> Carol Nichols <carol.nichols@gmail.com>
Carol Willing <carolcode@willingconsulting.com>
Chris C Cerami <chrisccerami@users.noreply.github.com> Chris C Cerami <chrisccerami@gmail.com>
Chris Pressey <cpressey@gmail.com>
Chris Thorn <chris@thorn.co> Chris Thorn <thorn@thoughtbot.com>
Chris Vittal <christopher.vittal@gmail.com> Christopher Vittal <christopher.vittal@gmail.com>
Christian Poveda <christianpoveda@protonmail.com> <z1mvader@protonmail.com>
Christian Poveda <christianpoveda@protonmail.com> <cn.poveda.ruiz@gmail.com>
Christian Poveda <christianpoveda@protonmail.com> <z1mvader@protonmail.com>
Clark Gaebel <cg.wowus.cg@gmail.com> <cgaebel@mozilla.com>
Clinton Ryan <clint.ryan3@gmail.com>
Corey Richardson <corey@octayn.net> Elaine "See More" Nemo <corey@octayn.net>
Cyryl Płotnicki <cyplo@cyplo.net>
Damien Schoof <damien.schoof@gmail.com>
Daniel Ramos <dan@daramos.com>
Daniel J Rollins <drollins@financialforce.com>
Daniel Ramos <dan@daramos.com>
David Klein <david.klein@baesystemsdetica.com>
David Manescu <david.manescu@gmail.com> <dman2626@uni.sydney.edu.au>
David Ross <daboross@daboross.net>
Expand All @@ -70,18 +71,18 @@ Diggory Hardy <diggory.hardy@gmail.com> Diggory Hardy <github@dhardy.name>
Dylan Braithwaite <dylanbraithwaite1@gmail.com> <mail@dylanb.me>
Dzmitry Malyshau <kvarkus@gmail.com>
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
Eduard-Mihai Burtescu <edy.burt@gmail.com>
Eduardo Bautista <me@eduardobautista.com> <=>
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
Eduard-Mihai Burtescu <edy.burt@gmail.com>
Elliott Slaughter <elliottslaughter@gmail.com> <eslaughter@mozilla.com>
Elly Fong-Jones <elly@leptoquark.net>
Eric Holk <eric.holk@gmail.com> <eholk@cs.indiana.edu>
Eric Holk <eric.holk@gmail.com> <eholk@mozilla.com>
Eric Holmes <eric@ejholmes.net>
Eric Reed <ecreed@cs.washington.edu> <ereed@mozilla.com>
Erick Tryzelaar <erick.tryzelaar@gmail.com> <etryzelaar@iqt.org>
Esteban Küber <esteban@kuber.com.ar> <estebank@users.noreply.github.com>
Esteban Küber <esteban@kuber.com.ar> <esteban@commure.com>
Esteban Küber <esteban@kuber.com.ar> <estebank@users.noreply.github.com>
Esteban Küber <esteban@kuber.com.ar> <github@kuber.com.ar>
Evgeny Sologubov
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
Expand All @@ -102,9 +103,9 @@ Herman J. Radtke III <herman@hermanradtke.com> Herman J. Radtke III <hermanradtk
Ilyong Cho <ilyoan@gmail.com>
Ivan Ivaschenko <defuz.net@gmail.com>
J. J. Weber <jjweber@gmail.com>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub@jakub.cc>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakubw@jakubw.net>
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
James Deng <cnjamesdeng@gmail.com> <cnJamesDeng@gmail.com>
James Miller <bladeon@gmail.com> <james@aatch.net>
James Perry <james.austin.perry@gmail.com>
Expand All @@ -119,6 +120,7 @@ Jethro Beekman <github@jbeekman.nl>
Jihyun Yu <j.yu@navercorp.com> <yjh0502@gmail.com>
Jihyun Yu <j.yu@navercorp.com> jihyun <jihyun@nablecomm.com>
Jihyun Yu <j.yu@navercorp.com> Jihyun Yu <jihyun@nclab.kaist.ac.kr>
João Oliveira <hello@jxs.pt> joaoxsouls <joaoxsouls@gmail.com>
Johann Hofmann <git@johann-hofmann.com> Johann <git@johann-hofmann.com>
John Clements <clements@racket-lang.org> <clements@brinckerhoff.org>
John Hodge <acessdev@gmail.com> John Hodge <tpg@mutabah.net>
Expand All @@ -129,7 +131,8 @@ Jonathan S <gereeter@gmail.com> Jonathan S <gereeter+code@gmail.com>
Jonathan Turner <probata@hotmail.com>
Jorge Aparicio <japaric@linux.com> <japaricious@gmail.com>
Joseph Martin <pythoner6@gmail.com>
João Oliveira <hello@jxs.pt> joaoxsouls <joaoxsouls@gmail.com>
Joseph T. Lyons <JosephTLyons@gmail.com> <josephtlyons@gmail.com>
Joseph T. Lyons <JosephTLyons@gmail.com> <JosephTLyons@users.noreply.github.com>
Junyoung Cho <june0.cho@samsung.com>
Jyun-Yan You <jyyou.tw@gmail.com> <jyyou@cs.nctu.edu.tw>
Kang Seonghoon <kang.seonghoon@mearie.org> <public+git@mearie.org>
Expand All @@ -145,8 +148,6 @@ Lindsey Kuper <lindsey@composition.al> <lkuper@mozilla.com>
Luke Metz <luke.metz@students.olin.edu>
Luqman Aden <me@luqman.ca> <laden@csclub.uwaterloo.ca>
Luqman Aden <me@luqman.ca> <laden@mozilla.com>
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
Marcell Pardavi <marcell.pardavi@gmail.com>
Margaret Meyerhofer <mmeyerho@andrew.cmu.edu> <mmeyerho@andrew>
Mark Rousskov <mark.simulacrum@gmail.com>
Expand All @@ -167,12 +168,14 @@ Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
Mickaël Raybaud-Roig <raybaudroigm@gmail.com> m-r-r <raybaudroigm@gmail.com>
Ms2ger <ms2ger@gmail.com> <Ms2ger@gmail.com>
Mukilan Thiagarajan <mukilanthiagarajan@gmail.com>
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
Nathan West <Lucretiel@gmail.com> <lucretiel@gmail.com>
Nathan Wilson <wilnathan@gmail.com>
Nathaniel Herman <nherman@post.harvard.edu> Nathaniel Herman <nherman@college.harvard.edu>
Neil Pankey <npankey@gmail.com> <neil@wire.im>
Nicole Mazzuca <npmazzuca@gmail.com>
Nick Platt <platt.nicholas@gmail.com>
Nicole Mazzuca <npmazzuca@gmail.com>
Nif Ward <nif.ward@gmail.com>
Oliver Schneider <oliver.schneider@kit.edu> oli-obk <github6541940@oli-obk.de>
Oliver Schneider <oliver.schneider@kit.edu> Oliver 'ker' Schneider <rust19446194516@oli-obk.de>
Expand Down Expand Up @@ -230,8 +233,8 @@ Tim JIANG <p90eri@gmail.com>
Tim Joseph Dumol <tim@timdumol.com>
Torsten Weber <TorstenWeber12@gmail.com> <torstenweber12@gmail.com>
Ty Overby <ty@pre-alpha.com>
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss>
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss@users.noreply.github.com>
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss>
Ulrik Sverdrup <bluss@users.noreply.github.com> Ulrik Sverdrup <root@localhost>
Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Vadim Petrochenkov <vadim.petrochenkov@gmail.com> petrochenkov <vadim.petrochenkov@gmail.com>
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
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
Expand Up @@ -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))) => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/fudge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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>,
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/outlives/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}
}
Expand Down
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
}
Expand All @@ -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)
}
}
}
Expand Down
Loading