mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rustc: Make 'attempted access of field' error non-fatal
This commit is contained in:
parent
3321880f13
commit
53dbde6cc2
@ -2297,7 +2297,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
|
||||
let msg = #fmt["attempted access of field %s on type %s, but \
|
||||
no method implementation was found",
|
||||
field, ty_to_str(tcx, t_err)];
|
||||
tcx.sess.span_fatal(expr.span, msg);
|
||||
tcx.sess.span_err(expr.span, msg);
|
||||
// NB: Adding a bogus type to allow typechecking to continue
|
||||
write::ty_only_fixup(fcx, id, ty::mk_nil(tcx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
src/test/compile-fail/attempted-access-non-fatal.rs
Normal file
6
src/test/compile-fail/attempted-access-non-fatal.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// Check that bogus field access is non-fatal
|
||||
fn main() {
|
||||
let x = 0;
|
||||
log(debug, x.foo); //! ERROR attempted access of field
|
||||
log(debug, x.bar); //! ERROR attempted access of field
|
||||
}
|
Loading…
Reference in New Issue
Block a user