librustc: Don't ICE with struct exprs where the name is not a valid struct.

This commit is contained in:
Luqman Aden 2014-07-30 18:43:55 -07:00 committed by Alex Crichton
parent bd15854114
commit bc24819bb2
2 changed files with 37 additions and 0 deletions

View File

@ -3547,6 +3547,17 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
span_err!(tcx.sess, path.span, E0071, span_err!(tcx.sess, path.span, E0071,
"`{}` does not name a structure", "`{}` does not name a structure",
pprust::path_to_string(path)); pprust::path_to_string(path));
// Make sure to still write the types
// otherwise we might ICE
fcx.write_error(id);
for field in fields.iter() {
check_expr(fcx, &*field.expr);
}
match base_expr {
Some(ref base) => check_expr(fcx, &**base),
None => {}
}
} }
} }

View File

@ -0,0 +1,26 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct GslResult {
pub val: f64,
pub err: f64
}
impl GslResult {
pub fn new() -> GslResult {
Result { //~ ERROR: `Result` does not name a structure
val: 0f64,
err: 0f64
}
}
}
fn main() {}