Skip to content

Commit a7c6cb7

Browse files
committed
Consider variant constructors pure functions for the purpose of purity checking
Closes #1269
1 parent 94b0fee commit a7c6cb7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/comp/middle/typeck.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,8 +1477,9 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity,
14771477
}
14781478
ast::pure_fn. {
14791479
alt ccx.tcx.def_map.find(callee.id) {
1480-
some(ast::def_fn(_, ast::pure_fn.)) { ret; }
1481-
some(ast::def_native_fn(_, ast::pure_fn.)) { ret; }
1480+
some(ast::def_fn(_, ast::pure_fn.)) |
1481+
some(ast::def_native_fn(_, ast::pure_fn.)) |
1482+
some(ast::def_variant(_, _)) { ret; }
14821483
_ {
14831484
ccx.tcx.sess.span_err
14841485
(sp, "pure function calls function not known to be pure");

src/comp/syntax/parse/lexer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ fn scan_exponent(rdr: reader) -> option::t<str> {
176176
}
177177

178178
fn scan_digits(rdr: reader, radix: uint) -> str {
179-
radix; // FIXME work around issue #1265
180179
let rslt = "";
181180
while true {
182181
let c = rdr.curr();

0 commit comments

Comments
 (0)