Commit Graph

85114 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
05d59feb64 add test for assignment x = y where type bool is expected. 2019-03-27 10:19:47 +01:00
Mazdak Farrokhzad
7945eff080 generalize diagnostic for x = y where type bool is expected. 2019-03-27 10:19:47 +01:00
bors
c5fb4d0d2f Auto merge of #55780 - ogoffart:span_source_text, r=petrochenkov
Introduce proc_macro::Span::source_text

A function to extract the actual source behind a Span.

Background: I would like to use `syn` in a `build.rs` script to parse the rust code, and extract part of the source code. However, `syn` only gives access to proc_macro2::Span, and i would like to get the source code behind that.
I opened an issue on proc_macro2 bug tracker for this feature https://github.com/alexcrichton/proc-macro2/issues/110  and @alexcrichton said the feature should first go upstream in proc_macro.  So there it is!

Since most of the Span API is unstable anyway, this is guarded by the same `proc_macro_span` feature as everything else.
2019-03-27 08:58:40 +00:00
Mazdak Farrokhzad
bf1068b137 librustc_interface => 2018; rename rustc-rayon to rayon in Cargo.toml 2019-03-27 09:48:50 +01:00
Mazdak Farrokhzad
14f3f6c712 librustc_interface => 2018 2019-03-27 09:41:42 +01:00
Chris Gregory
65b5e57226 Make into itemized list and fix some wording 2019-03-27 01:52:55 -04:00
Chris Gregory
61b6c56f50 Minor rewordings and add dyn keyword 2019-03-27 01:46:24 -04:00
bors
267fb90b55 Auto merge of #59447 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #59004 ([rustdoc] Improve "in parameters" search and search more generally)
 - #59026 (Fix moving text in search tabs headers)
 - #59197 (Exclude old book redirect stubs from search engines)
 - #59330 (Improve the documentation for std::convert (From, Into, AsRef and AsMut))
 - #59424 (Fix code block display in portability element in dark theme)
 - #59427 (Link to PhantomData in NonNull documentation)
 - #59432 (Improve some compiletest documentation)

Failed merges:

r? @ghost
2019-03-27 05:25:50 +00:00
Chris Gregory
a68a0e33d1 Add documentation about for used as higher ranked trait bounds
Resolves #55416
2019-03-27 01:23:14 -04:00
Simonas Kazlauskas
8d4afbe413 Use informational target machine for metadata
Since there is nothing to optimise there...
2019-03-27 04:03:42 +02:00
kenta7777
892f7c430d renames EvalContext to InterpretCx in docs and comments. 2019-03-27 10:57:03 +09:00
bors
dd363d14ae Auto merge of #59285 - cuviper:llvm-8.0.0, r=alexcrichton
Rebase LLVM to 8.0.0 final

r? @alexcrichton
2019-03-27 01:56:14 +00:00
topecongiro
c728ae0fd1 Update rustfmt to 1.2.0 2019-03-27 10:42:13 +09:00
Tim Diekmann
8733b2ab0c
Add Default to std::alloc::System 2019-03-27 00:09:12 +01:00
Guillaume Gomez
5652dd677c Fix error index CSS file name 2019-03-26 23:57:16 +01:00
Markus Westerlind
a365287e10 fix: Make incremental artifact deletion more robust
Should fix the intermittent errors reported in #57958

cc #48614
2019-03-26 23:49:14 +01:00
Nikhil Benesch
d339b89644
Use consistent phrasing for all macro summaries 2019-03-26 18:22:25 -04:00
Guillaume Gomez
50c50e3a82 Handle RUSTDOC_RESOURCE_SUFFIX env variable for rustdoc build 2019-03-26 22:29:30 +01:00
Guillaume Gomez
2d6745de0e Add resource suffix for libtest and proc_macro as well 2019-03-26 22:29:30 +01:00
Guillaume Gomez
080a8e7a71 Prevent cache issues on version updates 2019-03-26 22:29:30 +01:00
Guillaume Gomez
cbb13f496c
Rollup merge of #59432 - phansch:compiletest_docs, r=alexcrichton
Improve some compiletest documentation

This adds some missing documentation for rustfix related things and adds
a test for the `is_test` function.
2019-03-26 22:26:46 +01:00
Guillaume Gomez
616ee876c1
Rollup merge of #59427 - czipperz:non_null_doc_links, r=Mark-Simulacrum
Link to PhantomData in NonNull documentation
2019-03-26 22:26:45 +01:00
Guillaume Gomez
07c83488d5
Rollup merge of #59424 - GuillaumeGomez:fix-stability-css, r=QuietMisdreavus
Fix code block display in portability element in dark theme

Fixes #59261.

r? @QuietMisdreavus

A little screenshot:

<img width="521" alt="Screenshot 2019-03-26 at 00 37 49" src="https://user-images.githubusercontent.com/3050060/54961082-9a41c600-4f5f-11e9-8040-ae6f26d368ff.png">
2019-03-26 22:26:43 +01:00
Guillaume Gomez
4e19b7a0e9
Rollup merge of #59330 - DevQps:improve-std-convert-documentation, r=steveklabnik
Improve the documentation for std::convert (From, Into, AsRef and AsMut)

# Description
In this PR I updated the documentation of From, Into, AsRef and AsMut, as well as the general std::convert module documentation. The discussion in #59163 provided information that was not yet present in the docs, or was not expressed clearly enough. I tried to clarify the examples that were already present in the docs as well as add more information about considered best-practices that came out of the discussion in #59163

@steveklabnik I hope I didn't change too much. This is an initial version! I will scan through everything tomorrow as well again to see if I made any typo's or errors, and maybe make some small changes here and there.

All suggestions are welcome!

closes #59163
2019-03-26 22:26:42 +01:00
Guillaume Gomez
3747868889
Rollup merge of #59197 - kornelski:redir, r=steveklabnik
Exclude old book redirect stubs from search engines

Adds `<meta name="robots" content="noindex,follow">` to the `<head>` of old stub pages pointing to the second edition of the book.

This is continuation of https://github.com/rust-lang/book/pull/1788
2019-03-26 22:26:40 +01:00
Guillaume Gomez
5f390f7a66
Rollup merge of #59026 - GuillaumeGomez:search-tabs-header, r=QuietMisdreavus
Fix moving text in search tabs headers

Fixes #59005.

Now, the text in the search tabs headers isn't moving anymore.

r? @QuietMisdreavus
2019-03-26 22:26:39 +01:00
Guillaume Gomez
f131f042c2
Rollup merge of #59004 - GuillaumeGomez:generics-handling, r=QuietMisdreavus
[rustdoc] Improve "in parameters" search and search more generally

Fixes #58230.

r? @QuietMisdreavus
2019-03-26 22:26:36 +01:00
John Kåre Alsaker
629e3a3f12 Make crate_variances a regular query 2019-03-26 22:02:48 +01:00
John Kåre Alsaker
0b7b454820 Combine input and eval_always query types 2019-03-26 22:02:29 +01:00
Taiki Endo
24a0caec83 librustc_driver => 2018 2019-03-27 05:35:18 +09:00
Esteban Küber
8d1cc72cf9 Add specific message for tuple struct invoked with suffixed numeric field name 2019-03-26 12:32:32 -07:00
Esteban Küber
1bb3694b1a Reword invalid suffixe errors 2019-03-26 12:09:13 -07:00
bors
fbd34efb32 Auto merge of #59433 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #59150 (Expand suggestions for type ascription parse errors)
 - #59232 (Merge `Promoted` and `Static` in `mir::Place`)
 - #59267 (Provide suggestion when using field access instead of path)
 - #59315 (Add no_hash to query macro and move some queries over)
 - #59334 (Update build instructions in README.md)
 - #59362 (Demo `FromIterator` short-circuiting)
 - #59374 (Simplify checked_duration_since)
 - #59389 (replace redundant note in deprecation warning)
 - #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
 - #59419 (Utilize `?` instead of `return None`.)

Failed merges:

r? @ghost
2019-03-26 17:25:16 +00:00
Esteban Küber
c7ddb83980 Use expect_no_suffix for error 2019-03-26 10:18:18 -07:00
John Kåre Alsaker
4093bec80d Exclude UnusedBrokenConst from module lints 2019-03-26 17:04:00 +01:00
TheGoddessInari
2a4281998b
Remove the block on natvis for lld-link. 2019-03-26 08:56:32 -07:00
gnzlbg
0c127e8494 Life's too short not to use cfg_if 2019-03-26 16:14:32 +01:00
gnzlbg
3b6b4899bf Document why the volatile read is used 2019-03-26 13:43:57 +01:00
gnzlbg
1ea57aa3f9 Add exception for libcore/hint.rs to pal lint of tidy script 2019-03-26 13:42:48 +01:00
gnzlbg
d189cab027 Use fallback on emscripten targets 2019-03-26 12:17:03 +01:00
gnzlbg
6ea6e62075 Update jemalloc-sys to version 0.3.0 2019-03-26 11:03:19 +01:00
Mazdak Farrokhzad
d976dbe853 bump bootstrap; adjust stage0 uses in libsyntax_pos 2019-03-26 09:57:42 +01:00
Mazdak Farrokhzad
0b46f0e649 bump bootstrap; adjust stage0 uses in core::ptr. 2019-03-26 09:57:25 +01:00
Mazdak Farrokhzad
750983d356 bump bootstrap => 2019-03-20 2019-03-26 09:53:47 +01:00
Ralf Jung
853ae8d931 fix some uses I missed 2019-03-26 09:23:19 +01:00
Ralf Jung
0e0383abc6 adjust MaybeUninit API to discussions
uninitialized -> uninit
into_initialized -> assume_init
read_initialized -> read
set -> write
2019-03-26 09:21:32 +01:00
Mazdak Farrokhzad
822b4fcb3b
Rollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor
Utilize `?` instead of `return None`.

None
2019-03-26 09:05:53 +01:00
Mazdak Farrokhzad
0677eb1eaa
Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett
Clarify `{Ord,f32,f64}::clamp` docs a little

Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.
2019-03-26 09:05:52 +01:00
Mazdak Farrokhzad
95e7a50166
Rollup merge of #59389 - euclio:deprecated-suggestion, r=varkor
replace redundant note in deprecation warning
2019-03-26 09:05:51 +01:00
Mazdak Farrokhzad
e298691ee9
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmaster
Simplify checked_duration_since

This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top.

Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method".

Added two test cases:
* Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`.
* Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
2019-03-26 09:05:48 +01:00
Mazdak Farrokhzad
0616b73c2f
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting, r=Centril
Demo `FromIterator` short-circuiting

while looking at a FIXME in `FromIterator for Option` and `FromIterator for Result`, I realized that the current documentation does not have example code showing exactly what is meant by "no further elements are taken."

The code snippets provided here are meant to correct that.
2019-03-26 09:05:47 +01:00
Mazdak Farrokhzad
4fbe25cc6b
Rollup merge of #59315 - Zoxc:move-query, r=oli-obk
Add no_hash to query macro and move some queries over

r? @oli-obk
2019-03-26 09:05:44 +01:00
Mazdak Farrokhzad
ba55822801
Rollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwco
Provide suggestion when using field access instead of path

When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.

Fix #57316.
2019-03-26 09:05:43 +01:00
Mazdak Farrokhzad
90c2d641eb
Rollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk
Merge `Promoted` and `Static` in `mir::Place`

fixes #53848
2019-03-26 09:05:40 +01:00
Mazdak Farrokhzad
b316514dbd
Rollup merge of #59150 - estebank:type-ascription, r=varkor
Expand suggestions for type ascription parse errors

Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-26 09:05:39 +01:00
Philipp Hansch
8a9c620340
Improve some compiletest documentation
This adds some missing documentation for rustfix related things and adds
a test for the `is_test` function.
2019-03-26 07:55:00 +01:00
Esteban Küber
6ad77b0938 review comments 2019-03-25 21:38:23 -07:00
kenta7777
630d5a4895 renames EvalContext to InterpretCx. 2019-03-26 13:06:15 +09:00
Esteban Küber
4bad56e54c When moving out of a for loop head, suggest borrowing it in nll mode 2019-03-25 19:29:02 -07:00
bors
54479c624c Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiyn
SGX target: fix std unit tests

This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass.

#59009 must be merged first.
2019-03-26 01:48:34 +00:00
Guillaume Gomez
868833f9a6 Fix code block display in portability element in dark theme 2019-03-26 00:38:29 +01:00
Esteban Küber
91b7423760 Reject integer suffix when tuple indexing 2019-03-25 16:11:21 -07:00
Corey Farwell
28c602a94e Utilize ? instead of return None. 2019-03-25 23:29:49 +01:00
Josh Stone
9e663032a1 [CI] record docker image info for reuse
This writes an extra `dist/image-$image.txt` which contains the S3 URL
of the cached image and the `sha256` digest of the docker entry point.
This will be uploaded with the rest of the deployed artifacts in the
Travis `after_success` script.
2019-03-25 15:27:49 -07:00
Chris Gregory
fd42918a41 Link to PhantomData in NonNull documentation 2019-03-25 18:04:42 -04:00
John Kåre Alsaker
00d8fa3fdb Update tests 2019-03-25 23:01:00 +01:00
John Kåre Alsaker
32bc4a50c0 Make more lints incremental 2019-03-25 23:00:59 +01:00
John Kåre Alsaker
7e156c2066 Make some lints incremental 2019-03-25 23:00:34 +01:00
Jorge Aparicio
7d365cf27f compile all crates under test w/ -Zemit-stack-sizes 2019-03-25 22:50:07 +01:00
Philipp Hansch
d808bd4651
Save coverage file in build_base path, not /tmp 2019-03-25 22:48:35 +01:00
Christian
6c479c3d02 Formatting changes, including better wrapping and creating short summary lines. 2019-03-25 22:21:05 +01:00
Chris Gregory
fbfc8082b4 Rework documentation into examples 2019-03-25 17:20:54 -04:00
Chris Gregory
e91689cd97 Rework documentation to be about fat pointers 2019-03-25 16:38:21 -04:00
John Kåre Alsaker
f7c66fb625 Allocate HIR id counters on demand 2019-03-25 19:43:04 +01:00
Jethro Beekman
f229422cc1 SGX target: fix std unit tests 2019-03-25 11:31:19 -07:00
gnzlbg
24db517419 black_box should use inline assembly on wasm32 2019-03-25 18:43:51 +01:00
Chris Gregory
c709a10434 Refactor tuple comparison tests 2019-03-25 13:00:57 -04:00
bors
4c27fb19ba Auto merge of #59258 - euclio:suggestions-filter-crate, r=oli-obk
filter suggestions from extern prelude

Fixes #59027.

Modifies the candidate gathering code to call `filter_fn` on extern crates, which causes them to be filtered out when looking for a type.
2019-03-25 16:34:15 +00:00
John Kåre Alsaker
cb4ac714e1 Allocate HIR id counters for use trees in MiscCollector 2019-03-25 15:04:28 +01:00
bors
d91b32b4dc Auto merge of #59256 - petrochenkov:derval2, r=Zoxc
Make meta-item API compatible with `LocalInternedString::get` soundness fix

r? @Zoxc
2019-03-25 12:21:46 +00:00
ljedrz
7dd8b776b5 hir: replace NodeId with HirId in ItemId 2019-03-25 13:08:46 +01:00
Tobias Bucher
0bb36a2f90 Clarify {Ord,f32,f64}::clamp docs a little
Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.
2019-03-25 12:52:42 +01:00
Felix S Klock II
0e83e96852
add missing braces
add missing braces analogous to those suggested by killercup
2019-03-25 11:50:11 +01:00
gnzlbg
cfa76c438a black_box should inhibit optimizations on platforms without inline assembly 2019-03-25 11:49:08 +01:00
Pascal Hertleif
6315221b39
Update src/libcore/option.rs
Co-Authored-By: pnkfelix <pnkfelix@pnkfx.org>
2019-03-25 11:48:08 +01:00
gnzlbg
f2443831e9 Remove dupplicated config 2019-03-25 11:44:06 +01:00
gnzlbg
f5d6b3af69 Moves test::black_box to core::hint
This changes removes a cyclic dependency between the "test" and "libtest"
crates, where "libtest" depends on "test" for "black_box", but "test" depends on
"libtest" for everything else.

I've chosen the "hint" module because there seems to be enough consensus in the
discussion of RFC2360 that this module is where such an intrinsic would belong,
but this PR does not implement that RFC! (note: if that RFC ever gets merged,
the API, docs, etc. of this API will need to change).

For backwards compatibility reasons I've chosen to also keep the "test" feature
gate for these instead of adding a new feature gate. If we change the feature
gate, we'll potentially all benchmarks, and while that's something that we could
do, it seems unnecessary to do that now - if RFC2360 gets merged, we'll need to
do that anyways.
2019-03-25 11:44:06 +01:00
bors
3f36ac4e83 Auto merge of #59242 - euclio:asm-ice, r=nagisa
make asm diagnostic instruction optional

`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.

Reopening from #55193. I was unable to trigger the assertion on Windows after rebasing.

Fixes #23458.
Fixes #55216.
2019-03-25 09:05:00 +00:00
Philipp Hansch
98d7c5463b
s/lints/diagnostics
Not all suggestions come from lints
2019-03-25 06:58:30 +01:00
Philipp Hansch
d485ebfc21
Fix two bootstrap tests 2019-03-25 06:57:32 +01:00
bors
60eca54a7c Auto merge of #59240 - euclio:struct-field-span, r=oli-obk
use the identifier span for missing struct field
2019-03-25 05:40:12 +00:00
Andy Russell
695dfe7dff
compiletest: make path normalization smarter 2019-03-25 01:06:45 -04:00
Esteban Küber
4beea1720a Deduplicate code for path suggestion 2019-03-24 19:43:02 -07:00
Esteban Küber
5390414379 Provide suggestion when using field access instead of path
When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.
2019-03-24 19:21:54 -07:00
bors
46914715e2 Auto merge of #59195 - estebank:for-loop-move, r=petrochenkov
When moving out of a for loop head, suggest borrowing it

When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```

Fix #25534.
2019-03-25 00:38:15 +00:00
bors
3752b3d3a5 Auto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkov
Separate `DefId`s for variants and their constructors

Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion.

r? @petrochenkov
2019-03-24 21:26:57 +00:00
Esteban Küber
66202c113a Add nll test 2019-03-24 12:58:30 -07:00
Esteban Küber
ae883dc826 When moving out of a for loop head, suggest borrowing it
When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```
2019-03-24 11:46:13 -07:00
David Wood
23cae1d3f0
Re-order fields in Def::Ctor.
This commit moves the `DefId` field of `Def::Ctor` to be the first
field.
2019-03-24 19:16:44 +01:00
David Wood
88f8f07794
Move CtorOf into hir::def.
This commit moves the definition of `CtorOf` from `rustc::hir` to
`rustc::hir::def` and adds imports wherever it is used.
2019-03-24 18:54:56 +01:00
bors
0576ac109b Auto merge of #59397 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #59213 (Track changes to robots.txt)
 - #59239 (Remove inline assembly from hint::spin_loop)
 - #59251 (Use a valid name for graphviz graphs)
 - #59296 (Do not encode gensymed imports in metadata)
 - #59328 (Implement specialized nth_back() for Box and Windows.)
 - #59355 (Fix ICE with const generic param in struct)
 - #59377 (Correct minimum system LLVM version in tests)
2019-03-24 17:53:45 +00:00
David Wood
db4770f699
Remove CtorOf from Node::Ctor.
This commit removes `CtorOf` from `Node::Ctor` as the parent of the
constructor can be determined by looking at the node's parent in the few
places where knowing this is necessary.
2019-03-24 18:21:59 +01:00
Jorge Aparicio
8b8488ce8f bootstrap: build compiler-builtins with -Z emit-stack-sizes 2019-03-24 17:49:49 +01:00
Andy Russell
4728433c9e
make asm diagnostic instruction optional
`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.
2019-03-24 12:21:03 -04:00
Philipp Hansch
02b8533ac8
Add a way to track Rustfix UI test coverage
This came out of the first Rustfix WG meeting.

One of the goals is to enable Rustfix tests for all UI tests that
trigger lints with `MachineApplicable` suggestions. In order to do that
we first want to create a tracking issue that lists all files with
missing `// run-rustfix` headers.

This PR adds a `--rustfix-coverage` flag to `./x.py` and compiletest to
list the files with the missing headers in `/tmp/rustfix_missing_coverage.txt`.

From that file we can create the tracking issue and at some point also
enforce the `// run-rustfix` flag on UI tests with `MachineApplicable`
lints.
2019-03-24 17:04:40 +01:00
Vadim Petrochenkov
782a6debe4 Revert changes to creation of fictive constructors for struct variants 2019-03-24 18:41:09 +03:00
Andy Russell
8d7c2bb06a
replace redundant note in deprecation warning 2019-03-24 11:02:37 -04:00
Vadim Petrochenkov
2cbc25e6fc Merge DefPathData::VariantCtor and DefPathData::StructCtor 2019-03-24 17:59:18 +03:00
kennytm
00478a0f3c
Rollup merge of #59377 - smaeul:patch/system-llvm, r=nikic
Correct minimum system LLVM version in tests

Since commit 9452a8dfa3, the new debug info format is only generated
for LLVM 8 and newer versions. However, the tests still assume that LLVM
7 will use the new debug info format. Fix the tests (and a comment in
the code) to match the actual version check.
2019-03-24 22:43:48 +08:00
Vadim Petrochenkov
5bcf9f4f11 Slightly more uniform treatment of struct and variant constructors 2019-03-24 17:36:43 +03:00
bors
c7b5f4d0f7 Auto merge of #58305 - scalexm:chalk-continued, r=nikomatsakis
(WIP) Small fixes in chalkification

Small fixes around region constraints and builtin impls. There are still some type inference errors, for example the following code errors out:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::new();
    //                    ^^^^^^^^ cannot infer type for `std::vec::Vec<_>`
}
```
but explicitly specifying `Vec::<i32>::new` works.

With these few fixes, the following code now passes type-checking:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::<i32>::new();
    x.push(5);
    println!("{:?}", x);
}
```

I also fixed the implied bounds bug as discussed on Zulip and in https://github.com/rust-lang-nursery/chalk/pull/206

cc @tmandry
r? @nikomatsakis
2019-03-24 14:26:11 +00:00
Vadim Petrochenkov
7f5a8dcdb9 Remove VariantDef::parent_did 2019-03-24 14:41:35 +03:00
kennytm
70cf325502
Rollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkov
Fix ICE with const generic param in struct

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

r? @petrochenkov
2019-03-24 19:00:18 +08:00
kennytm
cb2dde63d5
Rollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm
Implement specialized nth_back() for Box and Windows.

Hi there, this is my first pull request to rust :-)

I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995.

I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.
2019-03-24 19:00:10 +08:00
kennytm
1d286f7918
Rollup merge of #59296 - petrochenkov:stdup, r=estebank
Do not encode gensymed imports in metadata

(Unless they are underscore `_` imports which are re-gensymed on crate loading, see https://github.com/rust-lang/rust/pull/56392.)

We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream.
Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates.

A workaround that fixes https://github.com/rust-lang/rust/issues/59243.
2019-03-24 19:00:04 +08:00
kennytm
42b7d2c170
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
Use a valid name for graphviz graphs

Hiridification has broken graphviz output because `HirId` has a more complex display implemetation than `NodeId`. Since the id was just used to generate a distinct identifier, we just pull out the various constituent indexed.
2019-03-24 18:59:42 +08:00
Vadim Petrochenkov
c667c2fc08 Remove methods is_struct/is_tuple/is_unit from VariantData 2019-03-24 12:10:16 +03:00
David Wood
5c3d1e5d76 Separate variant id and variant constructor id.
This commit makes two changes - separating the `NodeId` that identifies
an enum variant from the `NodeId` that identifies the variant's
constructor; and no longer creating a `NodeId` for `Struct`-style enum
variants and structs.

Separation of the variant id and variant constructor id will allow the
rest of RFC 2008 to be implemented by lowering the visibility of the
variant's constructor without lowering the visbility of the variant
itself.

No longer creating a `NodeId` for `Struct`-style enum variants and
structs mostly simplifies logic as previously this `NodeId` wasn't used.
There were various cases where the `NodeId` wouldn't be used unless
there was an unit or tuple struct or enum variant but not all uses of
this `NodeId` had that condition, by removing this `NodeId`, this must
be explicitly dealt with. This change mostly applied cleanly, but there
were one or two cases in name resolution and one case in type check
where the existing logic required a id for `Struct`-style enum variants
and structs.
2019-03-24 12:10:16 +03:00
kennytm
48dc8efc85
Rollup merge of #59239 - gnzlbg:fix_spin_loop, r=nagisa
Remove inline assembly from hint::spin_loop

This PR removes the inline assembly which was not required since these
instructions are available in core::arch, and extends support of
the spin_loop hint to arm targets with the v6 feature which also
support the yield instruction.
2019-03-24 15:32:45 +08:00
kennytm
6c5e1d151a
Rollup merge of #59213 - kornelski:robots, r=Mark-Simulacrum
Track changes to robots.txt

Currently `robots.txt` of doc.rust-lang.org is not part of any repo, so there's [no way to contribute any changes to it](https://internals.rust-lang.org/t/deadlock-about-fixing-outdated-documentation-links-in-search-engines/9374), such as needed for #44894 and countless dupes of this issue.

I propose adding it to this repo. I'm not in control of the infrastructure, so I can't help to automate deployment of it, but even just having the file under source control is IMHO a step forward.
2019-03-24 15:32:42 +08:00
bors
fb5ed488ff Auto merge of #59199 - estebank:untrack-errors, r=eddyb
Remove `track_errors` from `check_match`, `typeck_item_bodies` and `register_plugins`

In the spirit of continuing through errors in type checking (#39275), remove `track_errors` from a couple of locations in the codebase.
2019-03-24 05:38:10 +00:00
Saleem Jaffer
fb93f10dac code review fixes 2019-03-24 08:59:11 +05:30
Chris Gregory
00716b480f Make ptr::eq documentation mention smart-pointer behavior
Resolves #59214
2019-03-23 19:43:32 -04:00
bors
93f5ba0ee5 Auto merge of #59084 - estebank:diagnostic-spans, r=davidtwco
Tweak some diagnostic spans
2019-03-23 22:26:11 +00:00
Esteban Küber
59f0f2edc1 Fix span after rebase 2019-03-23 14:10:39 -07:00
Peter Hall
3eb4eae96d Fixes #59361 2019-03-23 20:41:57 +00:00
Esteban Küber
81394ce9ae Fix rebase 2019-03-23 13:05:30 -07:00
Esteban Küber
0a4ecf3438 Mark duplicate import removal suggestion tool only 2019-03-23 13:05:30 -07:00
Esteban Küber
ce90db1ff1 Deduplicate const eval error spans for better output 2019-03-23 13:05:30 -07:00
Esteban Küber
44730271f7 Hide obvious suggestion from cli output 2019-03-23 13:05:30 -07:00
Esteban Küber
3211f38828 Tweak unnecessary import suggestion 2019-03-23 13:05:30 -07:00
Esteban Küber
9bfb0ef818 Tweak unsupported negative trait bounds message 2019-03-23 13:05:30 -07:00
Esteban Küber
e1be8b0318 Swap primary/secondary spans for E0458 2019-03-23 13:05:30 -07:00
Esteban Küber
8e043950c8 Swap const evaluation lint spans to point at problem in primary span 2019-03-23 13:05:30 -07:00
Esteban Küber
1b0ab0b8a9 Tweak spans for E0599 2019-03-23 13:05:29 -07:00
bors
0633c55d20 Auto merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc
HirIdification: kill off NodeId stragglers

The final stages of HirIdification (#57578).

This PR, along with https://github.com/rust-lang/rust/pull/59042, should finalize the HirIdification process (at least the more straightforward bits).

- replace `NodeId` with `HirId` in `trait_impls`
- remove all `NodeId`s from `borrowck`
- remove all `NodeId`s from `typeck`
- remove all `NodeId`s from `mir`
- remove `trait_auto_impl` (unused)

I would be cool to also remove `NodeId` from `hir::def::Def`, `middle::privacy::AccessLevel`  and `hir::ItemId`, but I don't know if this is feasible.

I'll be happy to do more if I've missed anything.
2019-03-23 17:34:18 +00:00
Saleem Jaffer
752544b284 adding mir::StaticKind enum for static and promoted 2019-03-23 20:18:52 +05:30
Vadim Petrochenkov
4b382946e4 syntax: Remove warning for unnecessary path disambiguators 2019-03-23 17:20:11 +03:00
Guillaume Gomez
befe9cac91 Add test 2019-03-23 14:44:20 +01:00
Guillaume Gomez
dc628b4f67 cleanup 2019-03-23 14:43:27 +01:00
varkor
5032643538 Use if let instead of match 2019-03-23 13:05:36 +00:00
bors
0f118f6a6c Auto merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxc
middle: replace NodeId with HirId in AccessLevels

Pushing the limits of HirIdification (#57578).

Replaces `NodeId` with `HirId` in `middle::privacy::AccessLevels`. Actually this time I was more successful and cracked it; I probably tried to HirIdify too much at once when I attempted it last time ^^.

r? @Zoxc
2019-03-23 12:21:27 +00:00
Harald Hoyer
cf8347ba6b
fs::copy() set file mode early
A convenience method like fs::copy() should try to prevent pitfalls a
normal user doesn't think about.

In case of an empty umask, setting the file mode early prevents
temporarily world readable or even writeable files,
because the default mode is 0o666.

In case the target is a named pipe or special device node, setting the
file mode can lead to unwanted side effects, like setting permissons on
`/dev/stdout` or for root setting permissions on `/dev/null`.

copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or
a device like "/dev/null", so fallback to io::copy, too.

Use `fcopyfile` on MacOS instead of `copyfile`.

Fixes: https://github.com/rust-lang/rust/issues/26933
Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-23 07:36:27 +01:00
bors
d51a437e28 Auto merge of #59058 - petrochenkov:assocrecov3, r=estebank
syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem`

This PR improves on https://github.com/rust-lang/rust/pull/46788 covering a few missing cases.

Fixes https://github.com/rust-lang/rust/issues/52307
Fixes https://github.com/rust-lang/rust/issues/53776
r? @estebank
2019-03-23 05:51:16 +00:00
Esteban Küber
e929d19edc review comments 2019-03-22 21:54:19 -07:00
Esteban Küber
2f7b32091e extend on-unimplemented docs 2019-03-22 20:38:14 -07:00
Esteban Küber
ac3290e8d9 Add suggestion to use &*var when &str: From<String> is expected 2019-03-22 20:38:14 -07:00
Esteban Küber
57236324ee Add note to address check_match errors 2019-03-22 20:32:10 -07:00
Esteban Küber
afdc38da0a address review comments 2019-03-22 20:15:32 -07:00
Esteban Küber
c89872cb7d Do not track_errors in register_plugins 2019-03-22 20:15:32 -07:00
Esteban Küber
936dec8df3 Continue running after typeck_item_bodies has failed 2019-03-22 20:15:32 -07:00
Esteban Küber
d1808aa509 Remove track_errors from check_match 2019-03-22 20:15:32 -07:00
Esteban Küber
d72ef21ddd Reword type ascription note to reduce verbosity 2019-03-22 20:14:20 -07:00
Esteban Küber
44a086ef39 Review comment 2019-03-22 19:50:18 -07:00
Esteban Küber
81b876b6a3 Hide "type ascription is experimental error" unless it's the only one
In order to minimize the verbosity of common syntax errors that are parsed
as type ascription, hide the feature gate error unless there are no other
errors being emitted by the parser.
2019-03-22 19:50:18 -07:00
Esteban Küber
72a3089092 Only suggest let assignment for type ascription if we find an equals sign 2019-03-22 19:50:18 -07:00
Esteban Küber
b1a6c32660 Tweak labels 2019-03-22 19:50:18 -07:00
Esteban Küber
8ba1a97e37 Expand suggestions for type ascription parse errors 2019-03-22 19:50:18 -07:00
bors
f21dee2c61 Auto merge of #58929 - estebank:elide-object, r=zackmdavis
Elide object safety errors on non-existent trait function

Fix #58734.

r? @zackmdavis
2019-03-23 02:40:15 +00:00
Samuel Holland
8d3dd39d88 Correct minimum system LLVM version in tests
Since commit 9452a8dfa3, the new debug info format is only generated
for LLVM 8 and newer versions. However, the tests still assume that LLVM
7 will use the new debug info format. Fix the tests (and a comment in
the code) to match the actual version check.
2019-03-22 21:28:25 -05:00
Linus Färnstrand
1ccad16231 Update sys::time impls to have checked_sub_instant 2019-03-22 23:56:40 +01:00
Dan Robertson
8ea435caf8
ffi: rename VaList::copy to VaList::with_copy
Rename `VaList::copy` to `VaList::with_copy`.
2019-03-22 22:28:07 +00:00
Linus Färnstrand
d56b1fd0e7 Make duration_since use checked_duration_since 2019-03-22 22:53:07 +01:00
Linus Färnstrand
37cfeb2710 Add/rename checked_duration_since tests 2019-03-22 22:53:07 +01:00
bors
9f91bee03f Auto merge of #59370 - Centril:rollup, r=Centril
Rollup of 18 pull requests

Successful merges:

 - #59106 (Add peer_addr function to UdpSocket)
 - #59170 (Add const generics to rustdoc)
 - #59172 (Update and clean up several parts of CONTRIBUTING.md)
 - #59190 (consistent naming for Rhs type parameter in libcore/ops)
 - #59236 (Rename miri component to miri-preview)
 - #59266 (Do not complain about non-existing fields after parse recovery)
 - #59273 (some small HIR doc improvements)
 - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64)
 - #59297 (convert field/method confusion help to suggestions)
 - #59304 (Move some bench tests back from libtest)
 - #59309 (Add messages for different verbosity levels. Output copy actions.)
 - #59321 (Unify E0109, E0110 and E0111)
 - #59322 (Tweak incorrect escaped char diagnostic)
 - #59323 (use suggestions for "enum instead of variant" error)
 - #59327 (Add NAN test to docs)
 - #59329 (cleanup: Remove compile-fail-fulldeps directory again)
 - #59347 (Move one test from run-make-fulldeps to ui)
 - #59360 (Add tracking issue number for `seek_convenience`)

Failed merges:

r? @ghost
2019-03-22 21:00:07 +00:00
Andy Russell
b34a71b7da
add suggestions to trim_{left,right} deprecations 2019-03-22 14:56:08 -04:00
Mazdak Farrokhzad
cf8c73936d
Rollup merge of #59360 - LukasKalbertodt:patch-2, r=rkruppe
Add tracking issue number for `seek_convenience`

We forgot to do that in #58422
2019-03-22 19:31:41 +01:00
Mazdak Farrokhzad
4be19e36d9
Rollup merge of #59347 - petrochenkov:nomake, r=davidtwco
Move one test from run-make-fulldeps to ui

The test was written when `--extern` without path didn't exist.
2019-03-22 19:31:40 +01:00
Mazdak Farrokhzad
aae75cf4e1
Rollup merge of #59329 - petrochenkov:rmcff, r=alexcrichton
cleanup: Remove compile-fail-fulldeps directory again

It was already removed once in https://github.com/rust-lang/rust/pull/56444, but was partially resurrected by rebase of some other PR.
2019-03-22 19:31:38 +01:00
Mazdak Farrokhzad
9943a447c1
Rollup merge of #59327 - Xaeroxe:clamp-doc, r=scottmcm
Add NAN test to docs

Documents and tests NAN behavior for the new (f32, f64)::clamp function.
2019-03-22 19:31:37 +01:00
Mazdak Farrokhzad
de08d0ec2d
Rollup merge of #59323 - euclio:enum-instead-of-variant, r=varkor
use suggestions for "enum instead of variant" error
2019-03-22 19:31:36 +01:00
Mazdak Farrokhzad
9d33d6fa4b
Rollup merge of #59322 - estebank:diag-tweak, r=davidtwco
Tweak incorrect escaped char diagnostic
2019-03-22 19:31:34 +01:00
Mazdak Farrokhzad
11429b2d13
Rollup merge of #59321 - varkor:unify-E0109-E0110-E0111, r=davidtwco
Unify E0109, E0110 and E0111

Error messages should no longer be restricted to specific generic kinds.
2019-03-22 19:31:33 +01:00
Mazdak Farrokhzad
f1f34707ae
Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton
Add messages for different verbosity levels. Output copy actions.
2019-03-22 19:31:31 +01:00
Mazdak Farrokhzad
8a36f76735
Rollup merge of #59304 - gnzlbg:bench_tests, r=alexcrichton
Move some bench tests back from libtest

It doesn't make much sense to test these on rust-lang/libtest since they exercise the `#[bench]` macro which is part of rust-lang/rust.

This PR moves these tests back here.

r? @alexcrichton
2019-03-22 19:31:30 +01:00
Mazdak Farrokhzad
0407c642f5
Rollup merge of #59297 - euclio:field-method-suggestions, r=estebank
convert field/method confusion help to suggestions
2019-03-22 19:31:28 +01:00
Mazdak Farrokhzad
d2a958f422
Rollup merge of #59291 - SimonSapin:nonzero-thread-id, r=alexcrichton
Make Option<ThreadId> no larger than ThreadId, with NonZeroU64
2019-03-22 19:31:27 +01:00
Mazdak Farrokhzad
28644cd9fa
Rollup merge of #59273 - llogiq:hir-docs, r=matthewjasper
some small HIR doc improvements
2019-03-22 19:31:25 +01:00
Mazdak Farrokhzad
5a0e4510a8
Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Do not complain about non-existing fields after parse recovery

When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.

Fix #57361.
2019-03-22 19:31:24 +01:00
Mazdak Farrokhzad
adbfcea58f
Rollup merge of #59236 - mati865:miri-preview, r=oli-obk
Rename miri component to miri-preview

It should fix installation via `rustup` and indicates it's not stable yet.
2019-03-22 19:31:22 +01:00
Mazdak Farrokhzad
225b6baae7
Rollup merge of #59190 - greg-kargin:master, r=sanxiyn
consistent naming for Rhs type parameter in libcore/ops

Rename RHS type parameter occurrences RHS->Rhs to make it consistent throughout files and follow naming conventions.
2019-03-22 19:31:21 +01:00
Mazdak Farrokhzad
4c79967760
Rollup merge of #59170 - varkor:const-generics-rustdoc, r=QuietMisdreavus,eddyb
Add const generics to rustdoc

Split out from #53645. This work is a collaborative effort with @yodaldevoid.

The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot.

r? @QuietMisdreavus
2019-03-22 19:31:18 +01:00
Mazdak Farrokhzad
5481b4e1d7
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
Add peer_addr function to UdpSocket

Fixes #59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
2019-03-22 19:31:16 +01:00
bors
cb2f34dc6d Auto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichton
Unify OsString/OsStr for byte-based implementations

As requested in #57860

r? @joshtriplett
2019-03-22 17:34:06 +00:00
bors
ed196221d8 Auto merge of #57810 - MikaelUrankar:stack_t_bsd, r=nagisa
FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void*

…d* [1]

dragonflybsd still uses c_char [2]

[1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438
[2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339
2019-03-22 14:19:42 +00:00
Felix S. Klock II
d5a61c0be2 Expand impl FromIterator for Result doc to include examples of Err and early termination. 2019-03-22 12:44:08 +01:00
Felix S. Klock II
48af7189c2 Expand impl FromIterator for Option doc to include example of early termination. 2019-03-22 12:44:08 +01:00
Mateusz Mikuła
9ee3a4041e Rename miri component to miri-preview
It should fix installation via rustup and indicates it's not stable yet
2019-03-22 12:39:59 +01:00
bors
2210e9a6a9 Auto merge of #59035 - estebank:closure-instacall, r=davidtwco
When encountering `||{}()`, suggest the likely intended `(||{})()`

Fix #55851.
2019-03-22 11:18:11 +00:00
Lukas Kalbertodt
c97d3d4dd1
Add tracking issue number for seek_convenience 2019-03-22 11:25:44 +01:00
bors
f166314b88 Auto merge of #58995 - Centril:refactor-build-manifest, r=alexcrichton
Refactor tools/build-mainfest

I saw some duplication in https://github.com/rust-lang/rust/pull/58990 and got an itch... Will likely need to be rebased when that lands. Hopefully the PR should have zero semantic changes...

r? @alexcrichton
2019-03-22 08:06:48 +00:00
bors
a85ec7c2c0 Auto merge of #59031 - estebank:recover-from-comaless, r=petrochenkov
Recover from missing comma between enum variants and from bad `pub` kw

Fix #56579. Fix #56473.
2019-03-22 04:52:10 +00:00
varkor
f94f85bebd Fix ICE with const generic param in struct 2019-03-22 01:49:42 +00:00
bors
86466a397a Auto merge of #58981 - estebank:elseless-if, r=davidtwco
Point at coercion reason for `if` expressions without else clause if caused by return type

```
error[E0317]: if may be missing an else clause
  --> $DIR/if-without-else-as-fn-expr.rs:2:5
   |
LL |   fn foo(bar: usize) -> usize {
   |                         ----- found `usize` because of this return type
LL | /     if bar % 5 == 0 {
LL | |         return 3;
LL | |     }
   | |_____^ expected (), found usize
   |
   = note: expected type `()`
              found type `usize`
   = note: `if` expressions without `else` must evaluate to `()`
```

Fix #25228.
2019-03-21 23:42:41 +00:00
Philipp Oppermann
45e9accecb Include llvm-ar with llvm-tools component 2019-03-21 23:44:10 +01:00
Guillaume Gomez
6bce61cd4b Fix invalid returned types generation 2019-03-21 22:49:43 +01:00
Guillaume Gomez
aefe75095a Add bounds for return types as well 2019-03-21 22:49:43 +01:00
Guillaume Gomez
6ae73e2ff6 Improve bounds search 2019-03-21 22:49:43 +01:00
Guillaume Gomez
d611301e3e Small generics search improvement 2019-03-21 22:49:43 +01:00
Guillaume Gomez
64382f4b78 Greatly improve generics handling in rustdoc search 2019-03-21 22:49:42 +01:00