diff options
| author | bors <bors@rust-lang.org> | 2013-04-22 15:36:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-22 15:36:51 -0700 |
| commit | aba93c6b60a91fc4b6b60408e51b23dbee5f44c9 (patch) | |
| tree | 91d5ca30a8d1809161972cffa0b69b89a22750f2 /src/libsyntax/print | |
| parent | a6dd7dc1f2e1057719179e861a5a5ae55d6a8335 (diff) | |
| parent | c389d0b0dd2273c9f7d16917a1738509f5522491 (diff) | |
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/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pp.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index eff7524e194..17add33d673 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -146,9 +146,9 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { // fall behind. let n: uint = 3 * linewidth; debug!("mk_printer %u", linewidth); - let mut token: ~[token] = vec::from_elem(n, EOF); - let mut size: ~[int] = vec::from_elem(n, 0); - let mut scan_stack: ~[uint] = vec::from_elem(n, 0u); + let token: ~[token] = vec::from_elem(n, EOF); + let size: ~[int] = vec::from_elem(n, 0); + let scan_stack: ~[uint] = vec::from_elem(n, 0u); @mut Printer { out: @out, buf_len: n, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 8cf73599562..ce772ca7c35 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1972,7 +1972,7 @@ pub fn print_ty_fn(s: @ps, pub fn maybe_print_trailing_comment(s: @ps, span: codemap::span, next_pos: Option<BytePos>) { - let mut cm; + let cm; match s.cm { Some(ccm) => cm = ccm, _ => return } match next_comment(s) { Some(ref cmnt) => { |
