mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Consider variant constructors pure functions for the purpose of purity checking
Closes #1269
This commit is contained in:
parent
94b0fee6f1
commit
a7c6cb7385
@ -1477,8 +1477,9 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity,
|
||||
}
|
||||
ast::pure_fn. {
|
||||
alt ccx.tcx.def_map.find(callee.id) {
|
||||
some(ast::def_fn(_, ast::pure_fn.)) { ret; }
|
||||
some(ast::def_native_fn(_, ast::pure_fn.)) { ret; }
|
||||
some(ast::def_fn(_, ast::pure_fn.)) |
|
||||
some(ast::def_native_fn(_, ast::pure_fn.)) |
|
||||
some(ast::def_variant(_, _)) { ret; }
|
||||
_ {
|
||||
ccx.tcx.sess.span_err
|
||||
(sp, "pure function calls function not known to be pure");
|
||||
|
@ -176,7 +176,6 @@ fn scan_exponent(rdr: reader) -> option::t<str> {
|
||||
}
|
||||
|
||||
fn scan_digits(rdr: reader, radix: uint) -> str {
|
||||
radix; // FIXME work around issue #1265
|
||||
let rslt = "";
|
||||
while true {
|
||||
let c = rdr.curr();
|
||||
|
Loading…
Reference in New Issue
Block a user