@@ -26,7 +26,6 @@ use rustc::ty::{self, RegionVid, Ty, TypeFoldable};
26
26
use rustc:: util:: common:: ErrorReported ;
27
27
use rustc_data_structures:: bitvec:: BitVector ;
28
28
use rustc_data_structures:: indexed_vec:: IndexVec ;
29
- use rustc_errors:: DiagnosticBuilder ;
30
29
use std:: fmt;
31
30
use std:: rc:: Rc ;
32
31
use syntax:: ast;
@@ -435,7 +434,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
435
434
436
435
self . check_type_tests ( infcx, mir, mir_def_id, outlives_requirements. as_mut ( ) ) ;
437
436
438
- self . check_universal_regions ( infcx, mir , mir_def_id, outlives_requirements. as_mut ( ) ) ;
437
+ self . check_universal_regions ( infcx, mir_def_id, outlives_requirements. as_mut ( ) ) ;
439
438
440
439
let outlives_requirements = outlives_requirements. unwrap_or ( vec ! [ ] ) ;
441
440
@@ -897,7 +896,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
897
896
fn check_universal_regions < ' gcx > (
898
897
& self ,
899
898
infcx : & InferCtxt < ' _ , ' gcx , ' tcx > ,
900
- mir : & Mir < ' tcx > ,
901
899
mir_def_id : DefId ,
902
900
mut propagated_outlives_requirements : Option < & mut Vec < ClosureOutlivesRequirement < ' gcx > > > ,
903
901
) {
@@ -913,7 +911,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
913
911
for ( fr, _) in universal_definitions {
914
912
self . check_universal_region (
915
913
infcx,
916
- mir,
917
914
mir_def_id,
918
915
fr,
919
916
& mut propagated_outlives_requirements,
@@ -932,7 +929,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
932
929
fn check_universal_region < ' gcx > (
933
930
& self ,
934
931
infcx : & InferCtxt < ' _ , ' gcx , ' tcx > ,
935
- mir : & Mir < ' tcx > ,
936
932
mir_def_id : DefId ,
937
933
longer_fr : RegionVid ,
938
934
propagated_outlives_requirements : & mut Option < & mut Vec < ClosureOutlivesRequirement < ' gcx > > > ,
@@ -990,7 +986,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
990
986
// Note: in this case, we use the unapproximated regions
991
987
// to report the error. This gives better error messages
992
988
// in some cases.
993
- self . report_error ( infcx, mir , mir_def_id, longer_fr, shorter_fr, blame_span) ;
989
+ self . report_error ( infcx, mir_def_id, longer_fr, shorter_fr, blame_span) ;
994
990
}
995
991
}
996
992
@@ -1005,7 +1001,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1005
1001
fn report_error (
1006
1002
& self ,
1007
1003
infcx : & InferCtxt < ' _ , ' _ , ' tcx > ,
1008
- mir : & Mir < ' tcx > ,
1009
1004
mir_def_id : DefId ,
1010
1005
fr : RegionVid ,
1011
1006
outlived_fr : RegionVid ,
@@ -1039,12 +1034,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1039
1034
& format ! ( "{} does not outlive {}" , fr_string, outlived_fr_string, ) ,
1040
1035
) ;
1041
1036
1042
- // Find out why `fr` had to outlive `outlived_fr`...
1043
- let inferred_values = self . inferred_values . as_ref ( ) . unwrap ( ) ;
1044
- if let Some ( cause) = inferred_values. cause ( fr, outlived_fr) {
1045
- cause. label_diagnostic ( mir, & mut diag) ;
1046
- }
1047
-
1048
1037
diag. emit ( ) ;
1049
1038
}
1050
1039
@@ -1285,62 +1274,6 @@ impl CauseExt for Rc<Cause> {
1285
1274
}
1286
1275
1287
1276
impl Cause {
1288
- pub ( crate ) fn label_diagnostic ( & self , mir : & Mir < ' _ > , diag : & mut DiagnosticBuilder < ' _ > ) {
1289
- // The cause information is pretty messy. Only dump it as an
1290
- // internal debugging aid if -Znll-dump-cause is given.
1291
- let nll_dump_cause = ty:: tls:: with ( |tcx| tcx. sess . nll_dump_cause ( ) ) ;
1292
- if !nll_dump_cause {
1293
- return ;
1294
- }
1295
-
1296
- let mut string = String :: new ( ) ;
1297
- self . push_diagnostic_string ( mir, & mut string) ;
1298
- diag. note ( & string) ;
1299
- }
1300
-
1301
- fn push_diagnostic_string ( & self , mir : & Mir < ' _ > , string : & mut String ) {
1302
- match self {
1303
- Cause :: LiveVar ( local, location) => {
1304
- string. push_str ( & format ! ( "because `{:?}` is live at {:?}" , local, location) ) ;
1305
- }
1306
-
1307
- Cause :: DropVar ( local, location) => {
1308
- string. push_str ( & format ! (
1309
- "because `{:?}` is dropped at {:?}" ,
1310
- local,
1311
- location
1312
- ) ) ;
1313
- }
1314
-
1315
- Cause :: LiveOther ( location) => {
1316
- string. push_str ( & format ! (
1317
- "because of a general liveness constraint at {:?}" ,
1318
- location
1319
- ) ) ;
1320
- }
1321
-
1322
- Cause :: UniversalRegion ( region_vid) => {
1323
- string. push_str ( & format ! (
1324
- "because `{:?}` is universally quantified" ,
1325
- region_vid
1326
- ) ) ;
1327
- }
1328
-
1329
- Cause :: Outlives {
1330
- original_cause,
1331
- constraint_location,
1332
- constraint_span : _,
1333
- } => {
1334
- string. push_str ( & format ! (
1335
- "because of an outlives relation created at `{:?}`\n " ,
1336
- constraint_location
1337
- ) ) ;
1338
-
1339
- original_cause. push_diagnostic_string ( mir, string) ;
1340
- }
1341
- }
1342
- }
1343
-
1344
1277
pub ( crate ) fn root_cause ( & self ) -> & Cause {
1345
1278
match self {
1346
1279
Cause :: LiveVar ( ..) |
0 commit comments