Nicer quoting in "attempted access of field" message. Issue #2358.
This commit is contained in:
parent
47b1b7a207
commit
46809f7ab7
5 changed files with 7 additions and 6 deletions
|
@ -1551,8 +1551,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
|||
}
|
||||
none {
|
||||
let t_err = fcx.infcx.resolve_type_vars_if_possible(expr_t);
|
||||
let msg = #fmt["attempted access of field %s on type %s, but \
|
||||
no public field or method with that name was found",
|
||||
let msg = #fmt["attempted access of field `%s` on type `%s`, \
|
||||
but no public field or method with that name \
|
||||
was found",
|
||||
*field, fcx.infcx.ty_to_str(t_err)];
|
||||
tcx.sess.span_err(expr.span, msg);
|
||||
// NB: Adding a bogus type to allow typechecking to continue
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// error-pattern: attempted access of field eat on type noisy
|
||||
// error-pattern: attempted access of field `eat` on type `noisy`
|
||||
iface noisy {
|
||||
fn speak();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// error-pattern:attempted access of field nap on type
|
||||
// error-pattern:attempted access of field `nap` on type
|
||||
// xfail-fast
|
||||
// aux-build:cci_class_5.rs
|
||||
use cci_class_5;
|
||||
|
|
|
@ -15,7 +15,7 @@ fn f(p: *rec) -> int {
|
|||
// are prohibited by various checks, such as that the enum is
|
||||
// instantiable and so forth).
|
||||
|
||||
ret p.f; //! ERROR attempted access of field f on type *rec
|
||||
ret p.f; //! ERROR attempted access of field `f` on type `*rec`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// error-pattern:attempted access of field some_field_name on type [int]
|
||||
// error-pattern:attempted access of field `some_field_name` on type `[int]`
|
||||
// issue #367
|
||||
|
||||
fn f() {
|
||||
|
|
Loading…
Reference in a new issue