diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-27 16:38:57 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-27 16:58:27 -0800 |
| commit | 53dbde6cc2aabbf44bf75aea1eecad5729396081 (patch) | |
| tree | 23357fe263a0a2fc8182dd214abf455fd49cb0a9 /src | |
| parent | 3321880f1304943a87f3b9756de642417eb82d1b (diff) | |
| download | rust-53dbde6cc2aabbf44bf75aea1eecad5729396081.tar.gz rust-53dbde6cc2aabbf44bf75aea1eecad5729396081.zip | |
rustc: Make 'attempted access of field' error non-fatal
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/middle/typeck.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/attempted-access-non-fatal.rs | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index c1079466e73..8a06314a96b 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -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)); } } } diff --git a/src/test/compile-fail/attempted-access-non-fatal.rs b/src/test/compile-fail/attempted-access-non-fatal.rs new file mode 100644 index 00000000000..7ead10b3f63 --- /dev/null +++ b/src/test/compile-fail/attempted-access-non-fatal.rs @@ -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 +} \ No newline at end of file |
