@@ -69,6 +69,7 @@ use traits::{ObligationCause, ObligationCauseCode};
69
69
use ty:: { self , TyCtxt , TypeFoldable } ;
70
70
use ty:: { Region , Issue32330 } ;
71
71
use ty:: error:: TypeError ;
72
+ use syntax:: ast:: DUMMY_NODE_ID ;
72
73
use syntax_pos:: { Pos , Span } ;
73
74
use errors:: { DiagnosticBuilder , DiagnosticStyledString } ;
74
75
@@ -78,7 +79,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
78
79
pub fn note_and_explain_region ( self ,
79
80
err : & mut DiagnosticBuilder ,
80
81
prefix : & str ,
81
- region : & ' tcx ty:: Region ,
82
+ region : ty:: Region < ' tcx > ,
82
83
suffix : & str ) {
83
84
fn item_scope_tag ( item : & hir:: Item ) -> & ' static str {
84
85
match item. node {
@@ -123,14 +124,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
123
124
format ! ( "{}unknown scope: {:?}{}. Please report a bug." ,
124
125
prefix, scope, suffix)
125
126
} ;
126
- let span = match scope. span ( & self . region_maps , & self . hir ) {
127
+ let span = match scope. span ( & self . hir ) {
127
128
Some ( s) => s,
128
129
None => {
129
130
err. note ( & unknown_scope ( ) ) ;
130
131
return ;
131
132
}
132
133
} ;
133
- let tag = match self . hir . find ( scope. node_id ( & self . region_maps ) ) {
134
+ let tag = match self . hir . find ( scope. node_id ( ) ) {
134
135
Some ( hir_map:: NodeBlock ( _) ) => "block" ,
135
136
Some ( hir_map:: NodeExpr ( expr) ) => match expr. node {
136
137
hir:: ExprCall ( ..) => "call" ,
@@ -150,7 +151,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
150
151
return ;
151
152
}
152
153
} ;
153
- let scope_decorated_tag = match self . region_maps . code_extent_data ( scope) {
154
+ let scope_decorated_tag = match * scope {
154
155
region:: CodeExtentData :: Misc ( _) => tag,
155
156
region:: CodeExtentData :: CallSiteScope { .. } => {
156
157
"scope of call-site for function"
@@ -183,7 +184,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
183
184
}
184
185
} ;
185
186
186
- let node = fr. scope . node_id ( & self . region_maps ) ;
187
+ let node = fr. scope . map ( |s| s. node_id ( ) )
188
+ . unwrap_or ( DUMMY_NODE_ID ) ;
187
189
let unknown;
188
190
let tag = match self . hir . find ( node) {
189
191
Some ( hir_map:: NodeBlock ( _) ) |
@@ -515,7 +517,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
515
517
values. 1 . push_normal ( "<" ) ;
516
518
}
517
519
518
- fn lifetime_display ( lifetime : & Region ) -> String {
520
+ fn lifetime_display ( lifetime : Region ) -> String {
519
521
let s = format ! ( "{}" , lifetime) ;
520
522
if s. is_empty ( ) {
521
523
"'_" . to_string ( )
@@ -767,7 +769,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
767
769
fn report_generic_bound_failure ( & self ,
768
770
origin : SubregionOrigin < ' tcx > ,
769
771
bound_kind : GenericKind < ' tcx > ,
770
- sub : & ' tcx Region )
772
+ sub : Region < ' tcx > )
771
773
{
772
774
// FIXME: it would be better to report the first error message
773
775
// with the span of the parameter itself, rather than the span
@@ -846,9 +848,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
846
848
fn report_sub_sup_conflict ( & self ,
847
849
var_origin : RegionVariableOrigin ,
848
850
sub_origin : SubregionOrigin < ' tcx > ,
849
- sub_region : & ' tcx Region ,
851
+ sub_region : Region < ' tcx > ,
850
852
sup_origin : SubregionOrigin < ' tcx > ,
851
- sup_region : & ' tcx Region ) {
853
+ sup_region : Region < ' tcx > ) {
852
854
let mut err = self . report_inference_failure ( var_origin) ;
853
855
854
856
self . tcx . note_and_explain_region ( & mut err,
0 commit comments