about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-08-08 09:55:42 +0000
committerbors <bors@rust-lang.org>2015-08-08 09:55:42 +0000
commit920cf4b4b2cc9a061b14c49c8dcd0af4e4e19845 (patch)
tree0da9bb54eb17366c67159b1909b8a90129e54923 /src
parente5d90d98402475b6e154ce216f9efcb80da1a747 (diff)
parentf351e762f0af1cce5068850e9bd21c54f7cb15f2 (diff)
downloadrust-920cf4b4b2cc9a061b14c49c8dcd0af4e4e19845.tar.gz
rust-920cf4b4b2cc9a061b14c49c8dcd0af4e4e19845.zip
Auto merge of #27596 - tsion:fix-27450, r=arielb1
Fixes #27450.

r? @steveklabnik
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/cast.rs5
-rw-r--r--src/test/compile-fail/cast-rfc0401.rs2
-rw-r--r--src/test/compile-fail/fat-ptr-cast.rs2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index b6ba62e4f09..b40be59ecbe 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -100,6 +100,7 @@ enum CastError {
     DifferingKinds,
     IllegalCast,
     NeedViaPtr,
+    NeedViaThinPtr,
     NeedViaInt,
     NeedViaUsize,
     NonScalar,
@@ -120,6 +121,7 @@ impl<'tcx> CastCheck<'tcx> {
                              e: CastError) {
         match e {
             CastError::NeedViaPtr |
+            CastError::NeedViaThinPtr |
             CastError::NeedViaInt |
             CastError::NeedViaUsize => {
                 fcx.type_error_message(self.span, |actual| {
@@ -130,6 +132,7 @@ impl<'tcx> CastCheck<'tcx> {
                 fcx.ccx.tcx.sess.fileline_help(self.span,
                     &format!("cast through {} first", match e {
                         CastError::NeedViaPtr => "a raw pointer",
+                        CastError::NeedViaThinPtr => "a thin pointer",
                         CastError::NeedViaInt => "an integer",
                         CastError::NeedViaUsize => "a usize",
                         _ => unreachable!()
@@ -324,7 +327,7 @@ impl<'tcx> CastCheck<'tcx> {
         if fcx.type_is_known_to_be_sized(m_expr.ty, self.span) {
             Ok(CastKind::PtrAddrCast)
         } else {
-            Err(CastError::NeedViaPtr)
+            Err(CastError::NeedViaThinPtr)
         }
     }
 
diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs
index 7fca4aece69..4603ed00347 100644
--- a/src/test/compile-fail/cast-rfc0401.rs
+++ b/src/test/compile-fail/cast-rfc0401.rs
@@ -96,7 +96,7 @@ fn main()
     let _ = &f as *const f64; //~ ERROR casting
     let _ = fat_v as usize;
     //~^ ERROR casting
-    //~^^ HELP through a raw pointer first
+    //~^^ HELP through a thin pointer first
 
     let a : *const str = "hello";
     let _ = a as *const Foo;
diff --git a/src/test/compile-fail/fat-ptr-cast.rs b/src/test/compile-fail/fat-ptr-cast.rs
index 3746f29ea55..1c462779b43 100644
--- a/src/test/compile-fail/fat-ptr-cast.rs
+++ b/src/test/compile-fail/fat-ptr-cast.rs
@@ -21,7 +21,7 @@ fn main() {
     b as usize; //~ ERROR non-scalar cast
     p as usize;
     //~^ ERROR casting
-    //~^^ HELP cast through a raw pointer
+    //~^^ HELP cast through a thin pointer
 
     // #22955
     q as *const [i32]; //~ ERROR casting