Commit Graph

49817 Commits

Author SHA1 Message Date
Manish Goregaokar
3e56732322 Rollup merge of #31219 - mbrubeck:missing-docs, r=steveklabnik
The missing_docs lint only applies to public items in public modules, so this
example code did not actually generate any warnings or errors.
2016-01-28 00:48:32 +05:30
Manish Goregaokar
cb3680c080 Rollup merge of #31186 - gchp:contributing, r=alexcrichton
I recently wrote a blog post on contributing to the Rust compiler which
gained some interest. It was mentioned in a comment on Reddit that it
would be useful to integrate some of the information from that post to
the official contributing guide.

This is the start of my efforts to integrate what I wrote with the
official guide.

This commit adds information on the build system. It is not a complete
guide on the build system, but it should be enough to provide a good
starting place for those wishing to contribute.
2016-01-28 00:48:31 +05:30
Manish Goregaokar
b29628ac91 Rollup merge of #30689 - Manishearth:lifetime-bound, r=steveklabnik
We should have stuff on this in the book somewhere too

r? @steveklabnik
2016-01-28 00:48:31 +05:30
bors
b2f4c5c596 Auto merge of #31224 - bluss:deque-hashing, r=Gankro
Hash VecDeque in its slice parts

Use .as_slices() for a more efficient code path in VecDeque's Hash impl.

This still hashes the elements in the same order.

Before/after timing of VecDeque hashing 1024 elements of u8 and
u64 shows that the vecdeque now can match the Vec
(test_hashing_vec_of_u64 is the Vec run).

```
before

test test_hashing_u64        ... bench:  14,031 ns/iter (+/- 236) = 583 MB/s
test test_hashing_u8         ... bench:   7,887 ns/iter (+/- 65) = 129 MB/s
test test_hashing_vec_of_u64 ... bench:   6,578 ns/iter (+/- 76) = 1245 MB/s

after

running 5 tests
test test_hashing_u64        ... bench:   6,495 ns/iter (+/- 52) = 1261 MB/s
test test_hashing_u8         ... bench:     851 ns/iter (+/- 16) = 1203 MB/s
test test_hashing_vec_of_u64 ... bench:   6,499 ns/iter (+/- 59) = 1260 MB/s
```
2016-01-27 16:25:36 +00:00
bors
8256c470a5 Auto merge of #31089 - fhahn:macro-ice, r=pnkfelix
This is a  work in progress PR that potentially should fix #29084, #28308, #25385, #28288, #31011. I think this may also adresse parts of  #2887.

The problem in this issues seems to be that when transcribing macro arguments, we just clone the argument Nonterminal, which still has to original spans. This leads to the unprintable spans. One solution would be to update the spans of the inserted argument to match the argument in the macro definition. So for [this testcase](https://github.com/rust-lang/rust/compare/master...fhahn:macro-ice?expand=1#diff-f7def7420c51621640707b6337726876R2) the error message would be displayed in the macro definition:

    src/test/compile-fail/issue-31011.rs:4:12: 4:22 error: attempted access of field `trace` on type `&T`, but no field with that name was found
    src/test/compile-fail/issue-31011.rs:4         if $ctx.trace {

Currently I've added a very simple `update_span` function, which updates the span of the outer-most expression of a `NtExpr`, but this `update_span` function should be updated to handle all Nonterminals. But I'm pretty new to the macro system and would like to check if this approach makes sense, before doing that.
2016-01-27 12:12:52 +00:00
Florian Hahn
ecb7b01a08 Add NOTE test annotations 2016-01-27 11:48:46 +01:00
Florian Hahn
e533ed91be Avoid storing interolated token in Parser.last_token 2016-01-27 11:28:33 +01:00
bors
b8b18aac12 Auto merge of #31206 - nrc:early-save, r=nikomatsakis
r? @nikomatsakis
2016-01-27 10:17:55 +00:00
Florian Hahn
47bfd8c93c Turn interpolated_or_expr_span into a function 2016-01-27 10:47:33 +01:00
bors
aba11b3206 Auto merge of #31020 - regexident:fix_16884, r=brson
Changes error message from displaying first found missing constructor witness to showing up to 10, if necessary.

Fixes issue #16884.
2016-01-27 07:32:00 +00:00
bors
a186eb2fb2 Auto merge of #30859 - aliclark:musl-nx-issue, r=brson
This explicitly adds an option telling the linker on these platforms to make the stack and heap non-executable (should already be the case for Windows, and likely OS X).

Without this option there is some risk of accidentally losing NX protection, as the linker will not enable NX if any of the binary's constituent objects don't contain the .note.GNU-stack header.

We're not aware of any users who would want a binary with executable stack or heap, but in future this could be made possible by passing a flag to disable the protection, which would also help document the fact to the crate's users.

Edit: older discussion of previous quickfix to add a .note.GNU-stack header to libunwind's assembly:

Short term solution for issue #30824 to ensure that object files generated from assembler contain the .note.GNU-stack header.

When this header is not present in any constituent object files, the linker refrains from making the stack NX in the final executable.

Further actions:

I'll try to get this change merged in with upstream too, and then update these instructions to just compile the fixed version.

It seems a good idea to use issue #30824 or some other issue to add a test that similar security regressions can be automatically caught in future.
2016-01-27 03:30:14 +00:00
bors
b694d1b1d1 Auto merge of #30487 - jonas-schievink:more-attrs-lint-fixes, r=alexcrichton
`LateContext` already does this, looks like this was just forgotten in #29850.

Found while investigating #30326 (but doesn't fix it)
2016-01-27 01:30:28 +00:00
Ulrik Sverdrup
d3174ce751 collections: Hash VecDeque in its slice parts
Use .as_slices() for a more efficient code path in VecDeque's Hash impl.

This still hashes the elements in the same order.

Before/after timing of VecDeque hashing 1024 elements of u8 and
u64 shows that the vecdeque now can match the Vec
(test_hashing_vec_of_u64 is the Vec run).

before

test test_hashing_u64        ... bench:  14,031 ns/iter (+/- 236) = 583 MB/s
test test_hashing_u8         ... bench:   7,887 ns/iter (+/- 65) = 129 MB/s
test test_hashing_vec_of_u64 ... bench:   6,578 ns/iter (+/- 76) = 1245 MB/s

after

running 5 tests
test test_hashing_u64        ... bench:   6,495 ns/iter (+/- 52) = 1261 MB/s
test test_hashing_u8         ... bench:     851 ns/iter (+/- 16) = 1203 MB/s
test test_hashing_vec_of_u64 ... bench:   6,499 ns/iter (+/- 59) = 1260 MB/s
2016-01-27 00:04:03 +01:00
bors
4b615854f0 Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-26 22:10:10 +00:00
bors
a9e139b66c Auto merge of #31081 - alexcrichton:stabilize-hasher, r=aturon
This commit implements the stabilization of the custom hasher support intended
for 1.7 but left out due to some last-minute questions that needed some
decisions. A summary of the actions done in this PR are:

Stable

* `std:#️⃣:BuildHasher`
* `BuildHasher::Hasher`
* `BuildHasher::build_hasher`
* `std:#️⃣:BuildHasherDefault`
* `HashMap::with_hasher`
* `HashMap::with_capacity_and_hasher`
* `HashSet::with_hasher`
* `HashSet::with_capacity_and_hasher`
* `std::collections::hash_map::RandomState`
* `RandomState::new`

Deprecated

* `std::collections::hash_state`
* `std::collections::hash_state::HashState` - this trait was also moved into
  `std::hash` with a reexport here to ensure that we can have a blanket impl to
  prevent immediate breakage on nightly. Note that this is unstable in both
  location.
* `HashMap::with_hash_state` - renamed
* `HashMap::with_capacity_and_hash_state` - renamed
* `HashSet::with_hash_state` - renamed
* `HashSet::with_capacity_and_hash_state` - renamed

Closes #27713
2016-01-26 19:30:54 +00:00
Matt Brubeck
e23f8b095b Fix examples that use missing_docs lint
The missing_docs lint only applies to public items in public modules, so this
example code did not actually generate any warnings or errors.
2016-01-26 09:49:26 -08:00
Alex Crichton
cb343c33ac Fix warnings during tests
The deny(warnings) attribute is now enabled for tests so we need to weed out
these warnings as well.
2016-01-26 09:29:28 -08:00
bors
13b5edab63 Auto merge of #30402 - jooert:prettypanic, r=alexcrichton
This splits the output of panics into two lines as proposed in #15239 and adds a
note about how to get a backtrace. Because the default panic message consists of
multiple lines now, this changes the test runner's failure output to not indent
the first line anymore.

Fixes #15239 and fixes #11704.
2016-01-26 16:50:27 +00:00
Alex Crichton
1fa0be2bc0 std: Stabilize custom hasher support in HashMap
This commit implements the stabilization of the custom hasher support intended
for 1.7 but left out due to some last-minute questions that needed some
decisions. A summary of the actions done in this PR are:

Stable

* `std:#️⃣:BuildHasher`
* `BuildHasher::Hasher`
* `BuildHasher::build_hasher`
* `std:#️⃣:BuildHasherDefault`
* `HashMap::with_hasher`
* `HashMap::with_capacity_and_hasher`
* `HashSet::with_hasher`
* `HashSet::with_capacity_and_hasher`
* `std::collections::hash_map::RandomState`
* `RandomState::new`

Deprecated

* `std::collections::hash_state`
* `std::collections::hash_state::HashState` - this trait was also moved into
  `std::hash` with a reexport here to ensure that we can have a blanket impl to
  prevent immediate breakage on nightly. Note that this is unstable in both
  location.
* `HashMap::with_hash_state` - renamed
* `HashMap::with_capacity_and_hash_state` - renamed
* `HashSet::with_hash_state` - renamed
* `HashSet::with_capacity_and_hash_state` - renamed

Closes #27713
2016-01-26 08:39:07 -08:00
Greg Chapple
05f7b59352 Re-worded intro paragraph to be more positive 2016-01-26 14:44:27 +00:00
Greg Chapple
6fd728db6d Updated to reflect comments from review
- Tweaked the build system intro paragraph
- Added some more configure options & explanations
- Added additional make target
2016-01-26 14:29:26 +00:00
bors
5d6e8fceda Auto merge of #31214 - Manishearth:rollup, r=Manishearth
- Successful merges: #31172, #31177, #31211
- Failed merges:
2016-01-26 13:26:08 +00:00
Manish Goregaokar
b6faae11f4 Rollup merge of #31211 - Manishearth:pr-30765, r=nrc
r? @eddyb or @nrc
2016-01-26 18:55:39 +05:30
Manish Goregaokar
ef96037f7e Rollup merge of #31177 - alexcrichton:no-stdio, r=sfackler
On all platforms, reading from stdin where the actual stdin isn't present should
return 0 bytes as having been read rather than the entire buffer.

On Windows, handle the case where we're inheriting stdio handles but one of them
isn't present. Currently the behavior is to fail returning an I/O error but
instead this commit corrects it to detecting this situation and propagating the
non-set handle.

Closes #31167
2016-01-26 18:55:39 +05:30
Manish Goregaokar
e9617dd0b8 Rollup merge of #31172 - SimonSapin:patch-17, r=sfackler
The previous example did not do what its description said. In it panicked on integer overflow in debug mode, and went into an infinite loop in release mode (wrapping back to 0 after printing 254).
2016-01-26 18:55:39 +05:30
Simon Sapin
70d4f263ba RangeFrom::step_by docs: fix example
The previous example did not do what its description said. In it panicked on integer overflow in debug mode, and went into an infinite loop in release mode (wrapping back to 0 after printing 254).
2016-01-26 14:23:38 +01:00
Florian Hahn
9d8c64b996 Push try! to call site of interpolated_or_expr_span! 2016-01-26 12:49:22 +01:00
bors
43c1a173a8 Auto merge of #31105 - jseyfried:fix_lexical_scoping, r=nrc
This fixes #23880, a scoping bug in which items in a block are shadowed by local variables and type parameters that are in scope.

After this PR, an item in a block will shadow any local variables or type parameters above the item in the scope hierarchy. Items in a block will continue to be shadowed by local variables in the same block (even if the item is defined after the local variable).

This is a [breaking-change]. For example, the following code breaks:
```rust
fn foo() {
    let mut f = 1;
    {
        fn f() {}
        f += 1; // This will resolve to the function instead of the local variable
    }
}
2016-01-26 11:24:18 +00:00
Florian Hahn
2bc8f4ff80 Add interpolated_or_expr_span macro and pass lo to newly added parse_dot_suffix 2016-01-26 11:51:24 +01:00
Johannes Oertel
c07413c204 Add message about RUST_BACKTRACE to default output of panic!
The note will only be shown on the first panic.
2016-01-26 10:37:12 +01:00
bors
1972c50b9e Auto merge of #31160 - nxnfufunezn:ppwild-31073, r=eddyb
Fixes #31073
r? @eddyb
2016-01-26 09:33:18 +00:00
Florian Hahn
1bde18d60c Use interpolated token span when building spans for bigger expressions 2016-01-26 10:32:58 +01:00
Florian Hahn
20edb366e7 Set span for interpolated tokens correctly 2016-01-26 10:32:58 +01:00
Florian Hahn
877ed0d068 Update tests 2016-01-26 10:31:54 +01:00
Florian Hahn
b285ebc48e Update expression span when transcribing macro args
closes #29084
closes #28308
closes #25385
closes #28288
closes #31011
closes #26480
closes #26093
closes #26094
closes #25386
closes #26237
closes #25793
2016-01-26 10:31:54 +01:00
Manish Goregaokar
065e47eb3b Improve error message for let-in-expr-position 2016-01-26 13:55:46 +05:30
Manish Goregaokar
d829019ff4 Make emitter handle DUMMY_SP correctly 2016-01-26 13:49:21 +05:30
bors
acf4aeeda0 Auto merge of #31210 - Manishearth:rollup, r=Manishearth
- Successful merges: #31152, #31184, #31189, #31192, #31197, #31199, #31201
- Failed merges:
2016-01-26 07:42:10 +00:00
Manish Goregaokar
79157b3fb5 Rollup merge of #31201 - steveklabnik:gh30633, r=alexcrichton
Fixes #30633
2016-01-26 13:11:58 +05:30
Manish Goregaokar
486fd89b34 Rollup merge of #31199 - steveklabnik:gh31181, r=Manishearth
Fixes #31181
2016-01-26 13:11:58 +05:30
Manish Goregaokar
24931a32e8 Rollup merge of #31197 - apasel422:issue-31195, r=steveklabnik
Closes #31195

r? @steveklabnik
2016-01-26 13:11:57 +05:30
Manish Goregaokar
37b48edb53 Rollup merge of #31192 - frewsxcv:patch-27, r=alexcrichton 2016-01-26 13:11:57 +05:30
Manish Goregaokar
74ef5aa45c Rollup merge of #31189 - ollie27:book_links, r=steveklabnik
r? @steveklabnik
2016-01-26 13:11:57 +05:30
Manish Goregaokar
ced313cf19 Rollup merge of #31184 - arielb1:remove-implicator, r=nikomatsakis
it is pre-RFC1214 junk and completely useless.

r? @nikomatsakis
2016-01-26 13:11:57 +05:30
Manish Goregaokar
b46bd2fb29 Rollup merge of #31152 - durka:ty-follow-bracket, r=pnkfelix
cc #31135 rust-lang/rfcs#1462 #30923 @retep998
r? @pnkfelix
2016-01-26 13:11:57 +05:30
Nick Cameron
7b47f5e34e rebasing 2016-01-26 18:28:31 +13:00
Nick Cameron
0b511e82ab Initial work towards abort-free compilation
The goal is that the compiler will pass `Result`s around rather than using abort_if_errors. To preserve behaviour we currently abort at the top level. I've removed all other aborts from the driver, but haven't touched any of the nested aborts.
2016-01-26 17:51:11 +13:00
Jeffrey Seyfried
faf0852fc1 Resolve: fix #23880, a scoping bug
This fixes a bug in which items in a block are shadowed by local variables and type parameters that are in scope.
It is a [breaking-change]. For example, the following code breaks:

```rust
fn foo() {
    let mut f = 1;
    {
        fn f() {}
        f += 1; // This will now resolve to the function instead of the local variable
    }
}
```

Any breakage can be fixed by renaming the item that is no longer shadowed.
2016-01-26 04:16:58 +00:00
Steve Klabnik
2d0e4ed0aa Describe next_back() wrt Iterator protocol
Fixes #30633
2016-01-25 22:37:00 -05:00
Steve Klabnik
6c56260b30 Mention the need for a linker
Fixes #31181
2016-01-25 22:26:56 -05:00