Skip to content

Commit 4b9d803

Browse files
committed
Auto merge of #61296 - Centril:rollup-5ad68b0, r=Centril
Rollup of 9 pull requests Successful merges: - #60742 (Allow const parameters in array sizes to be unified) - #60756 (Add better tests for hidden lifetimes in impl trait) - #60928 (Changes the type `mir::Mir` into `mir::Body`) - #61024 (tests: Centralize proc macros commonly used for testing) - #61157 (BufReader: In Seek impl, remove extra discard_buffer call) - #61195 (Special-case `.llvm` in mangler) - #61202 (Print PermissionExt::mode() in octal in Documentation Examples) - #61259 (Mailmap fixes) - #61273 (mention that MaybeUninit is a bit like Option) Failed merges: r? @ghost
2 parents 7212685 + 9121a73 commit 4b9d803

File tree

242 files changed

+1573
-1309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+1573
-1309
lines changed

.mailmap

+16-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# email addresses.
66
#
77

8-
Aaron Todd <github@opprobrio.us>
98
Aaron Power <theaaronepower@gmail.com> Erin Power <xampprocky@gmail.com>
9+
Aaron Todd <github@opprobrio.us>
1010
Abhishek Chanda <abhishek.becs@gmail.com> Abhishek Chanda <abhishek@cloudscaling.com>
1111
Adolfo Ochagavía <aochagavia92@gmail.com>
1212
Adrien Tétar <adri-from-59@hotmail.fr>
@@ -29,8 +29,8 @@ Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> Ariel Ben-Yehuda <ariel.byd@gmail.com>
2929
Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> arielb1 <arielb1@mail.tau.ac.il>
3030
Austin Seipp <mad.one@gmail.com> <as@hacks.yi.org>
3131
Aydin Kim <ladinjin@hanmail.net> aydin.kim <aydin.kim@samsung.com>
32-
Bastian Kauschke <bastian_kauschke@hotmail.de>
3332
Barosl Lee <vcs@barosl.com> Barosl LEE <github@barosl.com>
33+
Bastian Kauschke <bastian_kauschke@hotmail.de>
3434
Ben Alpert <ben@benalpert.com> <spicyjalapeno@gmail.com>
3535
Ben Sago <ogham@users.noreply.github.com> Ben S <ogham@bsago.me>
3636
Ben Sago <ogham@users.noreply.github.com> Ben S <ogham@users.noreply.github.com>
@@ -46,22 +46,23 @@ Brian Anderson <banderson@mozilla.com> <banderson@mozilla.org>
4646
Brian Dawn <brian.t.dawn@gmail.com>
4747
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
4848
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
49+
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <193874+carols10cents@users.noreply.github.com>
50+
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <carol.nichols@gmail.com>
4951
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <cnichols@thinkthroughmath.com>
50-
Carol (Nichols || Goulding) <carol.nichols@gmail.com> Carol Nichols <carol.nichols@gmail.com>
5152
Carol Willing <carolcode@willingconsulting.com>
5253
Chris C Cerami <chrisccerami@users.noreply.github.com> Chris C Cerami <chrisccerami@gmail.com>
5354
Chris Pressey <cpressey@gmail.com>
5455
Chris Thorn <chris@thorn.co> Chris Thorn <thorn@thoughtbot.com>
5556
Chris Vittal <christopher.vittal@gmail.com> Christopher Vittal <christopher.vittal@gmail.com>
56-
Christian Poveda <christianpoveda@protonmail.com> <z1mvader@protonmail.com>
5757
Christian Poveda <christianpoveda@protonmail.com> <cn.poveda.ruiz@gmail.com>
58+
Christian Poveda <christianpoveda@protonmail.com> <z1mvader@protonmail.com>
5859
Clark Gaebel <cg.wowus.cg@gmail.com> <cgaebel@mozilla.com>
5960
Clinton Ryan <clint.ryan3@gmail.com>
6061
Corey Richardson <corey@octayn.net> Elaine "See More" Nemo <corey@octayn.net>
6162
Cyryl Płotnicki <cyplo@cyplo.net>
6263
Damien Schoof <damien.schoof@gmail.com>
63-
Daniel Ramos <dan@daramos.com>
6464
Daniel J Rollins <drollins@financialforce.com>
65+
Daniel Ramos <dan@daramos.com>
6566
David Klein <david.klein@baesystemsdetica.com>
6667
David Manescu <david.manescu@gmail.com> <dman2626@uni.sydney.edu.au>
6768
David Ross <daboross@daboross.net>
@@ -70,18 +71,18 @@ Diggory Hardy <diggory.hardy@gmail.com> Diggory Hardy <github@dhardy.name>
7071
Dylan Braithwaite <dylanbraithwaite1@gmail.com> <mail@dylanb.me>
7172
Dzmitry Malyshau <kvarkus@gmail.com>
7273
E. Dunham <edunham@mozilla.com> edunham <edunham@mozilla.com>
74+
Eduard-Mihai Burtescu <edy.burt@gmail.com>
7375
Eduardo Bautista <me@eduardobautista.com> <=>
7476
Eduardo Bautista <me@eduardobautista.com> <mail@eduardobautista.com>
75-
Eduard-Mihai Burtescu <edy.burt@gmail.com>
7677
Elliott Slaughter <elliottslaughter@gmail.com> <eslaughter@mozilla.com>
7778
Elly Fong-Jones <elly@leptoquark.net>
7879
Eric Holk <eric.holk@gmail.com> <eholk@cs.indiana.edu>
7980
Eric Holk <eric.holk@gmail.com> <eholk@mozilla.com>
8081
Eric Holmes <eric@ejholmes.net>
8182
Eric Reed <ecreed@cs.washington.edu> <ereed@mozilla.com>
8283
Erick Tryzelaar <erick.tryzelaar@gmail.com> <etryzelaar@iqt.org>
83-
Esteban Küber <esteban@kuber.com.ar> <estebank@users.noreply.github.com>
8484
Esteban Küber <esteban@kuber.com.ar> <esteban@commure.com>
85+
Esteban Küber <esteban@kuber.com.ar> <estebank@users.noreply.github.com>
8586
Esteban Küber <esteban@kuber.com.ar> <github@kuber.com.ar>
8687
Evgeny Sologubov
8788
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
@@ -102,9 +103,9 @@ Herman J. Radtke III <herman@hermanradtke.com> Herman J. Radtke III <hermanradtk
102103
Ilyong Cho <ilyoan@gmail.com>
103104
Ivan Ivaschenko <defuz.net@gmail.com>
104105
J. J. Weber <jjweber@gmail.com>
106+
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
105107
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub@jakub.cc>
106108
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakubw@jakubw.net>
107-
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
108109
James Deng <cnjamesdeng@gmail.com> <cnJamesDeng@gmail.com>
109110
James Miller <bladeon@gmail.com> <james@aatch.net>
110111
James Perry <james.austin.perry@gmail.com>
@@ -119,6 +120,7 @@ Jethro Beekman <github@jbeekman.nl>
119120
Jihyun Yu <j.yu@navercorp.com> <yjh0502@gmail.com>
120121
Jihyun Yu <j.yu@navercorp.com> jihyun <jihyun@nablecomm.com>
121122
Jihyun Yu <j.yu@navercorp.com> Jihyun Yu <jihyun@nclab.kaist.ac.kr>
123+
João Oliveira <hello@jxs.pt> joaoxsouls <joaoxsouls@gmail.com>
122124
Johann Hofmann <git@johann-hofmann.com> Johann <git@johann-hofmann.com>
123125
John Clements <clements@racket-lang.org> <clements@brinckerhoff.org>
124126
John Hodge <acessdev@gmail.com> John Hodge <tpg@mutabah.net>
@@ -129,7 +131,8 @@ Jonathan S <gereeter@gmail.com> Jonathan S <gereeter+code@gmail.com>
129131
Jonathan Turner <probata@hotmail.com>
130132
Jorge Aparicio <japaric@linux.com> <japaricious@gmail.com>
131133
Joseph Martin <pythoner6@gmail.com>
132-
João Oliveira <hello@jxs.pt> joaoxsouls <joaoxsouls@gmail.com>
134+
Joseph T. Lyons <JosephTLyons@gmail.com> <josephtlyons@gmail.com>
135+
Joseph T. Lyons <JosephTLyons@gmail.com> <JosephTLyons@users.noreply.github.com>
133136
Junyoung Cho <june0.cho@samsung.com>
134137
Jyun-Yan You <jyyou.tw@gmail.com> <jyyou@cs.nctu.edu.tw>
135138
Kang Seonghoon <kang.seonghoon@mearie.org> <public+git@mearie.org>
@@ -145,8 +148,6 @@ Lindsey Kuper <lindsey@composition.al> <lkuper@mozilla.com>
145148
Luke Metz <luke.metz@students.olin.edu>
146149
Luqman Aden <me@luqman.ca> <laden@csclub.uwaterloo.ca>
147150
Luqman Aden <me@luqman.ca> <laden@mozilla.com>
148-
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
149-
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
150151
Marcell Pardavi <marcell.pardavi@gmail.com>
151152
Margaret Meyerhofer <mmeyerho@andrew.cmu.edu> <mmeyerho@andrew>
152153
Mark Rousskov <mark.simulacrum@gmail.com>
@@ -167,12 +168,14 @@ Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
167168
Mickaël Raybaud-Roig <raybaudroigm@gmail.com> m-r-r <raybaudroigm@gmail.com>
168169
Ms2ger <ms2ger@gmail.com> <Ms2ger@gmail.com>
169170
Mukilan Thiagarajan <mukilanthiagarajan@gmail.com>
171+
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm@gmail.com>
172+
NAKASHIMA, Makoto <makoto.nksm+github@gmail.com> <makoto.nksm+github@gmail.com>
170173
Nathan West <Lucretiel@gmail.com> <lucretiel@gmail.com>
171174
Nathan Wilson <wilnathan@gmail.com>
172175
Nathaniel Herman <nherman@post.harvard.edu> Nathaniel Herman <nherman@college.harvard.edu>
173176
Neil Pankey <npankey@gmail.com> <neil@wire.im>
174-
Nicole Mazzuca <npmazzuca@gmail.com>
175177
Nick Platt <platt.nicholas@gmail.com>
178+
Nicole Mazzuca <npmazzuca@gmail.com>
176179
Nif Ward <nif.ward@gmail.com>
177180
Oliver Schneider <oliver.schneider@kit.edu> oli-obk <github6541940@oli-obk.de>
178181
Oliver Schneider <oliver.schneider@kit.edu> Oliver 'ker' Schneider <rust19446194516@oli-obk.de>
@@ -230,8 +233,8 @@ Tim JIANG <p90eri@gmail.com>
230233
Tim Joseph Dumol <tim@timdumol.com>
231234
Torsten Weber <TorstenWeber12@gmail.com> <torstenweber12@gmail.com>
232235
Ty Overby <ty@pre-alpha.com>
233-
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss>
234236
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss@users.noreply.github.com>
237+
Ulrik Sverdrup <bluss@users.noreply.github.com> bluss <bluss>
235238
Ulrik Sverdrup <bluss@users.noreply.github.com> Ulrik Sverdrup <root@localhost>
236239
Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
237240
Vadim Petrochenkov <vadim.petrochenkov@gmail.com> petrochenkov <vadim.petrochenkov@gmail.com>

src/libcore/mem.rs

+3
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,9 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
966966
///
967967
/// The compiler then knows to not make any incorrect assumptions or optimizations on this code.
968968
///
969+
/// You can think of `MaybeUninit<T>` as being a bit like `Option<T>` but without
970+
/// any of the run-time tracking and without any of the safety checks.
971+
///
969972
/// ## out-pointers
970973
///
971974
/// You can use `MaybeUninit<T>` to implement "out-pointers": instead of returning data

src/librustc/infer/error_reporting/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
652652
for sp in prior_arms {
653653
err.span_label(*sp, format!(
654654
"this is found to be of type `{}`",
655-
self.resolve_type_vars_if_possible(&last_ty),
655+
self.resolve_vars_if_possible(&last_ty),
656656
));
657657
}
658658
} else if let Some(sp) = prior_arms.last() {
@@ -1278,7 +1278,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12781278
&self,
12791279
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
12801280
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
1281-
let exp_found = self.resolve_type_vars_if_possible(exp_found);
1281+
let exp_found = self.resolve_vars_if_possible(exp_found);
12821282
if exp_found.references_error() {
12831283
return None;
12841284
}
@@ -1291,7 +1291,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12911291
&self,
12921292
exp_found: &ty::error::ExpectedFound<T>,
12931293
) -> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
1294-
let exp_found = self.resolve_type_vars_if_possible(exp_found);
1294+
let exp_found = self.resolve_vars_if_possible(exp_found);
12951295
if exp_found.references_error() {
12961296
return None;
12971297
}

src/librustc/infer/error_reporting/need_type_info.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
2424
});
2525
match ty_opt {
2626
Some(ty) => {
27-
let ty = self.infcx.resolve_type_vars_if_possible(&ty);
27+
let ty = self.infcx.resolve_vars_if_possible(&ty);
2828
ty.walk().any(|inner_ty| {
2929
inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
3030
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
@@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
9494
span: Span,
9595
ty: Ty<'tcx>
9696
) -> DiagnosticBuilder<'gcx> {
97-
let ty = self.resolve_type_vars_if_possible(&ty);
97+
let ty = self.resolve_vars_if_possible(&ty);
9898
let name = self.extract_type_name(&ty, None);
9999

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

172172
let mut err = struct_span_err!(self.tcx.sess,

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
210210
_ => (),
211211
}
212212

213-
let expected_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef {
213+
let expected_trait_ref = self.infcx.resolve_vars_if_possible(&ty::TraitRef {
214214
def_id: trait_def_id,
215215
substs: expected_substs,
216216
});
217-
let actual_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef {
217+
let actual_trait_ref = self.infcx.resolve_vars_if_possible(&ty::TraitRef {
218218
def_id: trait_def_id,
219219
substs: actual_substs,
220220
});

src/librustc/infer/fudge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
7474
let (mut fudger, value) = self.probe(|snapshot| {
7575
match f() {
7676
Ok(value) => {
77-
let value = self.resolve_type_vars_if_possible(&value);
77+
let value = self.resolve_vars_if_possible(&value);
7878

7979
// At this point, `value` could in principle refer
8080
// to inference variables that have been created during

src/librustc/infer/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11741174
/// Process the region constraints and report any errors that
11751175
/// result. After this, no more unification operations should be
11761176
/// done -- or the compiler will panic -- but it is legal to use
1177-
/// `resolve_type_vars_if_possible` as well as `fully_resolve`.
1177+
/// `resolve_vars_if_possible` as well as `fully_resolve`.
11781178
pub fn resolve_regions_and_report_errors(
11791179
&self,
11801180
region_context: DefId,
@@ -1262,7 +1262,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12621262
}
12631263

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

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

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

12771277
/// 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> {
12971297
self.type_variables.borrow_mut().root_var(var)
12981298
}
12991299

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

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

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

14511451
// Even if the type may have no inference variables, during
14521452
// type-checking closure types are in local tables only.

src/librustc/infer/opaque_types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
286286

287287
let tcx = self.tcx;
288288

289-
let concrete_ty = self.resolve_type_vars_if_possible(&opaque_defn.concrete_ty);
289+
let concrete_ty = self.resolve_vars_if_possible(&opaque_defn.concrete_ty);
290290

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

src/librustc/infer/outlives/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> {
168168
debug!("add_implied_bounds()");
169169

170170
for &ty in fn_sig_tys {
171-
let ty = infcx.resolve_type_vars_if_possible(&ty);
171+
let ty = infcx.resolve_vars_if_possible(&ty);
172172
debug!("add_implied_bounds: ty = {}", ty);
173173
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
174174
self.add_outlives_bounds(Some(infcx), implied_bounds)

src/librustc/infer/outlives/obligations.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
177177
sup_type, sub_region, origin
178178
);
179179

180-
let sup_type = self.resolve_type_vars_if_possible(&sup_type);
180+
let sup_type = self.resolve_vars_if_possible(&sup_type);
181181

182182
if let Some(region_bound_pairs) = region_bound_pairs_map.get(&body_id) {
183183
let outlives = &mut TypeOutlives::new(
@@ -215,7 +215,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
215215
implicit_region_bound,
216216
param_env,
217217
);
218-
let ty = self.resolve_type_vars_if_possible(&ty);
218+
let ty = self.resolve_vars_if_possible(&ty);
219219
outlives.type_must_outlive(origin, ty, region);
220220
}
221221
}

src/librustc/infer/resolve.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
use super::{InferCtxt, FixupError, FixupResult, Span, type_variable::TypeVariableOrigin};
22
use crate::mir::interpret::ConstValue;
3-
use crate::ty::{self, Ty, TyCtxt, TypeFoldable, InferConst};
3+
use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst, TypeFlags};
44
use crate::ty::fold::{TypeFolder, TypeVisitor};
55

66
///////////////////////////////////////////////////////////////////////////
7-
// OPPORTUNISTIC TYPE RESOLVER
7+
// OPPORTUNISTIC VAR RESOLVER
88

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

18-
impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
18+
impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> {
1919
#[inline]
2020
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
21-
OpportunisticTypeResolver { infcx }
21+
OpportunisticVarResolver { infcx }
2222
}
2323
}
2424

25-
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
25+
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> {
2626
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> {
2727
self.infcx.tcx
2828
}
@@ -31,8 +31,17 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'g
3131
if !t.has_infer_types() {
3232
t // micro-optimize -- if there is nothing in this type that this fold affects...
3333
} else {
34-
let t0 = self.infcx.shallow_resolve(t);
35-
t0.super_fold_with(self)
34+
let t = self.infcx.shallow_resolve(t);
35+
t.super_fold_with(self)
36+
}
37+
}
38+
39+
fn fold_const(&mut self, ct: &'tcx Const<'tcx>) -> &'tcx Const<'tcx> {
40+
if !ct.has_type_flags(TypeFlags::HAS_CT_INFER) {
41+
ct // micro-optimize -- if there is nothing in this const that this fold affects...
42+
} else {
43+
let ct = self.infcx.shallow_resolve(ct);
44+
ct.super_fold_with(self)
3645
}
3746
}
3847
}

0 commit comments

Comments
 (0)