Skip to content

Commit d0ab8f0

Browse files
committed
Convert tyvar_behind_raw_pointer to hard error for the 2018 epoch
1 parent 2cff123 commit d0ab8f0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/librustc_typeck/check/method/probe.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
326326
if reached_raw_pointer
327327
&& !self.tcx.sess.features.borrow().arbitrary_self_types {
328328
// this case used to be allowed by the compiler,
329-
// so we do a future-compat lint here
329+
// so we do a future-compat lint here for the 2015 epoch
330330
// (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"));
331+
if self.tcx.sess.rust_2018() {
332+
span_err!(self.tcx.sess, span, E0908,
333+
"the type of this value must be known \
334+
to call a method on a raw pointer on it");
335+
} else {
336+
self.tcx.lint_node(
337+
lint::builtin::TYVAR_BEHIND_RAW_POINTER,
338+
scope_expr_id,
339+
span,
340+
&format!("the type of this value must be known in this context"));
341+
}
336342
} else {
337343
let t = self.structurally_resolved_type(span, final_ty);
338344
assert_eq!(t, self.tcx.types.err);

src/librustc_typeck/diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,4 +4777,5 @@ register_diagnostics! {
47774777
E0641, // cannot cast to/from a pointer with an unknown kind
47784778
E0645, // trait aliases not finished
47794779
E0907, // type inside generator must be known in this context
4780+
E0908, // methods on raw pointers can only be called if the pointer type is fully known
47804781
}

0 commit comments

Comments
 (0)