@@ -27,6 +27,7 @@ use syntax::ast;
2727use syntax:: util:: lev_distance:: { lev_distance, find_best_match_for_name} ;
2828use syntax_pos:: Span ;
2929use rustc:: hir;
30+ use rustc:: lint;
3031use std:: mem;
3132use std:: ops:: Deref ;
3233use std:: rc:: Rc ;
@@ -249,7 +250,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
249250 // think cause spurious errors. Really though this part should
250251 // take place in the `self.probe` below.
251252 let steps = if mode == Mode :: MethodCall {
252- match self . create_steps ( span, self_ty, is_suggestion) {
253+ match self . create_steps ( span, scope_expr_id , self_ty, is_suggestion) {
253254 Some ( steps) => steps,
254255 None => {
255256 return Err ( MethodError :: NoMatch ( NoMatchData :: new ( Vec :: new ( ) ,
@@ -291,6 +292,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
291292
292293 fn create_steps ( & self ,
293294 span : Span ,
295+ scope_expr_id : ast:: NodeId ,
294296 self_ty : Ty < ' tcx > ,
295297 is_suggestion : IsSuggestion )
296298 -> Option < Vec < CandidateStep < ' tcx > > > {
@@ -318,18 +320,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
318320 match final_ty. sty {
319321 ty:: TyInfer ( ty:: TyVar ( _) ) => {
320322 // Ended in an inference variable. If we are doing
321- // a real method lookup, this is a hard error ( it's an
322- // ambiguity and we can't make progress) .
323+ // a real method lookup, this is a hard error because it's
324+ // possible that there will be multiple applicable methods .
323325 if !is_suggestion. 0 {
324326 if reached_raw_pointer
325327 && !self . tcx . sess . features . borrow ( ) . arbitrary_self_types {
326- // only produce a warning in this case, because inference variables used to
327- // be allowed here in some cases for raw pointers
328- struct_span_warn ! ( self . tcx. sess, span, E0619 ,
329- "the type of this value must be known in this context" )
330- . note ( "this will be made into a hard error in a future version of \
331- the compiler")
332- . emit ( ) ;
328+ // this case used to be allowed by the compiler,
329+ // so we do a future-compat lint here
330+ // (see https://github.com/rust-lang/rust/issues/46906)
331+ self . tcx . lint_node (
332+ lint:: builtin:: TYVAR_BEHIND_RAW_POINTER ,
333+ scope_expr_id,
334+ span,
335+ & format ! ( "the type of this value must be known in this context" ) ) ;
333336 } else {
334337 let t = self . structurally_resolved_type ( span, final_ty) ;
335338 assert_eq ! ( t, self . tcx. types. err) ;
0 commit comments