about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-02-05 01:45:43 +0530
committerManish Goregaokar <manishsmail@gmail.com>2018-02-05 22:16:42 -0500
commitd0ab8f03bbc0e0694b6b8c411c5b39b89c2fe821 (patch)
treea5277ef47d5b23151aa4dd5c728fedd9eee5b626
parent2cff123416cf62648ddbe7aab387aabe1a01314f (diff)
downloadrust-d0ab8f03bbc0e0694b6b8c411c5b39b89c2fe821.tar.gz
rust-d0ab8f03bbc0e0694b6b8c411c5b39b89c2fe821.zip
Convert tyvar_behind_raw_pointer to hard error for the 2018 epoch
-rw-r--r--src/librustc_typeck/check/method/probe.rs18
-rw-r--r--src/librustc_typeck/diagnostics.rs1
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
 }