提交 46809f7a 编写于 作者: L Lindsey Kuper

Nicer quoting in "attempted access of field" message. Issue #2358.

上级 47b1b7a2
......@@ -1551,8 +1551,9 @@ fn get_node(f: spanned<field>) -> field { f.node }
}
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
......
// error-pattern: attempted access of field eat on type noisy
// error-pattern: attempted access of field `eat` on type `noisy`
iface noisy {
fn speak();
}
......
// 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() {
......
// 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() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册