102208 Commits

Author SHA1 Message Date
Simon Sapin
639c4f779c MaybeUninit::uninit_array docs: better example 2019-11-07 12:05:01 +01:00
Simon Sapin
05c14bcc31 Apply docs suggestions from review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-07 12:05:01 +01:00
Simon Sapin
1906c6f714 Add MaybeUninit methods uninit_array, slice_get_ref, slice_get_mut 2019-11-07 12:05:00 +01:00
Guillaume Gomez
d4527b7e00 Only call onHashChange instead of both functions 2019-11-07 10:39:53 +01:00
Ralf Jung
a5be03654c invalid_value lint: fix help text 2019-11-07 10:22:50 +01:00
Guillaume Gomez
24e093c5c3 Remove old isHidden function 2019-11-07 10:13:44 +01:00
bors
50f8aadd74 Auto merge of #66180 - Centril:rollup-c1ji943, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #59789 (Revert two unapproved changes to rustc_typeck.)
 - #65752 (Use structured suggestions for missing associated items)
 - #65884 (syntax: ABI-oblivious grammar)
 - #65974 (A scheme for more macro-matcher friendly pre-expansion gating)
 - #66017 (Add future incompatibility lint for `array.into_iter()`)

Failed merges:

 - #66056 (rustc_metadata: Some reorganization of the module structure)

r? @ghost
2019-11-07 07:55:39 +00:00
Mazdak Farrokhzad
c9eae9ea63
Rollup merge of #66017 - LukasKalbertodt:array-into-iter-lint, r=matthewjasper
Add future incompatibility lint for `array.into_iter()`

This is for #65819. This lint warns when calling `into_iter` on an array directly. That's because today the method call resolves to `<&[T] as IntoIterator>::into_iter` but that would change when adding `IntoIterator` impls for arrays. This problem is discussed in detail in #65819.

We still haven't decided how to proceed exactly, but it seems like adding a lint is a good idea regardless?

Also: this is the first time I implement a lint, so there are probably a lot of things I can improve. I used a different strategy than @scottmcm describes [here](https://github.com/rust-lang/rust/pull/65819#issuecomment-548667847) since I already started implementing this before they commented.

### TODO

- [x] Decide if we want this lint -> apparently [we want](https://github.com/rust-lang/rust/pull/65819#issuecomment-548964818)
- [x] Open a lint-tracking-issue and add the correct issue number in the code -> https://github.com/rust-lang/rust/issues/66145
2019-11-07 08:51:58 +01:00
Mazdak Farrokhzad
e19cb40fda
Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkov
A scheme for more macro-matcher friendly pre-expansion gating

Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated:

```rust
macro_rules! m {
    ($e:expr) => { 0 }; // This fails on the input below due to `, foo`.
    (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`.
}

fn main() {
    assert_eq!(1, m!(box 42, foo));
}
```

Closes https://github.com/rust-lang/rust/issues/65846.

r? @petrochenkov
cc @Mark-Simulacrum
2019-11-07 08:51:57 +01:00
Mazdak Farrokhzad
883fe10da2
Rollup merge of #65884 - Centril:non-hardcoded-abis, r=petrochenkov
syntax: ABI-oblivious grammar

This PR has the following effects:

1. `extern $lit` is now legal where `$lit:literal` and `$lit` is substituted for a string literal.

2. `extern "abi_that_does_not_exist"` is now *syntactically* legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate.

3. `ast::FloatTy` is now distinct from `rustc_target::abi::FloatTy`. The former is used substantially more and the translation between them is only necessary in a single place.

4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat.

cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :)

r? @varkor
2019-11-07 08:51:55 +01:00
Mazdak Farrokhzad
a3c8572b54
Rollup merge of #65752 - estebank:sugg, r=Centril
Use structured suggestions for missing associated items

When encountering an `impl` that is missing associated items required by its `trait`, use structured suggestions at an appropriate place in the `impl`.
2019-11-07 08:51:54 +01:00
Mazdak Farrokhzad
d7f1406378
Rollup merge of #59789 - eddyb:typeck-reverts, r=nikomatsakis
Revert two unapproved changes to rustc_typeck.

There was a breakdown in process (https://github.com/rust-lang/rust/pull/59004#issuecomment-477600735, https://github.com/rust-lang/rust/pull/58894#discussion_r272795560) and two changes were made to `rustc_typeck`'s "collect" queries, for rustdoc, that were neither needed *nor* correct.
I'm reverting them here, and will fix up rustdoc *somehow*, if necessary.

cc @rust-lang/compiler How do we ensure this doesn't happen again?

r? @nikomatsakis or @oli-obk
2019-11-07 08:51:52 +01:00
Tomasz Miąsko
e88db92148 Use -Zsave-analysis when compiling issue-37323.rs 2019-11-07 08:45:57 +01:00
Mazdak Farrokhzad
55f76cdb2f syntax: use distinct FloatTy from rustc_target.
We also sever syntax's dependency on rustc_target as a result.
This should slightly improve pipe-lining.

Moreover, some cleanup is done in related code.
2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
bffc3d8073 test that extern lits accept raw strings annd escapes 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
b189dfe507 test that parser is oblivious to set of ABIs 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
1db4d607e7 parser: allow ABIs from literal macro fragments 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
49def0769c cleanup can_begin_const_arg 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
beddf67a4b parser: don't hardcode ABIs into grammar 2019-11-07 05:25:31 +01:00
bors
7a76fe76f7 Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #65794 (gate rustc_on_unimplemented under rustc_attrs)
 - #65945 (Optimize long-linker-command-line test)
 - #66044 (Improve uninit/zeroed lint)
 - #66076 (HIR docs: mention how to resolve method paths)
 - #66084 (Do not require extra LLVM backends for `x.py test` to pass)
 - #66111 (improve from_raw_parts docs)
 - #66114 (Improve std:🧵:Result documentation)
 - #66117 (Fixed PhantomData markers in Arc and Rc)
 - #66146 (Remove unused parameters in `__thread_local_inner`)
 - #66147 (Miri: Refactor to_scalar_ptr out of existence)
 - #66162 (Fix broken link in README)
 - #66171 (Update link on CONTRIBUTING.md)

Failed merges:

r? @ghost
2019-11-07 03:54:25 +00:00
Umesh Kalappa
c965432e18 Ignore these tests ,since the called commands doesn't exist in VxWorks 2019-11-06 19:51:25 -08:00
Wesley Wiser
cbe2f6095a Implement pass to remove branches on uninhabited variants 2019-11-06 21:10:29 -05:00
Jeremy Fitzhardinge
446a43da0e Stabilize @file command line arguments
Issue https://github.com/rust-lang/rust/issues/63576
2019-11-06 17:31:15 -08:00
Esteban Küber
52e8ec1432 Remove "here" from "expected one of X here" 2019-11-06 17:26:20 -08:00
Yuki Okushi
b59d166006
Rollup merge of #66171 - JohnTitor:update-link, r=ehuss
Update link on CONTRIBUTING.md

This is a lost article of #66162
Follow-up for rust-lang/rustc-guide#491

CC: @mark-i-m
2019-11-07 09:20:49 +09:00
Yuki Okushi
02de841def
Rollup merge of #66162 - Darksonn:master, r=ehuss
Fix broken link in README

The link to the rustc guide on building and running the compiler is broken. It was broken in [rustc-guide#491](https://github.com/rust-lang/rustc-guide/pull/491).
2019-11-07 09:20:48 +09:00
Yuki Okushi
9e3f0003fd
Rollup merge of #66147 - RalfJung:no-scalar-ptr, r=oli-obk
Miri: Refactor to_scalar_ptr out of existence

`to_scalar_ptr` is somewhat subtle as it just throws away the 2nd component of a `ScalarPair` if there is one -- without any check if this is truly a pointer or so. And indeed we used it wrong on two occasions!

So I fixed those two, and then refactored things such that everyone calls `ref_to_mplace` instead (which they did anyway, I just moved up the calls), which is the only place that should interpret a `ScalarPair` as a wide ptr -- and it checks the type first. Thus we can remove `to_scalar_ptr` and `to_meta`.

r? @oli-obk
2019-11-07 09:20:46 +09:00
Yuki Okushi
de401900b4
Rollup merge of #66146 - 3442853561:patch-2, r=Mark-Simulacrum
Remove unused parameters in `__thread_local_inner`

Fixes #65993.
2019-11-07 09:20:45 +09:00
Yuki Okushi
a2b4ad439c
Rollup merge of #66117 - olegnn:fixed_linked_list_marker, r=RalfJung
Fixed PhantomData markers in Arc and Rc

Include owned internal structs in `PhantomData` markers in `Arc` (`PhantomData<T>` => `PhantomData<ArcInner<T>>`) and `Rc` (`PhantomData<T>` => `PhantomData<RcBox<T>>`).
2019-11-07 09:20:44 +09:00
Yuki Okushi
3032233bb2
Rollup merge of #66114 - golddranks:improve_thread_docs, r=Centril
Improve std:🧵:Result documentation

Thanks to @dtolnay for pointing out the different premise of the contents of the `Err` variant in `std:🧵:Result` WRT normal error handling.
2019-11-07 09:20:42 +09:00
Yuki Okushi
b94a2f9e38
Rollup merge of #66111 - RalfJung:from_raw_parts, r=Centril
improve from_raw_parts docs

Triggered by https://github.com/rust-lang/rfcs/pull/2806. Hopefully this helps clarify that joining slices across allocations is not possible in Rust currently.

r? @Centril
2019-11-07 09:20:41 +09:00
Yuki Okushi
64b2f5cc9f
Rollup merge of #66084 - petrochenkov:x86arm, r=alexcrichton
Do not require extra LLVM backends for `x.py test` to pass

For long time our testing passed with a partially built LLVM
```
[llvm]
targets = "X86;ARM"
```
, a [recent PR](https://github.com/rust-lang/rust/pull/65809) changed that.
2019-11-07 09:20:39 +09:00
Yuki Okushi
a30964e6c0
Rollup merge of #66076 - RalfJung:qpath, r=davidtwco,oli-obk
HIR docs: mention how to resolve method paths
2019-11-07 09:20:38 +09:00
Yuki Okushi
12ffe5ffdd
Rollup merge of #66044 - RalfJung:uninit-lint, r=oli-obk
Improve uninit/zeroed lint

* Also warn when creating a raw pointer with a NULL vtable.
* Also identify `MaybeUninit::uninit().assume_init()` and `MaybeUninit::zeroed().assume_init()` as dangerous.
2019-11-07 09:20:36 +09:00
Yuki Okushi
1988f28009
Rollup merge of #65945 - tmiasko:long-linker-command-line, r=alexcrichton
Optimize long-linker-command-line test

Replace O(n^3) text matching with inexpensive hash set lookups.

On my machine this reduces the total runtime of complete
run-make-fulldeps suite from roughly 75 seconds to 45 seconds.
2019-11-07 09:20:34 +09:00
Yuki Okushi
082a07695b
Rollup merge of #65794 - Centril:unimpl-internal, r=varkor
gate rustc_on_unimplemented under rustc_attrs

Move `rustc_on_implemented` from the `on_implemented` gate to `rustc_attrs` as it is internal.

Closes #29628

r? @varkor
2019-11-07 09:20:33 +09:00
bors
caf0187141 Auto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkov
Cheaper doc comments

This PR implements the idea from #60935: represent doc comments more cheaply, rather than converting them into `#[doc="..."]` attribute form. Unlike #60936 (which is about coalescing doc comments to reduce their number), this approach does not have any backwards compatibility concerns, and it eliminates about 80-90% of the current cost of doc comments (as estimated using the numbers in #60930, which eliminated the cost of doc comments entirely by treating them as normal comments).

r? @petrochenkov
2019-11-07 00:10:52 +00:00
Yuki Okushi
90b094a01a Fix other broken link 2019-11-07 08:30:44 +09:00
Yuki Okushi
1d2a314ef5 Update link on CONTRIBUTING.md 2019-11-07 06:48:28 +09:00
Esteban Küber
543fe5b413 Fix libfmt_macros tests 2019-11-06 12:49:20 -08:00
bors
38048763e8 Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddyb
Fix promotion in a `const` when projections are present

Resolves #65727.

This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`.

r? @eddyb
2019-11-06 18:12:57 +00:00
Esteban Küber
a12a32ab65 review comments 2019-11-06 10:04:23 -08:00
Esteban Küber
f545a50ee4 Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
Guillaume Gomez
0282c27781 rename cfg(rustdoc) into cfg(doc) 2019-11-06 18:32:51 +01:00
Pyry Kontio
8568204f4e Try with crate::error::Error 2019-11-07 01:45:46 +09:00
Alice Ryhl
2daf7b9fe3
Fix broken link in README 2019-11-06 16:41:24 +01:00
Nadrieril
098974dadd Split slice-patterns test as suggested by Centril 2019-11-06 15:27:21 +00:00
Dylan MacKenzie
ec5ba54ed2 Add test for promotability in let
The old const-checker conservatively reset qualifs when
`IsNotPromotable` was in the return place. Unfortunately, named
variables have `IsNotPromotable`, so this could cause promotion to fail.
This should work now.
2019-11-06 07:09:16 -08:00
Nadrieril
7514c48917 Factor out constructing a new wildcard pattern 2019-11-06 15:09:03 +00:00
Nadrieril Feneanar
816aee2501 Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-06 15:09:03 +00:00