]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agodelete this test file: it also appears as
Niko Matsakis [Fri, 23 Feb 2018 01:16:06 +0000 (20:16 -0500)]
delete this test file: it also appears as

src/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs

6 years agoadd test for `fn main() -> !`
Niko Matsakis [Fri, 23 Feb 2018 01:10:36 +0000 (20:10 -0500)]
add test for `fn main() -> !`

6 years agohandle `#[bench]` functions better
Niko Matsakis [Fri, 23 Feb 2018 01:09:10 +0000 (20:09 -0500)]
handle `#[bench]` functions better

6 years agoremove tokenstream
Niko Matsakis [Thu, 22 Feb 2018 23:26:01 +0000 (18:26 -0500)]
remove tokenstream

6 years agomove Termination trait to std::process
Niko Matsakis [Thu, 22 Feb 2018 22:36:55 +0000 (17:36 -0500)]
move Termination trait to std::process

6 years agoput the "unit test" logic into libtest
Niko Matsakis [Wed, 14 Feb 2018 15:06:12 +0000 (10:06 -0500)]
put the "unit test" logic into libtest

Also make `std::termination` module public and rename feature.

The lib feature needs a different name from the language feature.

6 years agobegin crate-relative paths with `crate`
Niko Matsakis [Sun, 11 Feb 2018 14:28:47 +0000 (09:28 -0500)]
begin crate-relative paths with `crate`

6 years agosupport unit tests with return values that implement `Terminaton`
Niko Matsakis [Thu, 8 Feb 2018 22:16:39 +0000 (17:16 -0500)]
support unit tests with return values that implement `Terminaton`

Extend `Termination` trait with a method to determine what happens
with a unit test.

This commit incorporates work by Bastian Köcher <git@kchr.de>.

6 years agoAuto merge of #48399 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 22 Feb 2018 11:25:16 +0000 (11:25 +0000)]
Auto merge of #48399 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 12 pull requests

- Successful merges: #47379, #47833, #48106, #48198, #48314, #48325, #48335, #48352, #48354, #48360, #48382, #48397
- Failed merges:

6 years agoRollup merge of #48397 - ordovicia:pow_doc, r=GuillaumeGomez
Guillaume Gomez [Wed, 21 Feb 2018 15:29:57 +0000 (16:29 +0100)]
Rollup merge of #48397 - ordovicia:pow_doc, r=GuillaumeGomez

Take 2^5 as examples in document of pow()

Fixes #48396 by taking 2^5 as examples.

6 years agoRollup merge of #48382 - GuillaumeGomez:fix-rustdoc-test-panic, r=estebank
Guillaume Gomez [Wed, 21 Feb 2018 15:29:56 +0000 (16:29 +0100)]
Rollup merge of #48382 - GuillaumeGomez:fix-rustdoc-test-panic, r=estebank

Fix rustdoc test ICE

Fixes #48377.

r? @QuietMisdreavus

6 years agoRollup merge of #48360 - redcape:redcape-count-doc-fix, r=cramertj
Guillaume Gomez [Wed, 21 Feb 2018 15:29:55 +0000 (16:29 +0100)]
Rollup merge of #48360 - redcape:redcape-count-doc-fix, r=cramertj

Fix count usize link typo in docs

The docs point to isize when the link should be going to usize instead. Fix the doc.

6 years agoRollup merge of #48354 - m0ppers:add-read-until-link, r=aidanhs
Guillaume Gomez [Wed, 21 Feb 2018 15:29:54 +0000 (16:29 +0100)]
Rollup merge of #48354 - m0ppers:add-read-until-link, r=aidanhs

Add missing link for read_line

Seems I found a missing link 🔗

https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#errors-2

6 years agoRollup merge of #48352 - JakubAdamWieczorek:mailmap, r=petrochenkov
Guillaume Gomez [Wed, 21 Feb 2018 15:29:53 +0000 (16:29 +0100)]
Rollup merge of #48352 - JakubAdamWieczorek:mailmap, r=petrochenkov

Update .mailmap with my real name

Good morning, the Rust team!

Once upon a time I was a modest-scale contributor. Sadly, various turbulences made me step away from my participation in the project. It's great to see how far it's gone.

I would appreciate it if you accepted this small change to the .mailmap file so that it shows my real name as back then I was using an alias. If doubts arise if I am the same person, I will be happy to provide further evidence. :)

Kind regards.

6 years agoRollup merge of #48335 - Manishearth:shortcut-links, r=QuietMisdreavus
Guillaume Gomez [Wed, 21 Feb 2018 15:29:52 +0000 (16:29 +0100)]
Rollup merge of #48335 - Manishearth:shortcut-links, r=QuietMisdreavus

Implement implied shortcut links for intra-rustdoc-links

cc https://github.com/rust-lang/rust/issues/43466

Needs https://github.com/google/pulldown-cmark/pull/126

r? @QuietMisdreavus

6 years agoRollup merge of #48325 - frewsxcv:frewxcv-ignore, r=steveklabnik
Guillaume Gomez [Wed, 21 Feb 2018 15:29:51 +0000 (16:29 +0100)]
Rollup merge of #48325 - frewsxcv:frewxcv-ignore, r=steveklabnik

Mark doc examples w/ `extern` blocks as `ignore`.

Fixes https://github.com/rust-lang/rust/issues/48218.

6 years agoRollup merge of #48314 - frewsxcv:frewsxcv-broken-link, r=GuillaumeGomez
Guillaume Gomez [Wed, 21 Feb 2018 15:29:50 +0000 (16:29 +0100)]
Rollup merge of #48314 - frewsxcv:frewsxcv-broken-link, r=GuillaumeGomez

Fix broken documentation link.

None

6 years agoRollup merge of #48198 - csmoe:inform_type_annotations, r=estebank
Guillaume Gomez [Wed, 21 Feb 2018 15:29:48 +0000 (16:29 +0100)]
Rollup merge of #48198 - csmoe:inform_type_annotations, r=estebank

inform user where to give a type annotation

should resolve #47777
previous pull request https://github.com/rust-lang/rust/pull/47982 was closed because of a mistaken rebase.
r? @estebank

6 years agoRollup merge of #48106 - QuietMisdreavus:teleporting-crates, r=GuillaumeGomez
Guillaume Gomez [Wed, 21 Feb 2018 15:29:47 +0000 (16:29 +0100)]
Rollup merge of #48106 - QuietMisdreavus:teleporting-crates, r=GuillaumeGomez

rustdoc: move manual "extern crate" statements outside automatic "fn main"s in doctests

Gated on https://github.com/rust-lang/rust/pull/48095 - I based the branch atop that so i could show off the change in one of its tests, the actual change in this PR is just the last commit

There are a handful of unfortunate assumptions in the way rustdoc processes `extern crate` statements in doctests:

1. In the absence of an `extern crate` statement in the test, if the test also uses the local crate name, it will automatically insert an `extern crate cratename;` statement into the test.
2. If the doctest *does* include an `extern crate` statement, rustdoc will not automatically insert one, on the assumption that doing so would introduce a duplicate import.
3. If a doctest does not have the substring `fn main` outside a comment, rustdoc will wrap the whole doctest in a generated `fn main` so it can be compiled.

In short, whenever you write a doctest like this...

```rust
//! extern crate my_crate;
//! my_crate::some_cool_thing();
```

...rustdoc will turn it into (something like) this:

```rust
fn main() {
extern crate my_crate;
my_crate::some_cool_thing();
}
```

This creates issues when compiled, because now `my_crate` isn't even properly in scope! This forces people who want to have multiple crates in their doctests (or an explicit `extern crate` statement) to also manually include their own `fn main`, so rustdoc doesn't put their imports in the wrong place.

This PR just taps into another processing step rustdoc does to doctests: Whenever you add an `#![inner_attribute]` to the beginning of a doctest, rustdoc will actually splice those out and put it before the generated `fn main`. Now, we can just do the same with `extern crate`s at the beginning, too, and get a much nicer experience.

Now, the above example will be converted into this:

```rust
extern crate my_crate;
fn main() {
my_crate::some_cool_thing();
}
```

6 years agoRollup merge of #47833 - Aaron1011:final_auto_trait, r=GuillaumeGomez
Guillaume Gomez [Wed, 21 Feb 2018 15:29:46 +0000 (16:29 +0100)]
Rollup merge of #47833 - Aaron1011:final_auto_trait, r=GuillaumeGomez

Generate documentation for auto-trait impls

A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any synthetic implementations for auto traits. Currently, this is only done for Send and Sync.

![Auto trait implementations for Cloned](https://i.imgur.com/XtTV6IJ.png)

On trait pages, a new 'Auto Implementors' section displays all types which automatically implement the trait. Effectively, this is a list of all public types in the standard library.

![Auto trait implementors for Send](https://i.imgur.com/3GRBpTy.png)

Synthesized impls for a particular auto trait ('synthetic impls') take generic bounds into account. For example, a type
```rust
struct Foo<T>(T)
```
 will have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

```rust
struct Foo<T>(T)
struct Wrapper<T>(Foo<T>)
unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes this sound somehow
```

Then Wrapper will have the following impl generated:
```rust
impl<T> Send for Wrapper<T>
```
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send' to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are taken into account by synthetic impls:

![A ridiculous demonstration type](https://i.imgur.com/TkZMWuN.png)

However, if a type can *never* implement a particular auto trait (e.g. `struct MyStruct<T>(*const T)`), then a negative impl will be generated (in this case, `impl<T> !Send for MyStruct<T>`)

All of this means that a user should be able to copy-paste a syntheticimpl into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).

6 years agoRollup merge of #47379 - da-x:master, r=sfackler
Guillaume Gomez [Wed, 21 Feb 2018 15:29:45 +0000 (16:29 +0100)]
Rollup merge of #47379 - da-x:master, r=sfackler

Derive std::cmp::Reverse as Copy or Clone

If the type parameter is Copy or Clone, then `Reverse` should be too.

6 years agoTake 2^5 as examples in document of pow() (fixes #48396)
Hidehito Yabuuchi [Wed, 21 Feb 2018 13:30:40 +0000 (22:30 +0900)]
Take 2^5 as examples in document of pow() (fixes #48396)

Current document takes 2^4, which is equal to 4^2.
This example is not very helpful for those unfamiliar with math words in English and thus rely on example codes.

6 years agoFix rustdoc test ICE
Guillaume Gomez [Tue, 20 Feb 2018 19:30:29 +0000 (20:30 +0100)]
Fix rustdoc test ICE

6 years agoSort synthetic impls bounds before rendering
Aaron Hill [Tue, 20 Feb 2018 01:27:28 +0000 (20:27 -0500)]
Sort synthetic impls bounds before rendering

This removes the implicit dependency on the iteration
order of FxHashMap

6 years agoFix count usize link typo in docs
Gil Cottle [Mon, 19 Feb 2018 20:51:48 +0000 (20:51 +0000)]
Fix count usize link typo in docs

6 years agoAdd missing link
Andreas Streichardt [Mon, 19 Feb 2018 16:19:30 +0000 (17:19 +0100)]
Add missing link

6 years agoUpdate .mailmap with my real name
Jakub Adam Wieczorek [Mon, 19 Feb 2018 13:21:47 +0000 (13:21 +0000)]
Update .mailmap with my real name

6 years agoFilter out non-macros in resolve_macro
Manish Goregaokar [Sun, 18 Feb 2018 23:44:24 +0000 (15:44 -0800)]
Filter out non-macros in resolve_macro

Fixes https://github.com/rust-lang/rust/issues/48341

6 years agoAdd test
Manish Goregaokar [Sun, 18 Feb 2018 22:55:48 +0000 (14:55 -0800)]
Add test

6 years agoGenerate shortcut links
Manish Goregaokar [Sun, 18 Feb 2018 22:32:34 +0000 (14:32 -0800)]
Generate shortcut links

6 years agoInclude shortcut links in markdown_links
Manish Goregaokar [Sun, 18 Feb 2018 21:37:52 +0000 (13:37 -0800)]
Include shortcut links in markdown_links

6 years agobump pulldown
Manish Goregaokar [Sun, 18 Feb 2018 21:33:56 +0000 (13:33 -0800)]
bump pulldown

6 years agoFix submodule ref
Aaron Hill [Mon, 19 Feb 2018 00:40:13 +0000 (19:40 -0500)]
Fix submodule ref

6 years agoRemove extra space in test
Aaron Hill [Sun, 18 Feb 2018 06:23:06 +0000 (01:23 -0500)]
Remove extra space in test

6 years agoDon't generate auto trait impls for type aliases
Aaron Hill [Sat, 17 Feb 2018 03:35:36 +0000 (22:35 -0500)]
Don't generate auto trait impls for type aliases

6 years agoRemove extra whitespace
Aaron Hill [Fri, 16 Feb 2018 16:24:29 +0000 (11:24 -0500)]
Remove extra whitespace

6 years agoFix inlining
Aaron Hill [Thu, 15 Feb 2018 23:45:52 +0000 (18:45 -0500)]
Fix inlining

6 years agoMore formatting fixups
Aaron Hill [Thu, 15 Feb 2018 22:21:26 +0000 (17:21 -0500)]
More formatting fixups

6 years agoMore formatting fixes
Aaron Hill [Sat, 10 Feb 2018 19:53:08 +0000 (14:53 -0500)]
More formatting fixes

6 years agoCleanup formatting
Aaron Hill [Sat, 10 Feb 2018 19:34:46 +0000 (14:34 -0500)]
Cleanup formatting

6 years agoFix merge conflicts
Aaron Hill [Thu, 1 Feb 2018 22:23:48 +0000 (17:23 -0500)]
Fix merge conflicts

6 years agoGenerate documentation for auto-trait impls
Aaron Hill [Wed, 22 Nov 2017 21:16:55 +0000 (16:16 -0500)]
Generate documentation for auto-trait impls

A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any
synthetic implementations for auto traits. Currently, this is only done
for Send and Sync.

On trait pages, a new 'Auto Implementors' section displays all types
which automatically implement the trait. Effectively, this is a list of
all public types in the standard library.

Synthesized impls for a particular auto trait ('synthetic impls') take
into account generic bounds. For example, a type 'struct Foo<T>(T)' will
have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

'struct Foo<T>(T)'
'struct Wrapper<T>(Foo<T>)'
'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes
this sound somehow

Then Wrapper will have the following impl generated:
'impl<T> Send for Wrapper<T>'
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send'
to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are
taken into account by synthetic impls

However, if a type can *never* implement a particular auto trait
(e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be
generated (in this case, 'impl<T> !Send for MyStruct<T>')

All of this means that a user should be able to copy-paste a synthetic
impl into their code, without any observable changes in behavior
(assuming the rest of the program remains unchanged).

6 years agoAuto merge of #48322 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 18 Feb 2018 17:50:21 +0000 (17:50 +0000)]
Auto merge of #48322 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #48194, #48273, #48274, #48275, #48282, #48312
- Failed merges:

6 years agoMark doc examples w/ `extern` blocks as `ignore`.
Corey Farwell [Sun, 18 Feb 2018 14:30:10 +0000 (09:30 -0500)]
Mark doc examples w/ `extern` blocks as `ignore`.

Fixes https://github.com/rust-lang/rust/issues/48218.

6 years agoRollup merge of #48312 - frewsxcv:frewsxcv-section-headings, r=QuietMisdreavus
Guillaume Gomez [Sun, 18 Feb 2018 12:21:03 +0000 (13:21 +0100)]
Rollup merge of #48312 - frewsxcv:frewsxcv-section-headings, r=QuietMisdreavus

Unify 'Platform-specific behavior' documentation headings.

None

6 years agoRollup merge of #48282 - Centril:spelling-fix/iter-repeat-with, r=kennytm
Guillaume Gomez [Sun, 18 Feb 2018 12:21:02 +0000 (13:21 +0100)]
Rollup merge of #48282 - Centril:spelling-fix/iter-repeat-with, r=kennytm

Fix spelling in core::iter::repeat_with: s/not/note

Fixes spelling error in https://github.com/rust-lang/rust/pull/48156#discussion_r168718452.
Tracking issue: https://github.com/rust-lang/rust/issues/48169

6 years agoRollup merge of #48275 - matthiaskrgr:codespell, r=kennytm,varkor
Guillaume Gomez [Sun, 18 Feb 2018 12:21:01 +0000 (13:21 +0100)]
Rollup merge of #48275 - matthiaskrgr:codespell, r=kennytm,varkor

fix more typos found by codespell.

6 years agoRollup merge of #48274 - GuillaumeGomez:remove-hoedown, r=QuietMisdreavus
Guillaume Gomez [Sun, 18 Feb 2018 12:20:59 +0000 (13:20 +0100)]
Rollup merge of #48274 - GuillaumeGomez:remove-hoedown, r=QuietMisdreavus

Remove hoedown from rustdoc

Finally the time has come!

r? @QuietMisdreavus

6 years agoRollup merge of #48273 - alercah:file-warning, r=joshtriplett
Guillaume Gomez [Sun, 18 Feb 2018 12:20:58 +0000 (13:20 +0100)]
Rollup merge of #48273 - alercah:file-warning, r=joshtriplett

Add a warning to File about mutability.

Fixes #47708.

6 years agoRollup merge of #48194 - GuillaumeGomez:doc-test-command, r=Mark-Simulacrum
Guillaume Gomez [Sun, 18 Feb 2018 12:20:57 +0000 (13:20 +0100)]
Rollup merge of #48194 - GuillaumeGomez:doc-test-command, r=Mark-Simulacrum

Doc test command

r? @Mark-Simulacrum

6 years agoAuto merge of #47687 - SimonSapin:panic-impl, r=sfackler
bors [Sun, 18 Feb 2018 06:02:35 +0000 (06:02 +0000)]
Auto merge of #47687 - SimonSapin:panic-impl, r=sfackler

RFC 2070 part 1: PanicInfo and Location API changes

This implements part of https://rust-lang.github.io/rfcs/2070-panic-implementation.html
Tracking issue: https://github.com/rust-lang/rust/issues/44489

* Move `std::panic::PanicInfo` and `std::panic::Location` to a new `core::panic` module. The two types and the `std` module were already `#[stable]` and stay that way, the new `core` module is `#[unstable]`.
* Add a new `PanicInfo::message(&self) -> Option<&fmt::Arguments>` method, which is `#[unstable]`.
* Implement `Display` for `PanicInfo` and `Location`

6 years agoAuto merge of #47544 - U007D:master, r=nikomatsakis
bors [Sun, 18 Feb 2018 03:12:14 +0000 (03:12 +0000)]
Auto merge of #47544 - U007D:master, r=nikomatsakis

Relax termination_trait's error bound

As per [this conversation](https://github.com/withoutboats/failure/issues/130#issuecomment-358572413) with @withoutboats and @bkchr

6 years agofix tyvar_behind_raw_pointer error code
csmoe [Sun, 18 Feb 2018 03:07:52 +0000 (11:07 +0800)]
fix tyvar_behind_raw_pointer error code

6 years agoFix broken documentation link.
Corey Farwell [Sun, 18 Feb 2018 01:57:00 +0000 (20:57 -0500)]
Fix broken documentation link.

6 years agoUnify 'Platform-specific behavior' documentation headings.
Corey Farwell [Sun, 18 Feb 2018 01:54:26 +0000 (20:54 -0500)]
Unify 'Platform-specific behavior' documentation headings.

6 years agofix E0260 error index doctest
QuietMisdreavus [Mon, 12 Feb 2018 16:32:04 +0000 (10:32 -0600)]
fix E0260 error index doctest

6 years agomove manual "extern crate" statements outside auto "fn main" in doctests
QuietMisdreavus [Fri, 9 Feb 2018 20:43:21 +0000 (14:43 -0600)]
move manual "extern crate" statements outside auto "fn main" in doctests

6 years agoRemove useless comment
Guillaume Gomez [Sat, 17 Feb 2018 22:47:45 +0000 (23:47 +0100)]
Remove useless comment

6 years agoAuto merge of #47408 - eddyb:deref-danger, r=nikomatsakis
bors [Sat, 17 Feb 2018 19:32:25 +0000 (19:32 +0000)]
Auto merge of #47408 - eddyb:deref-danger, r=nikomatsakis

Don't promote to 'static the result of dereferences.

This is a **breaking change**, removing copies out of dereferences from rvalue-to-`'static` promotion.

With miri we won't easily know whether the dereference itself would see the same value at runtime as miri (e.g. after mutating a `static`) or even if it can be interpreted (e.g. integer pointers).
One alternative to this ban is defining at least *some* of those situations as UB, i.e. you shouldn't have a reference in the first place, and you should work through raw pointers instead, to avoid promotion.

**EDIT**: The other *may seem* to be to add some analysis which whitelists references-to-constant-values and assume any values produced by arbitrary computation to not be safe to promote dereferences thereof - but that means producing a reference from an associated constant or `const fn` would necessarily obscure it, and in the former case, this could still impact code that runs on stable today. What we do today to track "references to statics" only works because we restrict taking a reference to a `static` at all to other `static`s (which, again, are currently limited in that they can't be read at compile-time) and to runtime-only `fn`s (*not* `const fn`s).

I'm primarily opening this PR with a conservative first approximation (e.g. `&(*r).a` is not allowed, only reborrows are, and in the old borrow only implicit ones from adjustments, at that) for cratering.

r? @nikomatsakis

6 years agoFix unstable book
Guillaume Gomez [Sat, 17 Feb 2018 17:27:46 +0000 (18:27 +0100)]
Fix unstable book

6 years agofix more typos found by codespell.
Matthias Krüger [Fri, 16 Feb 2018 14:56:50 +0000 (15:56 +0100)]
fix more typos found by codespell.

6 years agoAdd command to launch only doc tests
Guillaume Gomez [Sat, 17 Feb 2018 14:45:39 +0000 (15:45 +0100)]
Add command to launch only doc tests

6 years agoUpdate to last repository version
Guillaume Gomez [Sat, 17 Feb 2018 13:22:00 +0000 (14:22 +0100)]
Update to last repository version

6 years agoAuto merge of #48294 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 17 Feb 2018 14:31:32 +0000 (14:31 +0000)]
Auto merge of #48294 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 8 pull requests

- Successful merges: #48095, #48152, #48234, #48239, #48243, #48260, #48284, #48286
- Failed merges:

6 years agoMerge branch 'master' into inform_type_annotations
moe [Sat, 17 Feb 2018 14:22:26 +0000 (22:22 +0800)]
Merge branch 'master' into inform_type_annotations

6 years agofix stderr
csmoe [Sat, 17 Feb 2018 14:18:53 +0000 (14:18 +0000)]
fix stderr

6 years agoWording fixes from review for File.
Alexis Hunt [Sat, 17 Feb 2018 13:47:03 +0000 (08:47 -0500)]
Wording fixes from review for File.

6 years agoRollup merge of #48286 - SergioBenitez:master, r=BurntSushi
Guillaume Gomez [Sat, 17 Feb 2018 13:45:28 +0000 (14:45 +0100)]
Rollup merge of #48286 - SergioBenitez:master, r=BurntSushi

Clarify contiguity of Vec's elements.

Small doc changes for clarity.

6 years agoRollup merge of #48284 - crawford:string, r=sfackler
Guillaume Gomez [Sat, 17 Feb 2018 13:45:27 +0000 (14:45 +0100)]
Rollup merge of #48284 - crawford:string, r=sfackler

Remove unneeded string allocations

6 years agoRollup merge of #48260 - dns2utf8:add_link_to_yield, r=kennytm
Guillaume Gomez [Sat, 17 Feb 2018 13:45:26 +0000 (14:45 +0100)]
Rollup merge of #48260 - dns2utf8:add_link_to_yield, r=kennytm

[doc] Add link to yield_now

A convenient link.

6 years agoRollup merge of #48243 - rust-lang:steveklabnik-patch-1, r=kennytm
Guillaume Gomez [Sat, 17 Feb 2018 13:45:24 +0000 (14:45 +0100)]
Rollup merge of #48243 - rust-lang:steveklabnik-patch-1, r=kennytm

spelling fix in comment

r? @Manishearth

6 years agoRollup merge of #48239 - GuillaumeGomez:fix-condvar-example, r=QuietMisdreavus
Guillaume Gomez [Sat, 17 Feb 2018 13:45:23 +0000 (14:45 +0100)]
Rollup merge of #48239 - GuillaumeGomez:fix-condvar-example, r=QuietMisdreavus

Fix condvar example

Fixes #48230.

r? @QuietMisdreavus

6 years agoRollup merge of #48234 - zombiezen:patch-1, r=steveklabnik
Guillaume Gomez [Sat, 17 Feb 2018 13:45:22 +0000 (14:45 +0100)]
Rollup merge of #48234 - zombiezen:patch-1, r=steveklabnik

Remove "empty buffer" doc in read_until

This appears copied from fill_buf, but the above paragraph already indicates that a lack of delimiter at the end is EOF.

6 years agoRollup merge of #48152 - antoyo:primitive-docs-relevant, r=QuietMisdreavus
Guillaume Gomez [Sat, 17 Feb 2018 13:45:21 +0000 (14:45 +0100)]
Rollup merge of #48152 - antoyo:primitive-docs-relevant, r=QuietMisdreavus

Primitive docs relevant

This fixes the documentation to show the right types in the examples for many integer methods.

I need to check if the result is correct before we merge.

6 years agoRollup merge of #48095 - QuietMisdreavus:doctest-assembly, r=GuillaumeGomez
Guillaume Gomez [Sat, 17 Feb 2018 13:45:20 +0000 (14:45 +0100)]
Rollup merge of #48095 - QuietMisdreavus:doctest-assembly, r=GuillaumeGomez

add unit tests for rustdoc's processing of doctests

cc #42018

There's a lot of things that rustdoc will do to massage doctests into something that can be compiled, and a lot of options that can be toggled to affect this. Hopefully this list of tests can show off that functionality.

The first commit is slightly unrelated but doesn't touch public functionality, because i found that if you have a manual `fn main`, it adds an extra line break at the end, whereas it would trim this extra line break if it were putting a `fn main` in automatically. That first commit makes it trim out that whitespace ahead of time.

6 years agoAuto merge of #47956 - retep998:is-nibbles, r=BurntSushi
bors [Sat, 17 Feb 2018 11:32:16 +0000 (11:32 +0000)]
Auto merge of #47956 - retep998:is-nibbles, r=BurntSushi

This is the ideal FileType on Windows. You may not like it, but this is what peak performance looks like.

Theoretically this would fix https://github.com/rust-lang/rust/issues/46484

The current iteration of this PR should not cause existing code to break, but instead merely improves handling around reparse points. Specifically...

* Reparse points are considered to be symbolic links if they have the name surrogate bit set. Name surrogates are reparse points that effectively act like symbolic links, redirecting you to a different directory/file. By checking for this bit instead of specific tags, we become much more general in our handling of reparse points, including those added by third parties.
* If something is a reparse point but does not have the name surrogate bit set, then we ignore the fact that it is a reparse point because it is actually a file or directory directly there, despite having additional handling by drivers due to the reparse point.
* For everything which is not a symbolic link (including non-surrogate reparse points) we report whether it is a directory or a file based on the presence of the directory attribute bit.
* Notably this still preserves invariant that when `is_symlink` returns `true`, both `is_dir` and `is_file` will return `false`. The potential for breakage was far too high.
* Adds an unstable `FileTypeExt` to allow users to determine whether a symbolic link is a directory or a file, since `FileType` by design is incapable of reporting this information.

6 years agoAuto merge of #47926 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis
bors [Sat, 17 Feb 2018 08:44:41 +0000 (08:44 +0000)]
Auto merge of #47926 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis

add transform for uniform array move out

reworked second step for fix #34708
previous try #46686
r? @nikomatsakis

6 years agoAuto merge of #47917 - davidtwco:issue-47703, r=nikomatsakis
bors [Sat, 17 Feb 2018 05:53:55 +0000 (05:53 +0000)]
Auto merge of #47917 - davidtwco:issue-47703, r=nikomatsakis

Fixes NLL: error from URL crate

Fixes #47703.

r? @nikomatsakis

6 years agoAuto merge of #47906 - Zoxc:nocycle, r=nikomatsakis
bors [Sat, 17 Feb 2018 02:58:21 +0000 (02:58 +0000)]
Auto merge of #47906 - Zoxc:nocycle, r=nikomatsakis

Add a `fatal_cycle` attribute for queries which indicates that they will cause a fatal error on query cycles

This moves us towards the goal of having cycle errors be non-fatal by not relying on the default implementation of `ty::maps::values::Value` which aborts on errors.

r? @nikomatsakis

6 years agoClarify contiguity of Vec's elements.
Sergio Benitez [Sat, 17 Feb 2018 01:05:49 +0000 (17:05 -0800)]
Clarify contiguity of Vec's elements.

6 years agoRemove unneeded string allocations
Alex Crawford [Fri, 16 Feb 2018 22:08:12 +0000 (14:08 -0800)]
Remove unneeded string allocations

6 years agoRemove hoedown from rustdoc
Guillaume Gomez [Fri, 16 Feb 2018 14:09:19 +0000 (15:09 +0100)]
Remove hoedown from rustdoc

Is it really time? Have our months, no, *years* of suffering come to an end? Are we finally able to cast off the pall of Hoedown? The weight which has dragged us down for so long?

-----

So, timeline for those who need to catch up:

* Way back in December 2016, [we decided we wanted to switch out the markdown renderer](https://github.com/rust-lang/rust/issues/38400). However, this was put on hold because the build system at the time made it difficult to pull in dependencies from crates.io.
* A few months later, in March 2017, [the first PR was done, to switch out the renderers entirely](https://github.com/rust-lang/rust/pull/40338). The PR itself was fraught with CI and build system issues, but eventually landed.
* However, not all was well in the Rustdoc world. During the PR and shortly after, we noticed [some differences in the way the two parsers handled some things](https://github.com/rust-lang/rust/issues/40912), and some of these differences were major enough to break the docs for some crates.
* A couple weeks afterward, [Hoedown was put back in](https://github.com/rust-lang/rust/pull/41290), at this point just to catch tests that Pulldown was "spuriously" running. This would at least provide some warning about spurious tests, rather than just breaking spontaneously.
* However, the problems had created enough noise by this point that just a few days after that, [Hoedown was switched back to the default](https://github.com/rust-lang/rust/pull/41431) while we came up with a solution for properly warning about the differences.
* That solution came a few weeks later, [as a series of warnings when the HTML emitted by the two parsers was semantically different](https://github.com/rust-lang/rust/pull/41991). But that came at a cost, as now rustdoc needed proc-macro support (the new crate needed some custom derives farther down its dependency tree), and the build system was not equipped to handle it at the time. It was worked on for three months as the issue stumped more and more people.
  * In that time, [bootstrap was completely reworked](https://github.com/rust-lang/rust/pull/43059) to change how it ordered compilation, and [the method by which it built rustdoc would change](https://github.com/rust-lang/rust/pull/43482), as well. This allowed it to only be built after stage1, when proc-macros would be available, allowing the "rendering differences" PR to finally land.
  * The warnings were not perfect, and revealed a few [spurious](https://github.com/rust-lang/rust/pull/44368) [differences](https://github.com/rust-lang/rust/pull/45421) between how we handled the renderers.
  * Once these were handled, [we flipped the switch to turn on the "rendering difference" warnings all the time](https://github.com/rust-lang/rust/pull/45324), in October 2017. This began the "warning cycle" for this change, and landed in stable in 1.23, on 2018-01-04.
  * Once those warnings hit stable, and after a couple weeks of seeing whether we would get any more reports than what we got from sitting on nightly/beta, [we switched the renderers](https://github.com/rust-lang/rust/pull/47398), making Pulldown the default but still offering the option to use Hoedown.

And that brings us to the present. We haven't received more new issues from this in the meantime, and the "switch by default" is now on beta. Our reasoning is that, at this point, anyone who would have been affected by this has run into it already.

6 years agocore::iter::repeat_with: fix spelling, s/not/note
Mazdak Farrokhzad [Fri, 16 Feb 2018 21:14:32 +0000 (22:14 +0100)]
core::iter::repeat_with: fix spelling, s/not/note

6 years agoNotify users that this example is shared through integer types
Guillaume Gomez [Wed, 14 Feb 2018 18:44:07 +0000 (19:44 +0100)]
Notify users that this example is shared through integer types

6 years agoAuto merge of #48252 - Mark-Simulacrum:exclude-paths, r=alexcrichton
bors [Fri, 16 Feb 2018 15:20:10 +0000 (15:20 +0000)]
Auto merge of #48252 - Mark-Simulacrum:exclude-paths, r=alexcrichton

Fix not running some steps in CI

We'd previously assumed that these paths would be relative to the src
dir, and that for example our various CI scripts would, when calling
x.py, use `../x.py build ../src/tools/...` but this isn't the case --
they use `../x.py` without using the relevant source-relative path.

We eventually may want to make this (actually somewhat logical) change,
but this is not that time.

r? @kennytm

6 years agoAdd a warning to File about mutability.
Alexis Hunt [Fri, 16 Feb 2018 13:51:40 +0000 (08:51 -0500)]
Add a warning to File about mutability.

Fixes #47708.

6 years agoForce the link to std::thread::yield_now()
Stefan Schindler [Fri, 16 Feb 2018 11:20:54 +0000 (12:20 +0100)]
Force the link to std::thread::yield_now()

6 years agoAdd link to yield_now
Stefan Schindler [Fri, 16 Feb 2018 09:30:31 +0000 (10:30 +0100)]
Add link to yield_now

6 years agoFix panic when `x.py` is called without any arguments.
kennytm [Fri, 16 Feb 2018 06:27:45 +0000 (14:27 +0800)]
Fix panic when `x.py` is called without any arguments.

6 years agoAuto merge of #46714 - leodasvacas:refactor-structurally-resolve-type, r=nikomatsakis
bors [Fri, 16 Feb 2018 03:38:44 +0000 (03:38 +0000)]
Auto merge of #46714 - leodasvacas:refactor-structurally-resolve-type, r=nikomatsakis

Refactor diverging and numeric fallback.

This refactoring tries to make numeric fallback easier to reason about. Instead of applying all fallbacks at an arbitrary point in the middle of inference, we apply the fallback only when necessary and only for
the variable that requires it. The only place that requires early fallback is the target of numeric casts.

The  visible consequences is that some error messages that got `i32` now get `{integer}` because we are less eager about fallback.

The bigger goal is to make it easier to integrate user fallbacks into inference, if we ever figure that out.

6 years agoConsider paths passed to x.py to be root-relative.
Mark Simulacrum [Fri, 16 Feb 2018 01:12:04 +0000 (18:12 -0700)]
Consider paths passed to x.py to be root-relative.

We'd previously assumed that these paths would be relative to the src
dir, and that for example our various CI scripts would, when calling
x.py, use `../x.py build ../src/tools/...` but this isn't the case --
they use `../x.py` without using the relevant source-relative path.

We eventually may want to make this (actually somewhat logical) change,
but this is not that time.

6 years agoPrevent silently ignoring unmatched paths
Mark Simulacrum [Fri, 16 Feb 2018 01:01:26 +0000 (18:01 -0700)]
Prevent silently ignoring unmatched paths

Primarily for CI purposes; this is intended to avoid cases where we
update rustbuild and unintentionally make CI stop running some builds to
the arguments being passed no longer applying for some reason.

6 years agoAuto merge of #45404 - giannicic:defaultimpl2, r=nikomatsakis
bors [Fri, 16 Feb 2018 00:03:10 +0000 (00:03 +0000)]
Auto merge of #45404 - giannicic:defaultimpl2, r=nikomatsakis

#37653 support `default impl` for specialization

this commit implements the second part of the `default impl` feature:

>  - a `default impl` need not include all items from the trait
>  - a `default impl` alone does not mean that a type implements the trait

The first point allows rustc to compile and run something like this:

```
trait Foo {
    fn foo_one(&self) -> &'static str;
    fn foo_two(&self) -> &'static str;
}

default impl<T> Foo for T {
    fn foo_one(&self) -> &'static str {
        "generic"
    }
}

struct MyStruct;

fn  main() {
    assert!(MyStruct.foo_one() == "generic");
}
```

but it shows a proper error if trying to call `MyStruct.foo_two()`

The second point allows a `default impl` to be considered as not implementing the `Trait` if it doesn't implement all the trait items.
The tests provided (in the compile-fail section) should cover all the possible trait resolutions.
Let me know if some tests is missed.

See [referenced ](https://github.com/rust-lang/rust/issues/37653) issue for further info

r? @nikomatsakis

6 years agospelling fix in comment
Steve Klabnik [Thu, 15 Feb 2018 19:44:58 +0000 (14:44 -0500)]
spelling fix in comment

6 years agoFix condvar example
Guillaume Gomez [Thu, 15 Feb 2018 17:59:00 +0000 (18:59 +0100)]
Fix condvar example

6 years agoRemove "empty buffer" doc in read_until
Ross Light [Thu, 15 Feb 2018 15:32:42 +0000 (07:32 -0800)]
Remove "empty buffer" doc in read_until

This appears copied from fill_buf, but the above paragraph already indicates that a lack of delimiter at the end is EOF.

6 years agoadd Self: Trait<..> inside the param_env of a default impl
Gianni Ciccarelli [Wed, 14 Feb 2018 17:25:42 +0000 (17:25 +0000)]
add Self: Trait<..> inside the param_env of a default impl

6 years agoAuto merge of #48203 - kennytm:rollup, r=kennytm
bors [Thu, 15 Feb 2018 13:35:20 +0000 (13:35 +0000)]
Auto merge of #48203 - kennytm:rollup, r=kennytm

Rollup of 23 pull requests

- Successful merges: #47784, #47806, #47846, #48005, #48033, #48065, #48087, #48114, #48126, #48130, #48133, #48151, #48154, #48156, #48162, #48163, #48165, #48167, #48181, #48186, #48195, #48035, #48210
- Failed merges:

6 years agoAuto merge of #48105 - Mark-Simulacrum:exclude-paths, r=alexcrichton
bors [Thu, 15 Feb 2018 10:32:33 +0000 (10:32 +0000)]
Auto merge of #48105 - Mark-Simulacrum:exclude-paths, r=alexcrichton

Implement excluding a build-step via --exclude

First step to fixing https://github.com/rust-lang/rust/issues/47911. This doesn't change any CI configuration, but implements what I believe necessary to make that feasible in rustbuild.

In theory this should be sufficient to allow someone to open a PR against .travis.yml and appveyor.yml which splits the Windows 32-bit tests and maybe the OS X tests into multiple builders (depending on what our cost-concerns are) to reduce runtimes.

r? @alexcrichton
cc @kennytm

6 years agoRollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs, r=QuietMisdreavus
kennytm [Thu, 15 Feb 2018 06:36:48 +0000 (14:36 +0800)]
Rollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs, r=QuietMisdreavus

Clarified why `Sized` bound not implicit on trait's implicit `Self` type.

This part of the documentation was a little confusing to me on first read. I've added a couple lines for further explanation. Hopefully this makes things a bit clearer for new readers.