File tree 3 files changed +6
-3
lines changed
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ enum CastError {
100
100
DifferingKinds ,
101
101
IllegalCast ,
102
102
NeedViaPtr ,
103
+ NeedViaThinPtr ,
103
104
NeedViaInt ,
104
105
NeedViaUsize ,
105
106
NonScalar ,
@@ -120,6 +121,7 @@ impl<'tcx> CastCheck<'tcx> {
120
121
e : CastError ) {
121
122
match e {
122
123
CastError :: NeedViaPtr |
124
+ CastError :: NeedViaThinPtr |
123
125
CastError :: NeedViaInt |
124
126
CastError :: NeedViaUsize => {
125
127
fcx. type_error_message ( self . span , |actual| {
@@ -130,6 +132,7 @@ impl<'tcx> CastCheck<'tcx> {
130
132
fcx. ccx . tcx . sess . fileline_help ( self . span ,
131
133
& format ! ( "cast through {} first" , match e {
132
134
CastError :: NeedViaPtr => "a raw pointer" ,
135
+ CastError :: NeedViaThinPtr => "a thin pointer" ,
133
136
CastError :: NeedViaInt => "an integer" ,
134
137
CastError :: NeedViaUsize => "a usize" ,
135
138
_ => unreachable!( )
@@ -324,7 +327,7 @@ impl<'tcx> CastCheck<'tcx> {
324
327
if fcx. type_is_known_to_be_sized ( m_expr. ty , self . span ) {
325
328
Ok ( CastKind :: PtrAddrCast )
326
329
} else {
327
- Err ( CastError :: NeedViaPtr )
330
+ Err ( CastError :: NeedViaThinPtr )
328
331
}
329
332
}
330
333
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ fn main()
96
96
let _ = & f as * const f64 ; //~ ERROR casting
97
97
let _ = fat_v as usize ;
98
98
//~^ ERROR casting
99
- //~^^ HELP through a raw pointer first
99
+ //~^^ HELP through a thin pointer first
100
100
101
101
let a : * const str = "hello" ;
102
102
let _ = a as * const Foo ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ fn main() {
21
21
b as usize ; //~ ERROR non-scalar cast
22
22
p as usize ;
23
23
//~^ ERROR casting
24
- //~^^ HELP cast through a raw pointer
24
+ //~^^ HELP cast through a thin pointer
25
25
26
26
// #22955
27
27
q as * const [ i32 ] ; //~ ERROR casting
You can’t perform that action at this time.
0 commit comments