Update "Testing" chapter for 1.12
I followed the "Testing" chapter using Rust 1.12.1 but there are some differences. By default the `tests` module is now also generated by `cargo new`, and the console output is updated.
add more incremental reuse test cases
r? @michaelwoerister
This is basically a port of the "private method in impl". It works better when it's a top-level fn. =)
hashmap: Store hashes as usize internally
We can't use more than usize's bits of a hash to select a bucket anyway,
so we only need to store that part in the table. This should be an
improvement for the size of the data structure on 32-bit platforms.
Smaller data means better cache utilization and hopefully better
performance.
Fixes#36567
Make all vec! macros use square brackets: Attempt 2
[The last PR](https://github.com/rust-lang/rust/pull/37476) ended with tears after a valiant struggle with git. I managed to clean up the completely broken history of that into a brand spanking new PR! Yay!
Original:
> Everyone hates the old syntax. I hope. Otherwise this PR has some controversy I wasn't expecting.
> This would be the perfect time to write a lint recommending vec![..] when you use another style.
> Disclaimer: I may have broken something. If I have, I'll fix them when the tests come in. Luckily the chance for a non-syntactical error is pretty low in all this.
Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.
There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.
introing one-time diagnostics: only emit "lint level defined here" once
This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part).
---
We introduce a new `one_time_diagnostics` field on
`rustc::session::Session` to hold a hashset of diagnostic messages we've
set once but don't want to see again (as uniquified by span and message
text), "lint level defined here" being the motivating example dealt with
here.
This is in the matter of #24690.
---
r? @nikomatsakis
Add E0532 error explanation
This resolves one of the error list in https://github.com/rust-lang/rust/issues/35347 - just because I stumbled over it today.
I assumed the error code should be removed from `register_diagnostics!` because it's now defined above.
Since that is my first code contribution, please check that all is in order. It would be helpful to know how to run the test for the `compile_fail,E0532` part. I did `make check-stage1-cfail NO_REBUILD=1` but that doesn't test the inlined example.
r? @GuillaumeGomez
Remove outdated fixme comment.
Linked issue has been closed, but the comment was not removed.
If this is still an issue, then the comment should probably be updated.
r? @petrochenkov
improve docs for Index and IndexMut
This mainly changes the boring example of Foo/Bar of `IndexMut` into a better one.
Also added explanations about syntactic sugar for `v[index]`.
Closes#36329