about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-22 15:36:51 -0700
committerbors <bors@rust-lang.org>2013-04-22 15:36:51 -0700
commitaba93c6b60a91fc4b6b60408e51b23dbee5f44c9 (patch)
tree91d5ca30a8d1809161972cffa0b69b89a22750f2 /src/libstd/num
parenta6dd7dc1f2e1057719179e861a5a5ae55d6a8335 (diff)
parentc389d0b0dd2273c9f7d16917a1738509f5522491 (diff)
downloadrust-aba93c6b60a91fc4b6b60408e51b23dbee5f44c9.tar.gz
rust-aba93c6b60a91fc4b6b60408e51b23dbee5f44c9.zip
auto merge of #5966 : alexcrichton/rust/issue-3083, r=graydon
Closes #3083.

This takes a similar approach to #5797 where a set is present on the `tcx` of used mutable definitions. Everything is by default warned about, and analyses must explicitly add mutable definitions to this set so they're not warned about.

Most of this was pretty straightforward, although there was one caveat that I ran into when implementing it. Apparently when the old modes are used (or maybe `legacy_modes`, I'm not sure) some different code paths are taken to cause spurious warnings to be issued which shouldn't be issued. I'm not really sure how modes even worked, so I was having a lot of trouble tracking this down. I figured that because they're a legacy thing that I'd just de-mode the compiler so that the warnings wouldn't be a problem anymore (or at least for the compiler).

Other than that, the entire compiler compiles without warnings of unused mutable variables. To prevent bad warnings, #5965 should be landed (which in turn is waiting on #5963) before landing this. I figured I'd stick it out for review anyway though.
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/rational.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/num/rational.rs b/src/libstd/num/rational.rs
index ee6879e31d9..36652380bff 100644
--- a/src/libstd/num/rational.rs
+++ b/src/libstd/num/rational.rs
@@ -60,7 +60,7 @@ impl<T: Copy + Num + Ord>
 
     /// Put self into lowest terms, with denom > 0.
     fn reduce(&mut self) {
-        let mut g : T = gcd(self.numer, self.denom);
+        let g : T = gcd(self.numer, self.denom);
 
         self.numer /= g;
         self.denom /= g;
@@ -505,4 +505,4 @@ mod test {
             test(s);
         }
     }
-}
\ No newline at end of file
+}