]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agolinkchecker: Add support for <base> tag
Oliver Middleton [Sun, 14 May 2017 16:57:59 +0000 (17:57 +0100)]
linkchecker: Add support for <base> tag

Add support for the HTML <base> tag as used by mdBook so The Unstable
Book can be checked.

Also cleanup a few things:
* Stop checking the name attribute. It should never have been used and
mdBook has since been fixed not to use it.
* Make sure we only check html files.
* Remove a few unnecessary allocations.

Finally, dead links in The Unstable Book have been fixed.

7 years agoFix some dead links in The Unstable Book
Oliver Middleton [Sun, 14 May 2017 16:56:24 +0000 (17:56 +0100)]
Fix some dead links in The Unstable Book

7 years agoAuto merge of #41815 - Yamakaky:improve-backtrace-bottom, r=alexcrichton
bors [Wed, 10 May 2017 11:37:22 +0000 (11:37 +0000)]
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.

7 years agoAuto merge of #41764 - scottmcm:faster-reverse, r=brson
bors [Wed, 10 May 2017 08:54:50 +0000 (08:54 +0000)]
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
```

7 years agoAuto merge of #41659 - bluss:clone-split-whitespace, r=aturon
bors [Wed, 10 May 2017 03:27:36 +0000 (03:27 +0000)]
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

7 years agoAuto merge of #41548 - brson:relnotes, r=brson
bors [Tue, 9 May 2017 23:11:53 +0000 (23:11 +0000)]
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

7 years agoAuto merge of #41830 - jonhoo:update-cargo, r=alexcrichton
bors [Tue, 9 May 2017 19:31:35 +0000 (19:31 +0000)]
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.

7 years agoDon't show the std frames before user code on unwinding.
Yamakaky [Sat, 4 Mar 2017 15:27:52 +0000 (10:27 -0500)]
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

7 years agoAuto merge of #41814 - gamazeps:thread-struct-doc, r=steveklabnik
bors [Tue, 9 May 2017 16:31:07 +0000 (16:31 +0000)]
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).

7 years agoBump cargo for rust-lang/cargo#4000
Jon Gjengset [Mon, 8 May 2017 16:07:38 +0000 (12:07 -0400)]
Bump cargo for rust-lang/cargo#4000

Also relies on rust-lang/cargo#4010

7 years agoAddress review comments
Felix Raimundo [Tue, 9 May 2017 14:52:26 +0000 (16:52 +0200)]
Address review comments

7 years agoAuto merge of #41709 - michaelwoerister:close-metadata-ich-holes, r=nikomatsakis
bors [Tue, 9 May 2017 11:55:37 +0000 (11:55 +0000)]
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

7 years agoAdd INVALID_CRATE CrateNum constant.
Michael Woerister [Tue, 9 May 2017 10:46:43 +0000 (12:46 +0200)]
Add INVALID_CRATE CrateNum constant.

7 years agoAuto merge of #41777 - nikomatsakis:issue-41697-mir-dump-cycle, r=arielb1
bors [Tue, 9 May 2017 09:27:50 +0000 (09:27 +0000)]
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

7 years agoAuto merge of #41846 - frewsxcv:rollup, r=frewsxcv
bors [Tue, 9 May 2017 03:36:12 +0000 (03:36 +0000)]
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:

7 years agoRollup merge of #41842 - Migi:patch-1, r=eddyb
Corey Farwell [Tue, 9 May 2017 02:34:53 +0000 (22:34 -0400)]
Rollup merge of #41842 - Migi:patch-1, r=eddyb

Fix typo in subst.rs

Changed "unknwon" to "unknown".

7 years agoRollup merge of #41838 - z1mvader:fix_fn_args_coerce_closure, r=nikomatsakis
Corey Farwell [Tue, 9 May 2017 02:34:52 +0000 (22:34 -0400)]
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

7 years agoRollup merge of #41836 - jz0425:master, r=frewsxcv
Corey Farwell [Tue, 9 May 2017 02:34:51 +0000 (22:34 -0400)]
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.

7 years agoRollup merge of #41833 - nrc:update, r=nagisa
Corey Farwell [Tue, 9 May 2017 02:34:50 +0000 (22:34 -0400)]
Rollup merge of #41833 - nrc:update, r=nagisa

Update save-analysis deps and RLS submodule

7 years agoRollup merge of #41828 - arielb1:lvalue-ops, r=eddyb
Corey Farwell [Tue, 9 May 2017 02:34:50 +0000 (22:34 -0400)]
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.

7 years agoRollup merge of #41827 - qnighy:allow-bare-cr-in-nondoc-comment, r=estebank
Corey Farwell [Tue, 9 May 2017 02:34:49 +0000 (22:34 -0400)]
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.

7 years agoRollup merge of #41520 - estebank:trace-macro, r=nikomatsakis
Corey Farwell [Tue, 9 May 2017 02:34:47 +0000 (22:34 -0400)]
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.

7 years agoRollup merge of #41293 - est31:floating_literal_match, r=nikomatsakis
Corey Farwell [Tue, 9 May 2017 02:34:46 +0000 (22:34 -0400)]
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 .

7 years agoUpdate rustc-ux-guidelines.md
Jing Zhao [Tue, 9 May 2017 01:15:23 +0000 (18:15 -0700)]
Update rustc-ux-guidelines.md

"A `note` to emitted to" changed to "A `note` is emitted to"

7 years agoFix typo in subst.rs
Migi [Mon, 8 May 2017 23:32:46 +0000 (01:32 +0200)]
Fix typo in subst.rs

7 years agoAuto merge of #41515 - eddyb:non-static-assoc-const, r=nikomatsakis
bors [Mon, 8 May 2017 23:02:30 +0000 (23:02 +0000)]
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

7 years agomassive refactor
Christian Poveda [Mon, 8 May 2017 21:39:47 +0000 (16:39 -0500)]
massive refactor

7 years agoadded test
Christian Poveda [Mon, 8 May 2017 21:34:29 +0000 (16:34 -0500)]
added test

7 years agofirst part of issue-40000.rs is now passing
Christian Poveda [Mon, 8 May 2017 21:17:26 +0000 (16:17 -0500)]
first part of issue-40000.rs is now passing

7 years agodividied closure-no-fn.rs into three different tests
Christian Poveda [Mon, 8 May 2017 21:04:49 +0000 (16:04 -0500)]
dividied closure-no-fn.rs into three different tests

7 years agoGrammar fixes to rustc-ux-guidelines.md
Jing Zhao [Mon, 8 May 2017 20:33:54 +0000 (13:33 -0700)]
Grammar fixes to rustc-ux-guidelines.md

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.

7 years agodump-mir was causing cycles by invoking item-path-str at bad times
Niko Matsakis [Sat, 6 May 2017 01:13:44 +0000 (21:13 -0400)]
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).

7 years agoinferring expected types of closure arguments when coercing to a fn
Christian Poveda [Mon, 8 May 2017 19:56:33 +0000 (14:56 -0500)]
inferring expected types of closure arguments when coercing to a fn

7 years agoUpdate save-analysis deps and RLS submodule
Nick Cameron [Mon, 8 May 2017 19:15:48 +0000 (07:15 +1200)]
Update save-analysis deps and RLS submodule

7 years agoAuto merge of #41824 - Mark-Simulacrum:undo-yacc-removal, r=nagisa
bors [Mon, 8 May 2017 15:49:03 +0000 (15:49 +0000)]
Auto merge of #41824 - Mark-Simulacrum:undo-yacc-removal, r=nagisa

Readd LALR grammar

Reverts a portion of #41705. Please let me know if I missed anything.

r? @nagisa

7 years agoRe-add LALR grammar.
Mark Simulacrum [Mon, 8 May 2017 11:33:43 +0000 (05:33 -0600)]
Re-add LALR grammar.

7 years agotry to fix lvalue ops for real
Ariel Ben-Yehuda [Mon, 8 May 2017 14:05:03 +0000 (17:05 +0300)]
try to fix lvalue ops for real

Hopefully this is the last PR needed.

Fixes #41726.
Fixes #41742.
Fixes #41774.

7 years agoAllow bare CR in ////-style comment.
Masaki Hara [Mon, 8 May 2017 13:29:24 +0000 (22:29 +0900)]
Allow bare CR in ////-style comment.

7 years agoAuto merge of #41745 - oli-obk:diagnostics, r=jonathandturner
bors [Mon, 8 May 2017 12:00:22 +0000 (12:00 +0000)]
Auto merge of #41745 - oli-obk:diagnostics, r=jonathandturner

Remove need for &format!(...) or &&"" dances in `span_label` calls

These were always a thorn in my eye. Note that this will monomorphize to two impls, one for `String` and one for `&str`. But I think that cost is worth the ergonomics at the call sites that can be seen throughout this PR.

7 years agoRemove need for &format!(...) or &&"" dances in `span_label` calls
Oliver Schneider [Thu, 4 May 2017 12:17:23 +0000 (14:17 +0200)]
Remove need for &format!(...) or &&"" dances in `span_label` calls

7 years agoincr.comp.: Hash more pieces of crate metadata to detect changes there.
Michael Woerister [Thu, 27 Apr 2017 14:12:57 +0000 (16:12 +0200)]
incr.comp.: Hash more pieces of crate metadata to detect changes there.

7 years agoAuto merge of #41818 - michaelwu:hvx-v60, r=nagisa
bors [Mon, 8 May 2017 05:29:24 +0000 (05:29 +0000)]
Auto merge of #41818 - michaelwu:hvx-v60, r=nagisa

Add support for Hexagon v60 HVX intrinsics

HVX is a SIMD coprocessor available on newer hexagon cores. It can be configured for 512 or 1024 bit registers, and some instructions use pairs of registers. It only does integer operations, but it probably has every integer operation you'd want for 8/16/32 bit elements.

There are a lot of intrinsics. The generator outputs 582 of them. I probably got some wrong. I did some scripting to make sure that every llvm intrinsic name exists, but intrinsic names provided for programs have only been compared by eye to Qualcomm's own names. 64/128 is also appended to the names to select between 512/1024 bit. The C intrinsics don't do this, but they only expose one set, selected at compile time.

The json specifying the intrinsics required a bit of duplication since I didn't see an easy way to specify combinations of signed/unsigned types (eg. u(8-16) and s(16-32)). I also didn't see an easy way to specify variants of instructions like saturating or rounding.

Basic multiplication and load/store tested on the hexagon simulator.

7 years agoAuto merge of #41729 - ubsan:master, r=nrc
bors [Sun, 7 May 2017 22:59:30 +0000 (22:59 +0000)]
Auto merge of #41729 - ubsan:master, r=nrc

Delete features which are easily removed, in libsyntax

7 years agoAdd support for Hexagon v60 HVX intrinsics
Michael Wu [Tue, 18 Apr 2017 20:13:10 +0000 (16:13 -0400)]
Add support for Hexagon v60 HVX intrinsics

7 years agoAuto merge of #41811 - gamazeps:thread-panicking-doc, r=frewsxcv
bors [Sun, 7 May 2017 18:58:14 +0000 (18:58 +0000)]
Auto merge of #41811 - gamazeps:thread-panicking-doc, r=frewsxcv

[DOC] Improve `thread::panicking` documentaion.

Part of #29378

Takes care of: `panicking` could use some more advice on when to use this.

I mays have done a poor choice of introducing `Mutex`s.

r? @steveklabnik

7 years agoUpdate the `thread::Thread` documentation.
Felix Raimundo [Sun, 7 May 2017 17:26:32 +0000 (19:26 +0200)]
Update the `thread::Thread` documentation.

- Copied the module documentation to `Thread`.
- Removed the example because it did not use any method of Thread.

7 years agoAdd stack size doc to `thread::spawn`.
Felix Raimundo [Sun, 7 May 2017 16:42:36 +0000 (18:42 +0200)]
Add stack size doc to `thread::spawn`.

Part of #29378

7 years agoImprove `thread::panicking` documentaion.
Felix Raimundo [Sun, 7 May 2017 14:49:18 +0000 (16:49 +0200)]
Improve `thread::panicking` documentaion.

Part of #29378

7 years agoAuto merge of #41791 - Mark-Simulacrum:doc-guidelines, r=frewsxcv
bors [Sun, 7 May 2017 16:20:15 +0000 (16:20 +0000)]
Auto merge of #41791 - Mark-Simulacrum:doc-guidelines, r=frewsxcv

Minor cleanup of UX guidelines.

I think this fixes https://github.com/rust-lang/rust/issues/34808. It covers the [long error code explanations normalization] by linking to the RFC, and cleaning up the list where long diagnostics are defined. While the [error message overhaul] isn't covered directly, I'm not really sure that more than the [existing section] on the error/warning/help messages is warranted; the overhaul linked didn't really specify any new guidelines, primarily just changing the output format.

[Long error code explanations normalization]: https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md
[Error message overhaul]: https://github.com/rust-lang/rust/issues/33240
[existing section]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc-ux-guidelines.md#error-warning-help-note-messages

7 years agoAuto merge of #40857 - estebank:recursive, r=arielb1
bors [Sun, 7 May 2017 13:57:36 +0000 (13:57 +0000)]
Auto merge of #40857 - estebank:recursive, r=arielb1

Point at fields that make the type recursive

On recursive types of infinite size, point at all the fields that make
the type recursive.

```rust
struct Foo {
    bar: Bar,
}

struct Bar {
    foo: Foo,
}
```

outputs

```
error[E0072]: recursive type `Foo` has infinite size
 --> file.rs:1:1
1 | struct Foo {
  | ^^^^^^^^^^ recursive type has infinite size
2 |     bar: Bar,
  |     -------- recursive here
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable

error[E0072]: recursive type `Bar` has infinite size
 --> file.rs:5:1
  |
5 | struct Bar {
  | ^^^^^^^^^^ recursive type has infinite size
6 |     foo: Foo,
  |     -------- recursive here
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
```

7 years agoAuto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomez
bors [Sun, 7 May 2017 10:52:26 +0000 (10:52 +0000)]
Auto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomez

Allow # to appear in rustdoc code output.

"##" at the start of a trimmed rustdoc line is now cut to "#" and then
shown. If the user wanted to show "##", they can type "###".

I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously, `##` had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where `##` would likely be correct in a code block, though of course I could be wrong.

Fixes #41783.

7 years agoAuto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez
bors [Sun, 7 May 2017 08:30:10 +0000 (08:30 +0000)]
Auto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez

Add links between `slice::{copy,clone}_from_slice` in docs.

None

7 years agofix the easy features in libsyntax
ubsan [Wed, 3 May 2017 17:54:03 +0000 (10:54 -0700)]
fix the easy features in libsyntax

7 years agoAuto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfried
bors [Sun, 7 May 2017 03:01:31 +0000 (03:01 +0000)]
Auto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfried

Increase macro recursion limit to 1024

Fixes #22552

7 years agoAuto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturner
bors [Sun, 7 May 2017 00:41:30 +0000 (00:41 +0000)]
Auto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturner

Fix issue #41652

Fix issue #41652. Don't print anything in `render_source_line()` if no source code is given.

(cc @jonathandturner #34789)

7 years agoAllow # to appear in rustdoc code output.
Mark Simulacrum [Sat, 6 May 2017 13:08:41 +0000 (07:08 -0600)]
Allow # to appear in rustdoc code output.

"##" at the start of a trimmed rustdoc line is now cut to "#" and then
shown. If the user wanted to show "##", they can type "###".

7 years agoAuto merge of #41787 - jsheard:ulongptr, r=alexcrichton
bors [Sat, 6 May 2017 22:14:43 +0000 (22:14 +0000)]
Auto merge of #41787 - jsheard:ulongptr, r=alexcrichton

Fix definitions of ULONG_PTR

The Windows type `ULONG_PTR` is supposed to be equivalent to `usize`, but several parts of the codebase currently define it as `u64`. Evidently this hasn't broken anything yet but it might cause annoying 32-bit-specific breakage in future.

See https://msdn.microsoft.com/en-gb/library/windows/desktop/aa383751(v=vs.85).aspx

r? @alexcrichton

7 years agoMinor cleanup of UX guidelines.
Mark Simulacrum [Sat, 6 May 2017 20:17:26 +0000 (14:17 -0600)]
Minor cleanup of UX guidelines.

7 years agoAuto merge of #41786 - acdenisSK:an_to_a, r=frewsxcv
bors [Sat, 6 May 2017 19:45:10 +0000 (19:45 +0000)]
Auto merge of #41786 - acdenisSK:an_to_a, r=frewsxcv

Fix "an" usage

Since the pr i reviewed on got merged way before the author had a chance to quickly change it, i just did it myself. (Or well, someone else asked me to, if you want me to be honest)

7 years agoAuto merge of #41788 - TimNN:trigger-llvm, r=Mark-Simulacrum
bors [Sat, 6 May 2017 17:18:11 +0000 (17:18 +0000)]
Auto merge of #41788 - TimNN:trigger-llvm, r=Mark-Simulacrum

Trigger llvm rebuild

This was missing from #41739, thanks @tedhorst for noticing!

7 years agoAdd links between `slice::{copy,clone}_from_slice` in docs.
Corey Farwell [Sat, 6 May 2017 13:31:00 +0000 (09:31 -0400)]
Add links between `slice::{copy,clone}_from_slice` in docs.

7 years agoUpdate the .stderr file for the "an" changes
acdenisSK [Sat, 6 May 2017 16:49:01 +0000 (18:49 +0200)]
Update the .stderr file for the "an" changes

7 years agotrigger llvm rebuild
Tim Neumann [Sat, 6 May 2017 15:39:03 +0000 (17:39 +0200)]
trigger llvm rebuild

7 years agorustc: treat const bodies like fn bodies in middle::region.
Eduard-Mihai Burtescu [Mon, 24 Apr 2017 19:03:47 +0000 (22:03 +0300)]
rustc: treat const bodies like fn bodies in middle::region.

7 years agoFix definitions of ULONG_PTR
Joshua Sheard [Sat, 6 May 2017 14:46:16 +0000 (15:46 +0100)]
Fix definitions of ULONG_PTR

7 years agoFix "an" usage
acdenisSK [Sat, 6 May 2017 14:06:38 +0000 (16:06 +0200)]
Fix "an" usage

7 years agoGroup "macro expansion" notes per call span
Esteban Küber [Sat, 6 May 2017 04:49:59 +0000 (21:49 -0700)]
Group "macro expansion" notes per call span

7 years agoMove logic to `is_representable` instead of climbing HIR
Esteban Küber [Sat, 15 Apr 2017 23:18:09 +0000 (16:18 -0700)]
Move logic to `is_representable` instead of climbing HIR

7 years agoAdd reverse benchmarks for u128, [u8;3], and Simd<[f64;4]>
Scott McMurray [Sat, 6 May 2017 03:50:48 +0000 (20:50 -0700)]
Add reverse benchmarks for u128, [u8;3], and Simd<[f64;4]>

None of these are affected by e8fad325fe.

7 years agoAuto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv
bors [Sat, 6 May 2017 02:01:00 +0000 (02:01 +0000)]
Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv

Add an example to std::thread::Result type

This PR is a part of https://github.com/rust-lang/rust/issues/29378. I submit this PR with the help (mentoring) of @steveklabnik. I'm still not sure my request is good enough but I don't want to spoil the issue with too much questions so I continue here. r? @steveklabnik

7 years agoImprove implementation approach comments in [T]::reverse()
Scott McMurray [Sat, 6 May 2017 01:54:47 +0000 (18:54 -0700)]
Improve implementation approach comments in [T]::reverse()

7 years agoAuto merge of #41773 - frewsxcv:rollup, r=frewsxcv
bors [Fri, 5 May 2017 23:20:32 +0000 (23:20 +0000)]
Auto merge of #41773 - frewsxcv:rollup, r=frewsxcv

Rollup of 9 pull requests

- Successful merges: #41064, #41307, #41512, #41582, #41678, #41722, #41734, #41761, #41763
- Failed merges:

7 years agoUse diagnostics for trace_macro instead of println
Esteban Küber [Mon, 24 Apr 2017 23:27:07 +0000 (16:27 -0700)]
Use diagnostics for trace_macro instead of println

7 years agoRollup merge of #41763 - frewsxcv:unicode-py, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:30 +0000 (17:35 -0400)]
Rollup merge of #41763 - frewsxcv:unicode-py, r=alexcrichton

Move unicode Python script into libstd_unicode crate.

The only place this Python script is used is inside the libstd_unicode
crate, so lets move it there.

7 years agoRollup merge of #41761 - euclio:24106-test, r=estebank
Corey Farwell [Fri, 5 May 2017 21:35:29 +0000 (17:35 -0400)]
Rollup merge of #41761 - euclio:24106-test, r=estebank

Add regression test for issue #24106

Fixes #24106.

7 years agoRollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix
Corey Farwell [Fri, 5 May 2017 21:35:29 +0000 (17:35 -0400)]
Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix

Refactor variance and remove last `[pub]` map

This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this:

- We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate
- We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change)
- When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation`
    - this lets us gin up the correct dependencies when requesting variance of a single item

Ah damn, just remembered, one TODO:

- [x] Update the variance README -- ah, I guess the README updates I did are sufficient

r? @michaelwoerister

7 years agoRollup merge of #41722 - F001:warnTilde, r=petrochenkov
Corey Farwell [Fri, 5 May 2017 21:35:28 +0000 (17:35 -0400)]
Rollup merge of #41722 - F001:warnTilde, r=petrochenkov

Suggest `!` for bitwise negation when encountering a `~`

Fix #41679

Here is a program

```rust
fn main() {
    let x = ~1;
}
```

It's output:
```
error: `~` can not be used as an unary operator
 --> /home/fcc/temp/test.rs:4:13
  |
4 |     let x = ~1;
  |             ^^
  |
  = help: use `!` instead of `~` if you meant to bitwise negation
```

cc @bstrie

7 years agoRollup merge of #41678 - GuillaumeGomez:rustdoc-test-warnings, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:27 +0000 (17:35 -0400)]
Rollup merge of #41678 - GuillaumeGomez:rustdoc-test-warnings, r=alexcrichton

Add option to display warnings in rustdoc

Part of #41574.

r? @alexcrichton

The output for this file:

```rust
/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// panic!();
/// ```
fn foo() {}

/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// ```
fn foo2() {}

/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// panic!();
/// ```
fn foo3() {}

fn main() {
}
```

is the following:

```
> ./build/x86_64-apple-darwin/stage1/bin/rustdoc -Z unstable-options --display-warnings --test test.rs

running 3 tests
test test.rs - foo (line 1) ... FAILED
test test.rs - foo3 (line 18) ... FAILED
test test.rs - foo2 (line 10) ... ok

successes:

---- test.rs - foo2 (line 10) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

successes:
    test.rs - foo2 (line 10)

failures:

---- test.rs - foo (line 1) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

thread 'rustc' panicked at 'test executable failed:

thread 'main' panicked at 'explicit panic', <anon>:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', src/librustdoc/test.rs:317
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- test.rs - foo3 (line 18) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

thread 'rustc' panicked at 'test executable failed:

thread 'main' panicked at 'explicit panic', <anon>:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', src/librustdoc/test.rs:317

failures:
    test.rs - foo (line 1)
    test.rs - foo3 (line 18)

test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured
```

7 years agoRollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:26 +0000 (17:35 -0400)]
Rollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, r=alexcrichton

Reload nameserver information on lookup failure

As discussed in #41570, UNIX systems often cache the contents of `/etc/resolv.conf`, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd.

Fixes #41570.
Depends on rust-lang/libc#585.

r? @alexcrichton

7 years agoRollup merge of #41512 - alexcrichton:fix-windows-tls-deadlock, r=BurntSushi
Corey Farwell [Fri, 5 May 2017 21:35:25 +0000 (17:35 -0400)]
Rollup merge of #41512 - alexcrichton:fix-windows-tls-deadlock, r=BurntSushi

std: Avoid locks during TLS destruction on Windows

Gecko recently had a bug reported [1] with a deadlock in the Rust TLS
implementation for Windows. TLS destructors are implemented in a sort of ad-hoc
fashion on Windows as it doesn't natively support destructors for TLS keys. To
work around this the runtime manages a list of TLS destructors and registers a
hook to get run whenever a thread exits. When a thread exits it takes a look at
the list and runs all destructors.

Unfortunately it turns out that there's a lock which is held when our "at thread
exit" callback is run. The callback then attempts to acquire a lock protecting
the list of TLS destructors. Elsewhere in the codebase while we hold a lock over
the TLS destructors we try to acquire the same lock held first before our
special callback is run. And as a result, deadlock!

This commit sidesteps the issue with a few small refactorings:

* Removed support for destroying a TLS key on Windows. We don't actually ever
  exercise this as a public-facing API, and it's only used during `lazy_init`
  during racy situations. To handle that we just synchronize `lazy_init`
  globally on Windows so we never have to call `destroy`.

* With no need to support removal the global synchronized `Vec` was tranformed
  to a lock-free linked list. With the removal of locks this means that
  iteration no long requires a lock and as such we won't run into the deadlock
  problem mentioned above.

Note that it's still a general problem that you have to be extra super careful
in TLS destructors. For example no code which runs a TLS destructor on Windows
can call back into the Windows API to do a dynamic library lookup. Unfortunately
I don't know of a great way around that, but this at least fixes the immediate
problem that Gecko was seeing which is that with "well behaved" destructors the
system would still deadlock!

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151

7 years agoRollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcv
Corey Farwell [Fri, 5 May 2017 21:35:24 +0000 (17:35 -0400)]
Rollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcv

Remove jquery dependency

r? @rust-lang/docs

Fixes #39159.

7 years agoRollup merge of #41064 - Gankro:ptr-redux, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:24 +0000 (17:35 -0400)]
Rollup merge of #41064 - Gankro:ptr-redux, r=alexcrichton

refactor NonZero, Shared, and Unique APIs

Major difference is that I removed Deref impls, as apparently LLVM has
trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited
as a blocker for ever stabilizing this API. It wasn't that ergonomic
anyway.

* Added `get` to NonZero to replace Deref impl
* Added `ptr` getter to Shared/Unique to replace Deref impl
* Added Unique's `get` and `get_mut` conveniences to Shared
* Deprecated `as_mut_ptr` on Shared in favour of `ptr`

Note that Shared used to primarily expose only `*const` but there isn't
a good justification for that, so I made it `*mut`.

7 years agoAuto merge of #41769 - alexcrichton:fix-doc-test, r=aturon
bors [Fri, 5 May 2017 20:44:15 +0000 (20:44 +0000)]
Auto merge of #41769 - alexcrichton:fix-doc-test, r=aturon

std: Prevent deadlocks in doctests on Windows

Windows historically has problems with threads panicking and the main thread
exiting at the same time, typically causing deadlocks. In the past (#25824)
we've joined on threads but this just prevents running the test for now to avoid
tampering with the example.

7 years agochange various uses of `item_variances` to `variances_of`
Niko Matsakis [Fri, 5 May 2017 18:34:42 +0000 (14:34 -0400)]
change various uses of `item_variances` to `variances_of`

7 years agostd: Prevent deadlocks in doctests on Windows
Alex Crichton [Fri, 5 May 2017 14:02:48 +0000 (07:02 -0700)]
std: Prevent deadlocks in doctests on Windows

Windows historically has problems with threads panicking and the main thread
exiting at the same time, typically causing deadlocks. In the past (#25824)
we've joined on threads but this just prevents running the test for now to avoid
tampering with the example.

7 years agoAuto merge of #41765 - brson:installer, r=alexcrichton
bors [Fri, 5 May 2017 17:48:50 +0000 (17:48 +0000)]
Auto merge of #41765 - brson:installer, r=alexcrichton

Update rust-installer to fix rust-lang-nursery/rustup.rs#1092

r? @TimNN

cc @alexcrichton @ranma42

7 years agostd: Avoid locks during TLS destruction on Windows
Alex Crichton [Mon, 24 Apr 2017 18:34:16 +0000 (11:34 -0700)]
std: Avoid locks during TLS destruction on Windows

Gecko recently had a bug reported [1] with a deadlock in the Rust TLS
implementation for Windows. TLS destructors are implemented in a sort of ad-hoc
fashion on Windows as it doesn't natively support destructors for TLS keys. To
work around this the runtime manages a list of TLS destructors and registers a
hook to get run whenever a thread exits. When a thread exits it takes a look at
the list and runs all destructors.

Unfortunately it turns out that there's a lock which is held when our "at thread
exit" callback is run. The callback then attempts to acquire a lock protecting
the list of TLS destructors. Elsewhere in the codebase while we hold a lock over
the TLS destructors we try to acquire the same lock held first before our
special callback is run. And as a result, deadlock!

This commit sidesteps the issue with a few small refactorings:

* Removed support for destroying a TLS key on Windows. We don't actually ever
  exercise this as a public-facing API, and it's only used during `lazy_init`
  during racy situations. To handle that we just synchronize `lazy_init`
  globally on Windows so we never have to call `destroy`.

* With no need to support removal the global synchronized `Vec` was tranformed
  to a lock-free linked list. With the removal of locks this means that
  iteration no long requires a lock and as such we won't run into the deadlock
  problem mentioned above.

Note that it's still a general problem that you have to be extra super careful
in TLS destructors. For example no code which runs a TLS destructor on Windows
can call back into the Windows API to do a dynamic library lookup. Unfortunately
I don't know of a great way around that, but this at least fixes the immediate
problem that Gecko was seeing which is that with "well behaved" destructors the
system would still deadlock!

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151

7 years agoUpdate mod.rs
Raphaël Huchet [Fri, 5 May 2017 10:07:14 +0000 (12:07 +0200)]
Update mod.rs

7 years agoAdd an example to std::thread::Result type
Raphaël Huchet [Fri, 5 May 2017 10:02:02 +0000 (12:02 +0200)]
Add an example to std::thread::Result type

7 years agoSuggest `!` for bitwise negation when encountering a `~`
F001 [Wed, 3 May 2017 06:31:47 +0000 (23:31 -0700)]
Suggest `!` for bitwise negation when encountering a `~`

7 years agoAdd Options type in libtest and remove argument
Guillaume Gomez [Thu, 4 May 2017 21:53:48 +0000 (23:53 +0200)]
Add Options type in libtest and remove argument

7 years agoUpdate rust-installer to fix rust-lang-nursery/rustup.rs#1092
Brian Anderson [Fri, 5 May 2017 07:03:30 +0000 (00:03 -0700)]
Update rust-installer to fix rust-lang-nursery/rustup.rs#1092

7 years agoReload nameserver information on lookup failure
Jon Gjengset [Thu, 27 Apr 2017 16:58:52 +0000 (12:58 -0400)]
Reload nameserver information on lookup failure

As discussed in #41570, UNIX systems often cache the contents of
/etc/resolv.conf, which can cause lookup failures to persist even after
a network connection becomes available. This patch modifies lookup_host
to force a reload of the nameserver entries following a lookup failure.
This is in line with what many C programs already do (see #41570 for
details). On systems with nscd, this should not be necessary, but not
all systems run nscd.

Introduces an std linkage dependency on libresolv on macOS/iOS (which
also makes it necessary to update run-make/tools.mk).

Fixes #41570.
Depends on rust-lang/libc#585.

7 years agoAuto merge of #41762 - frewsxcv:rollup, r=frewsxcv
bors [Fri, 5 May 2017 03:56:34 +0000 (03:56 +0000)]
Auto merge of #41762 - frewsxcv:rollup, r=frewsxcv

Rollup of 4 pull requests

- Successful merges: #41741, #41746, #41749, #41754
- Failed merges:

7 years agoupdate to latest nomicon
Alexis Beingessner [Thu, 4 May 2017 22:02:33 +0000 (18:02 -0400)]
update to latest nomicon

7 years agoDeprecate heap::EMPTY in favour of Unique::empty or otherwise.
Alexis Beingessner [Thu, 4 May 2017 18:48:58 +0000 (14:48 -0400)]
Deprecate heap::EMPTY in favour of Unique::empty or otherwise.

7 years agofallout from NonZero/Unique/Shared changes
Alexis Beingessner [Tue, 4 Apr 2017 16:31:38 +0000 (12:31 -0400)]
fallout from NonZero/Unique/Shared changes

7 years agoMake [u8]::reverse() 5x faster
Scott McMurray [Fri, 5 May 2017 03:28:34 +0000 (20:28 -0700)]
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 :)

7 years agoMove unicode Python script into libstd_unicode crate.
Corey Farwell [Fri, 5 May 2017 02:36:48 +0000 (22:36 -0400)]
Move unicode Python script into libstd_unicode crate.

The only place this Python script is used is inside the libstd_unicode
crate, so lets move it there.

7 years agoOnly point at the fields that cause infinite size
Esteban Küber [Mon, 27 Mar 2017 21:21:27 +0000 (14:21 -0700)]
Only point at the fields that cause infinite size

* clean up code
* point only fields that cause the type to be of infinite size
* fix unittests