Skip to content

Commit 90ac699

Browse files
committed
Improve a type error message (avoid the word 'non-dereferenceable')
1 parent 5c4ffd0 commit 90ac699

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/rustc/middle/typeck.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,10 +2163,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
21632163
require_unsafe(tcx.sess, fcx.purity, expr.span);
21642164
}
21652165
_ {
2166-
tcx.sess.span_err(expr.span,
2167-
"dereferencing non-" +
2168-
"dereferenceable type: " +
2169-
ty_to_str(tcx, oper_t));
2166+
tcx.sess.span_err(expr.span,
2167+
#fmt("Type %s cannot be dereferenced",
2168+
ty_to_str(tcx, oper_t)));
21702169
}
21712170
}
21722171
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// error-pattern:cannot be dereferenced
2+
fn main() {
3+
alt *1 {
4+
_ { fail; }
5+
}
6+
}

0 commit comments

Comments
 (0)