about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-12-08 10:26:42 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2011-12-08 10:26:42 +0100
commita7c6cb73858a2659651bc0ff9dfd1cdb72239d32 (patch)
tree55999c7c31c9089e780c78a651a568eb60a94ece
parent94b0fee6f135da6d507a9e77014ff4dd55bd72ed (diff)
downloadrust-a7c6cb73858a2659651bc0ff9dfd1cdb72239d32.tar.gz
rust-a7c6cb73858a2659651bc0ff9dfd1cdb72239d32.zip
Consider variant constructors pure functions for the purpose of purity checking
Closes #1269
-rw-r--r--src/comp/middle/typeck.rs5
-rw-r--r--src/comp/syntax/parse/lexer.rs1
2 files changed, 3 insertions, 3 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index e8847b1ebbc..614f2500cf5 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -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");
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index aa35635f178..bd841b94051 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -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();