Commit Graph

63979 Commits

Author SHA1 Message Date
Corey Farwell 4ad75b317f Rollup merge of #41873 - michaelwoerister:fix-filemap-hash-lookup, r=nikomatsakis
ICH: Handle case of removed FileMaps.

This PR fixes a bug introduced in #41709 where removing a source file between compilation sessions would cause an ICE:
https://travis-ci.org/rust-icci/crossbeam/jobs/230582234#L633

r? @nikomatsakis
2017-05-11 00:21:26 -04:00
Corey Farwell 183dd9e3c2 Rollup merge of #41724 - achernyak:master, r=nikomatsakis
More Queries for Crate Metadata

This covers a little bit of clean up and the following parts of #41417:
* `fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute>;`
* `fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name>;`
* `fn trait_of_item(&self, def_id: DefId) -> Option<DefId>;`
* `fn impl_parent(&self, impl_def_id: DefId) -> Option<DefId>;`
* ` fn is_foreign_item(&self, did: DefId) -> bool;`
* `fn is_exported_symbol(&self, def_id: DefId) -> bool;`

r? @nikomatsakis
2017-05-11 00:21:25 -04:00
Corey Farwell a00e182053 Rollup merge of #41192 - zackw:eprintln, r=alexcrichton
Add `eprint!` and `eprintln!` macros to the prelude.

These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout.  Issues #39228 and #40528; previous PR #39229; accepted RFC rust-lang/rfcs#1869; proposed revision to The Book rust-lang/book#615.

I have _not_ revised this any since the original submission; I will do that later this week.  I wanted to get this PR in place since it's been quite a while since the RFC was merged.

Known outstanding review comments:

* [x] @steveklabnik requested a new chapter for the unstable version of The Book -- please see if the proposed revisions to the second edition cover it.
* [x] @nodakai asked if it were possible to merge the internal methods `_print` and `_eprint` - not completely, since they both refer to different internal globals which we don't want to expose, but I will see if some duplication can be factored out.

Please let me know if I missed anything.
2017-05-11 00:21:24 -04:00
bors bb8d51c2eb Auto merge of #41862 - GuillaumeGomez:improve-e0477, r=nagisa
Improve E0477 error message

Part of #41816.

r? @nagisa
2017-05-10 21:32:33 +00:00
Zack Weinberg 72588a2b2a Skip print-stdout-eprint-stderr test on emscripten 2017-05-10 15:28:25 -04:00
bors 978d2cfee1 Auto merge of #41887 - steveklabnik:rollup, r=steveklabnik
Rollup of 5 pull requests

- Successful merges: #41531, #41536, #41809, #41854, #41886
- Failed merges:
2017-05-10 17:10:13 +00:00
Steve Klabnik 19f1146ded Rollup merge of #41886 - RalfJung:unique-doc-typo, r=steveklabnik
fix typo in Unique::empty doc

Subject says it all
2017-05-10 17:18:34 +02:00
Steve Klabnik 42ce11eb5a Rollup merge of #41854 - gamazeps:thread-spawn-doc, r=steveklabnik
[Doc] Improve `thread::spawn` documentation

Part of #29378

- Add two examples to `thread::spawn` doumentation that show common uses of threads.
- Add a link to `thread::Builder` in the `thread::spawn` documentation for configuring threads.
- Add a link to `thread::spawn` in `thread::Builder` in order to avoid documentation duplication.

r? @steveklabnik
2017-05-10 17:18:33 +02:00
Steve Klabnik ec85859d9a Rollup merge of #41809 - gamazeps:thread-docs, r=steveklabnik
[DOC] Improve the thread::park and thread::unpark documentation

Part of #29378 .

Takes care of the documentation for `park`, `park_duration` and also improves the `unpark` example.

- `park should` have its module documentation inlined here, and cleaned up.
- `park_timeout` could use links to `park`.
2017-05-10 17:18:32 +02:00
Steve Klabnik a6e1e1fe21 Rollup merge of #41536 - steveklabnik:arc-and-send, r=burntsushi
Improve docs on Arc<T> and Send/Sync

This is something I always forget, so let's actually
explain in the docs.

I didn't fully link up everything here, but I'd like to make sure that the wording is okay before I bother.
2017-05-10 17:18:31 +02:00
Steve Klabnik 2924532232 Rollup merge of #41531 - steveklabnik:gh40159, r=nagisa
Add more ways to create a PathBuf to docs

The best way to do this wasn't in the documentation, and the ways that
were there needed some extra text to elaborate.

Fixes #40159

/cc @nagisa
2017-05-10 17:18:30 +02:00
Ralf Jung ec141c8c96 fix typo in Unique::empty doc 2017-05-10 17:08:58 +02:00
Zack Weinberg 4ab3bcb9ca Fix up stability annotations per feedback. 2017-05-10 09:52:16 -04:00
Zack Weinberg 07766f675c Revise the eprint(ln)! feature.
* Factor out the nigh-identical bodies of `_print` and `_eprint` to a helper
   function `print_to` (I was sorely tempted to call it `_doprnt`).
 * Update the issue number for the unstable `eprint` feature.
 * Add entries to the "unstable book" for `eprint` and `eprint_internal`.
 * Style corrections to the documentation.
2017-05-10 09:41:42 -04:00
Zack Weinberg 76127275a0 Add `eprint!` and `eprintln!` macros to the prelude.
These are exactly the same as `print!` and `println!` except that
they write to stderr instead of stdout.  Issue #39228.
2017-05-10 09:29:16 -04:00
bors 25a161765f Auto merge of #41815 - Yamakaky:improve-backtrace-bottom, r=alexcrichton
Improve cleaning of the bottom of the backtrace

Following https://github.com/rust-lang/rust/pull/40264. It only cleans the bottom of the trace (after the main). It handles correctly the normal main, tests, benchmarks and threads.

I kept `skipped_before` since it will be used later for the cleaning of the top.
2017-05-10 11:37:22 +00:00
Michael Woerister 84a40c1443 ICH: Handle case of removed FileMaps. 2017-05-10 12:35:36 +02:00
bors 2b97174ada Auto merge of #41764 - scottmcm:faster-reverse, r=brson
Make [u8]::reverse() 5x faster

Since LLVM doesn't vectorize the loop for us, do unaligned reads of a larger type and use LLVM's bswap intrinsic to do the reversing of the actual bytes.  cfg!-restricted to x86 and x86_64, as I assume it wouldn't help on things like ARMv5.

Also makes [u16]::reverse() a more modest 1.5x faster by loading/storing u32 and swapping the u16s with ROT16.

Thank you ptr::*_unaligned for making this easy :)

Benchmark results (from my i5-2500K):
```text
# Before
test slice::reverse_u8      ... bench:  273,836 ns/iter (+/- 15,592) =  3829 MB/s
test slice::reverse_u16     ... bench:  139,793 ns/iter (+/- 17,748) =  7500 MB/s
test slice::reverse_u32     ... bench:   74,997 ns/iter  (+/- 5,130) = 13981 MB/s
test slice::reverse_u64     ... bench:   47,452 ns/iter  (+/- 2,213) = 22097 MB/s

# After
test slice::reverse_u8      ... bench:   52,170 ns/iter (+/- 3,962) = 20099 MB/s
test slice::reverse_u16     ... bench:   93,330 ns/iter (+/- 4,412) = 11235 MB/s
test slice::reverse_u32     ... bench:   74,731 ns/iter (+/- 1,425) = 14031 MB/s
test slice::reverse_u64     ... bench:   47,556 ns/iter (+/- 3,025) = 22049 MB/s
```

If you're curious about the assembly, instead of doing this
```
movzx	eax, byte ptr [rdi]
movzx	ecx, byte ptr [rsi]
mov	byte ptr [rdi], cl
mov	byte ptr [rsi], al
```
it does this
```
mov	rax, qword ptr [rdx]
mov	rbx, qword ptr [r11 + rcx - 8]
bswap	rbx
mov	qword ptr [rdx], rbx
bswap	rax
mov	qword ptr [r11 + rcx - 8], rax
```
2017-05-10 08:54:50 +00:00
Felix Raimundo fe7b6db39b Fix typos in doc 2017-05-10 10:44:58 +02:00
bors 58b33ad70c Auto merge of #41659 - bluss:clone-split-whitespace, r=aturon
impl Clone for .split_whitespace()

Use custom closure structs for the predicates so that the iterator's
clone can simply be derived. This should also reduce virtual call
overhead by not using function pointers.

Fixes #41655
2017-05-10 03:27:36 +00:00
bors db1c9eb2bd Auto merge of #41548 - brson:relnotes, r=brson
Update release notes for 1.17

[Rendered](https://github.com/brson/rust/blob/relnotes/RELEASES.md).

cc @steveklabnik
2017-05-09 23:11:53 +00:00
achernyak 35812d1746 resolved merge conflicts 2017-05-09 17:23:41 -05:00
bors d3abc80b3e Auto merge of #41830 - jonhoo:update-cargo, r=alexcrichton
Bump cargo for rust-lang/cargo#4000

rust-lang/cargo#4000 recently landed, which fixes warnings about using `-Z` when `CARGO_INCREMENTAL` is set while running stable/beta builds. As #41751 has now landed, these warnings will turn to errors in the next release, so getting the cargo fix in place is necessary unless we want people confused about why they can no longer compile anything on stable/beta.
2017-05-09 19:31:35 +00:00
Guillaume Gomez cc4afe0f65 Improve E0477 error message 2017-05-09 20:51:18 +02:00
Yamakaky ca8b75466c
Don't show the std frames before user code on unwinding.
When `RUST_BACKTRACE=1`, remove all frames after
`__rust_maybe_catch_panic`. Tested on `main`, threads, tests and
benches. Cleaning of the top of the stacktrace is let to a future PR.

Fixes #40201

See #41815
2017-05-09 19:51:50 +02:00
Felix Raimundo 202086e48f Fix warnings in examples 2017-05-09 19:06:56 +02:00
Felix Raimundo afe74c3900 Fix link 2017-05-09 19:02:43 +02:00
steveklabnik 2f6744c5fc Improve docs on Arc<T> and Send/Sync
This is something I always forget, so let's actually
explain in the docs.
2017-05-09 12:49:58 -04:00
steveklabnik 23382e614a Add more ways to create a PathBuf to docs
The best way to do this wasn't in the documentation, and the ways that
were there needed some extra text to elaborate.

Fixes #40159
2017-05-09 12:43:49 -04:00
bors 644fc403dd Auto merge of #41814 - gamazeps:thread-struct-doc, r=steveklabnik
[Doc] improve `thread::Thread` and `thread::Builder` documentations

Part of #29378

- Adds information about the stack_size when using `Builder`. This might be considered too low level, but I assume that if someone wants to create their own builder instead of using `thread::spawn` they may be interested in that info.
- Updates the `thread::Thread` structure doc, mostly by explaining how to get one, the previous example was removed because it was not related to `thread::Thread`, but rather to `thread::Builder::name`.
  Not much is present there, mostly because this API is not often used (the only method that seems useful is `unpark`, which is documented in #41809).
2017-05-09 16:31:07 +00:00
Jon Gjengset 1617eee277
Bump cargo for rust-lang/cargo#4000
Also relies on rust-lang/cargo#4010
2017-05-09 12:15:13 -04:00
Felix Raimundo 656efcd3ab Address review comments 2017-05-09 16:57:03 +02:00
Felix Raimundo 323a774c2f Address review comments 2017-05-09 16:52:26 +02:00
bors f3fc547194 Auto merge of #41709 - michaelwoerister:close-metadata-ich-holes, r=nikomatsakis
incr.comp.: Hash more pieces of crate metadata to detect changes there.

This PR adds incr. comp. hashes for non-`Entry` pieces of data in crate metadata.

The first part of it I like: `EntryBuilder` is refactored into the more generally applicable `IsolatedEncoder` which provides means of encoding something into metadata while also feeding the encoded data into an incr. comp. hash. We already did this for `Entry`, now we are doing it for various other pieces of data too, like the set of exported symbols and so on. The hashes generated there are persisted together with the per-`Entry` hashes and are also used for dep-graph dirtying the same way.

The second part of the PR I'm not entirely happy with: In order to make sure that we don't forget registering a read to the new `DepNodes` introduced here, I added the `Tracked<T>` struct. This struct wraps a value and requires a `DepNode` when accessing the wrapped value. This makes it harder to overlook adding read edges in the right places and works just fine.
However, crate metadata is already used in places where there is no `tcx` yet or even in places where no `cnum` has been assigned -- this makes it harder to apply this feature consistently or implement it ergonomically. The result is not too bad but there's a bit more code churn and a bit more opportunity to get something wrong than I would have liked. On the other hand, wrapping things in `Tracked<T>` already has revealed some bugs, so there's definitely some value in it.

This is still a work in progress:
- [x] I need to write some test cases.
- [x] Accessing the CodeMap should really be dependency tracked too, especially with the new path-remapping feature.

cc @nikomatsakis
2017-05-09 11:55:37 +00:00
Felix Raimundo 9db31206f5 Add a link to `thread::Builder` in `thread::spawn` 2017-05-09 13:27:22 +02:00
Felix Raimundo c655348f26 Add more examples to `thread::spawn`
Part of #29378
2017-05-09 13:20:04 +02:00
Michael Woerister 115602b1be Add INVALID_CRATE CrateNum constant. 2017-05-09 12:46:43 +02:00
bors c2d53dce7e Auto merge of #41777 - nikomatsakis:issue-41697-mir-dump-cycle, r=arielb1
dump-mir was causing cycles by invoking item-path-str at bad times

Workaround for now, but probably a better fix is to opt **in** to using the types for impls (if we do that at all; maybe filename/line is better).

Fixes #41697
2017-05-09 09:27:50 +00:00
bors bedd7da3d2 Auto merge of #41846 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #41293, #41520, #41827, #41828, #41833, #41836, #41838, #41842
- Failed merges:
2017-05-09 03:36:12 +00:00
Corey Farwell f21209f442 Rollup merge of #41842 - Migi:patch-1, r=eddyb
Fix typo in subst.rs

Changed "unknwon" to "unknown".
2017-05-08 22:34:53 -04:00
Corey Farwell 2f0deec98b Rollup merge of #41838 - z1mvader:fix_fn_args_coerce_closure, r=nikomatsakis
Fixed argument inference for closures when coercing into 'fn'

This fixes https://github.com/rust-lang/rust/issues/41755. The tests  `compile-fail/closure-no-fn.rs` and `compile-fail/issue-40000.rs` were modified. A new test `run-pass/closure_to_fn_coercion-expected-types.rs` was added

r? @nikomatsakis
2017-05-08 22:34:52 -04:00
Corey Farwell 7f30703155 Rollup merge of #41836 - jz0425:master, r=frewsxcv
@bors: r+ 38fe8d2 rollup

1) changed "long way into" to "long way toward"
2) changed "developer lives" to "developers' lives"
3) removed the "either... or..." format from second paragraph because there are more than 2 options
4) Minor revisions to paragraphs 3-6 to make them more consistent in format and to fix minor grammar issues.
2017-05-08 22:34:51 -04:00
Corey Farwell 0a59fc1156 Rollup merge of #41833 - nrc:update, r=nagisa
Update save-analysis deps and RLS submodule
2017-05-08 22:34:50 -04:00
Corey Farwell f4c4334472 Rollup merge of #41828 - arielb1:lvalue-ops, r=eddyb
try to fix lvalue ops for real

Hopefully this is the last PR needed.

Fixes #41726.
Fixes #41742.
Fixes #41774.
2017-05-08 22:34:50 -04:00
Corey Farwell 933df894a6 Rollup merge of #41827 - qnighy:allow-bare-cr-in-nondoc-comment, r=estebank
Allow bare CR in ////-style comment.

Fixes #40624 in a way that bare CR is allowed in all non-doc comments.
2017-05-08 22:34:49 -04:00
Corey Farwell 1940c31c92 Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakis
Use diagnostics for trace_macro instead of println

When using `trace_macro`, use `span_label`s instead of `println`:

```rust
note: trace_macro
  --> $DIR/trace-macro.rs:14:5
   |
14 |     println!("Hello, World!");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expands to `println! { "Hello, World!" }`
   = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }`
```

Fix #22597.
2017-05-08 22:34:47 -04:00
Corey Farwell c104db4801 Rollup merge of #41293 - est31:floating_literal_match, r=nikomatsakis
Implement the illegal_floating_point_literal_pattern compat lint

Adds a future-compatibility lint for the [breaking-change] introduced by issue #41620 . cc issue #41255 .
2017-05-08 22:34:46 -04:00
Jing Zhao 9b8f9b7cf8 Update rustc-ux-guidelines.md
"A `note` to emitted to" changed to "A `note` is emitted to"
2017-05-08 18:15:23 -07:00
Migi dfd584997b Fix typo in subst.rs 2017-05-09 01:32:46 +02:00
bors f1140a3317 Auto merge of #41515 - eddyb:non-static-assoc-const, r=nikomatsakis
rustc: treat const bodies like fn bodies in middle::region.

Allows `T::ASSOC_CONST` to be used without a `T: 'static` bound.

cc @rust-lang/compiler @rust-lang/lang
2017-05-08 23:02:30 +00:00