From d0ab8f03bbc0e0694b6b8c411c5b39b89c2fe821 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 5 Feb 2018 01:45:43 +0530 Subject: [PATCH] Convert tyvar_behind_raw_pointer to hard error for the 2018 epoch --- src/librustc_typeck/check/method/probe.rs | 18 ++++++++++++------ src/librustc_typeck/diagnostics.rs | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index c88bbd03af8..e8c3966f23f 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -326,13 +326,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if reached_raw_pointer && !self.tcx.sess.features.borrow().arbitrary_self_types { // this case used to be allowed by the compiler, - // so we do a future-compat lint here + // so we do a future-compat lint here for the 2015 epoch // (see https://github.com/rust-lang/rust/issues/46906) - self.tcx.lint_node( - lint::builtin::TYVAR_BEHIND_RAW_POINTER, - scope_expr_id, - span, - &format!("the type of this value must be known in this context")); + if self.tcx.sess.rust_2018() { + span_err!(self.tcx.sess, span, E0908, + "the type of this value must be known \ + to call a method on a raw pointer on it"); + } else { + self.tcx.lint_node( + lint::builtin::TYVAR_BEHIND_RAW_POINTER, + scope_expr_id, + span, + &format!("the type of this value must be known in this context")); + } } else { let t = self.structurally_resolved_type(span, final_ty); assert_eq!(t, self.tcx.types.err); diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index ac7f54250d3..ea9b5473ed1 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4777,4 +4777,5 @@ register_diagnostics! { E0641, // cannot cast to/from a pointer with an unknown kind E0645, // trait aliases not finished E0907, // type inside generator must be known in this context + E0908, // methods on raw pointers can only be called if the pointer type is fully known }