]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoStabilize cfg rustdoc
Guillaume Gomez [Fri, 6 Sep 2019 08:51:52 +0000 (10:51 +0200)]
Stabilize cfg rustdoc

4 years agoAuto merge of #66578 - Centril:rollup-pgz1v7t, r=Centril
bors [Wed, 20 Nov 2019 19:15:41 +0000 (19:15 +0000)]
Auto merge of #66578 - Centril:rollup-pgz1v7t, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #66060 (Making ICEs and test them in incremental)
 - #66298 (rustdoc: fixes #64305: disable search field instead of hidding it)
 - #66457 (Just derive Hashstable in librustc)
 - #66496 (rustc_metadata: Privatize more things)
 - #66514 (Fix selected crate search filter)
 - #66535 (Avoid ICE when `break`ing to an unreachable label)
 - #66573 (Ignore run-make reproducible-build-2 on Mac)

Failed merges:

r? @ghost

4 years agoRollup merge of #66573 - pnkfelix:issue-66568-ignore-reproducible-build-2-on-macos...
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:13 +0000 (18:32 +0100)]
Rollup merge of #66573 - pnkfelix:issue-66568-ignore-reproducible-build-2-on-macos, r=alexcrichton

Ignore run-make reproducible-build-2 on Mac

Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows).

Until we can dedicate resources to fixing this properly, I think we are best off just ignoring this test on platforms/contexts where it does not matter as much.

cc #66568

4 years agoRollup merge of #66535 - estebank:issue-62480, r=matthewjasper
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:12 +0000 (18:32 +0100)]
Rollup merge of #66535 - estebank:issue-62480, r=matthewjasper

Avoid ICE when `break`ing to an unreachable label

Fix #62480.

4 years agoRollup merge of #66514 - GuillaumeGomez:fix-search-filter-save, r=kinnison
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:10 +0000 (18:32 +0100)]
Rollup merge of #66514 - GuillaumeGomez:fix-search-filter-save, r=kinnison

Fix selected crate search filter

Fixes #62929.

r? @kinnison

4 years agoRollup merge of #66496 - petrochenkov:metapriv2, r=eddyb
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:09 +0000 (18:32 +0100)]
Rollup merge of #66496 - petrochenkov:metapriv2, r=eddyb

rustc_metadata: Privatize more things

Continuation of https://github.com/rust-lang/rust/pull/66056.

The most notable change here is that `CrateMetadata` is moved from `cstore.rs` to `decoder.rs`.
Most of uses of `CrateMetadata` fields are in the decoder and uses of `root: CrateRoot` and other fields are so intertwined with each other that it would be hard to move a part of them into `cstore.rs` to privatize `CrateMetadata` fields, so we are going the other way round.

`cstore.rs` can probably be dismantled now, but I'll leave this to some other day.
Similarly, remaining `CrateMetadata` fields can be privatized by introducing some getter/setter methods, but not today.

r? @eddyb

4 years agoRollup merge of #66457 - cjgillot:just_hashstable, r=Zoxc
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:07 +0000 (18:32 +0100)]
Rollup merge of #66457 - cjgillot:just_hashstable, r=Zoxc

Just derive Hashstable in librustc

Split out of #66279

r? @Zoxc

4 years agoRollup merge of #66298 - Ppjet6:disable-search-field, r=GuillaumeGomez
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:06 +0000 (18:32 +0100)]
Rollup merge of #66298 - Ppjet6:disable-search-field, r=GuillaumeGomez

rustdoc: fixes #64305: disable search field instead of hidding it

The result seems to be ok but I wasn't entirely sure how to get there. I tried to stay generic a bit but maybe it's not required at all.

@GuillaumeGomez

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
4 years agoRollup merge of #66060 - traxys:test_65401, r=michaelwoerister
Mazdak Farrokhzad [Wed, 20 Nov 2019 17:32:04 +0000 (18:32 +0100)]
Rollup merge of #66060 - traxys:test_65401, r=michaelwoerister

Making ICEs and test them in incremental

This adds:
 - A way to make the compiler ICE
 - A way to check for ICE in `cfail` tests with `should-ice`
 - A regression test for issue #65401

I am not sure the attribute added `should-ice` is the best for this job

4 years agoAuto merge of #66571 - Centril:rollup-41tn2fw, r=Centril
bors [Wed, 20 Nov 2019 14:04:12 +0000 (14:04 +0000)]
Auto merge of #66571 - Centril:rollup-41tn2fw, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #65665 (Update Source Code Pro and include italics)
 - #66478 (rustc_plugin: Remove the compatibility shim)
 - #66497 (Fix #53820)
 - #66526 (Add more context to `async fn` trait error)
 - #66532 (Generate DWARF address ranges for faster lookups)
 - #66546 (Remove duplicate function)
 - #66548 ([RISCV] Disable Atomics on all Non-A RISC-V targets)
 - #66553 (remove HermitCore leftovers from sys/unix)

Failed merges:

r? @ghost

4 years agoIgnore run-make reproducible-build-2 on Mac (we already ignore it on Windows).
Felix S. Klock II [Wed, 20 Nov 2019 13:07:01 +0000 (14:07 +0100)]
Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows).

Until we can dedicate resources to fixing this properly, I think we are
best off just ignoring this test on platforms/contexts where it does not
matter as much.

4 years agoRollup merge of #66553 - hermitcore:hermit, r=rkruppe
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:37 +0000 (12:58 +0100)]
Rollup merge of #66553 - hermitcore:hermit, r=rkruppe

remove HermitCore leftovers from sys/unix

HermitCore support is already moved to the directory "sys/hermit". => remove leftovers

4 years agoRollup merge of #66548 - lenary:riscv/disable-atomics-non-a, r=alexcrichton
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:35 +0000 (12:58 +0100)]
Rollup merge of #66548 - lenary:riscv/disable-atomics-non-a, r=alexcrichton

[RISCV] Disable Atomics on all Non-A RISC-V targets

In a `TargetOptions` configuration, `max_atomic_width: None` causes `max_atomic_width()` to return `Some(target_pointer_width)`. So, contrary to assumptions, `max_atomic_width: None` means you do have atomic support!

RISC-V's rv32i and rv32imc do not have architectural support for atomic memory accesses of any size, because they do not include the `A` architecture extension. This means the values in the target definition should be `Some(0)`.

This bug has been observed via a build failure with oreboot/oreboot#191, where LLVM was still generating libcalls for atomic operations. According to rust-lang/compiler-builtins, "Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations." - so this PR tries to bring rustc inline with this decision.

This commit also removes the outdated bug link, which references a now irrelevant GCC bug.

I will likely also have to revisit the `min_atomic_width` of all the RISC-V targets so they are correct and match what the hardware is capable of (which is more restricted than one might imagine).

r? @alexcrichton

4 years agoRollup merge of #66546 - aradzie:remove_duplicate_function, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:33 +0000 (12:58 +0100)]
Rollup merge of #66546 - aradzie:remove_duplicate_function, r=Dylan-DPC

Remove duplicate function

Function `source_name` declared in file

[src/librustc_driver/lib.rs](https://github.com/rust-lang/rust/blob/master/src/librustc_driver/lib.rs#L87)

is a duplicate of the function by the same name declared in file

[src/librustc/session/config.rs](https://github.com/rust-lang/rust/blob/master/src/librustc/session/config.rs#L511)

4 years agoRollup merge of #66532 - cuviper:dwarf-aranges, r=michaelwoerister
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:32 +0000 (12:58 +0100)]
Rollup merge of #66532 - cuviper:dwarf-aranges, r=michaelwoerister

Generate DWARF address ranges for faster lookups

This adds a new option `-Zgenerate-arange-section`, enabled by default,
corresponding to LLVM's `-generate-arange-section`. This creates a
`.debug_aranges` section with DWARF address ranges, which some tools
depend on to optimize address lookups (elfutils [22288], [25173]).

This only has effect when debuginfo is enabled, and the additional data
is small compared to the other debug sections. For example, libstd.so
with full debuginfo is about 11MB, with just 61kB in aranges.

[22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288
[25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173

Closes #45246.
r? @michaelwoerister

4 years agoRollup merge of #66526 - estebank:async-fn-trait-information, r=Centril
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:30 +0000 (12:58 +0100)]
Rollup merge of #66526 - estebank:async-fn-trait-information, r=Centril

Add more context to `async fn` trait error

Follow up to #65937. Fix #65899.

4 years agoRollup merge of #66497 - Nadrieril:fix-53820, r=varkor
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:29 +0000 (12:58 +0100)]
Rollup merge of #66497 - Nadrieril:fix-53820, r=varkor

Fix #53820

This fixes ICE #53820 by being more clever when matching large arrays with slice patterns.
In particular, it avoids treating large arrays like large tuples, and instead reuses the `VarLenSlice` constructor behaviour to only consider as little values as needed.
As a side-effect, such matches also get improved diagnostics, by reporting `[true, ..]` missing instead of `[true, _, _, _, _, _, _, _]`.

4 years agoRollup merge of #66478 - petrochenkov:rmplugin, r=davidtwco
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:27 +0000 (12:58 +0100)]
Rollup merge of #66478 - petrochenkov:rmplugin, r=davidtwco

rustc_plugin: Remove the compatibility shim

The compatibility crate was introduced in https://github.com/rust-lang/rust/pull/62727 to migrate Cargo and some other tools, but now it's no longer necessary.

4 years agoRollup merge of #65665 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez
Mazdak Farrokhzad [Wed, 20 Nov 2019 11:58:26 +0000 (12:58 +0100)]
Rollup merge of #65665 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez

Update Source Code Pro and include italics

Fixes #65502.

A few notes:
  * As stated in #65502, this does increase the download size.
  * Since this PR changes the font set, I think docs.rs would have to be updated if this PR is merged.
  * The fonts have a double extension (.ttf.woff); this is to keep the names consistent with the upstream font release which does that to distinguish these from the .otf.woff files ([Source Code Pro otf renders poorly on older Windows system apps](https://github.com/adobe-fonts/source-code-pro/issues/25#issuecomment-9019600)).

4 years agoChange background-color of search input if disabled
Guillaume Gomez [Wed, 20 Nov 2019 11:57:47 +0000 (12:57 +0100)]
Change background-color of search input if disabled

4 years agoAuto merge of #66392 - estebank:trait-alias-ice, r=eddyb
bors [Wed, 20 Nov 2019 10:51:26 +0000 (10:51 +0000)]
Auto merge of #66392 - estebank:trait-alias-ice, r=eddyb

Do not ICE on trait aliases with missing obligations

Fix #65673.

4 years agorustdoc: fixes #64305: disable search field instead of hidding it
Maxime “pep” Buquet [Mon, 11 Nov 2019 15:54:45 +0000 (16:54 +0100)]
rustdoc: fixes #64305: disable search field instead of hidding it

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
4 years agoAuto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkov
bors [Wed, 20 Nov 2019 03:07:39 +0000 (03:07 +0000)]
Auto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkov

Generic arg disambiguation

Using the tactic suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/60804#issuecomment-516769465 and on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation), this change checks type arguments to see if they are really incorrectly-parsed const arguments.

it should be noted that `segments.len() == 1 && segments[0].arg.is_none()` was reduced to `segments.len() == 1` as suggested by @petrochenkov in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation/near/177848002). This change allowed a few more existing tests to have their braces removed.

There are a couple of "problems" with these changes that I should note. First, there was a regression in the error messages found in "src/test/ui/privacy-ns1.rs" and "src/test/ui/privacy-ns1.rs". Second, some braces were unable to be removed from "src/test/ui/const-generics/fn-const-param-infer.rs". Those on line 24 caused the statement to stop equating when removed, and those on line 20 cause a statement that should not equate to produce no error when removed.

I have not looked further into any of these issues yet, though I would be willing to look into them before landing this. I simply wanted to get some other eyes on this before going further.

Fixes #60804

cc @varkor @jplatte

4 years agoRevert expansion of impl HashStable for Frame.
Camille GILLOT [Fri, 15 Nov 2019 23:11:02 +0000 (00:11 +0100)]
Revert expansion of impl HashStable for Frame.

4 years agoFix derive syntax.
Camille GILLOT [Fri, 15 Nov 2019 20:23:34 +0000 (21:23 +0100)]
Fix derive syntax.

4 years agoFix project syntax.
Camille GILLOT [Mon, 11 Nov 2019 08:39:23 +0000 (09:39 +0100)]
Fix project syntax.

4 years agoDerive HashStable in librustc_mir.
Camille GILLOT [Sun, 10 Nov 2019 18:30:19 +0000 (19:30 +0100)]
Derive HashStable in librustc_mir.

4 years agoDerive HashStable more.
Camille GILLOT [Sun, 10 Nov 2019 17:41:09 +0000 (18:41 +0100)]
Derive HashStable more.

4 years agoMore HashStable.
Camille GILLOT [Sat, 9 Nov 2019 22:28:07 +0000 (23:28 +0100)]
More HashStable.

4 years agoHermitCore support is moved to sys/hermit, remove obsolete statement in sys/unix
Stefan Lankes [Tue, 19 Nov 2019 19:43:06 +0000 (20:43 +0100)]
HermitCore support is moved to sys/hermit, remove obsolete statement in sys/unix

4 years agoMore HashStable.
Camille GILLOT [Sat, 9 Nov 2019 22:17:42 +0000 (23:17 +0100)]
More HashStable.

4 years agoDerive HashStable in librustc.
Camille GILLOT [Sat, 9 Nov 2019 21:37:21 +0000 (22:37 +0100)]
Derive HashStable in librustc.

4 years agoRemove desugared `async-trait` example
Esteban Kuber [Tue, 19 Nov 2019 19:29:20 +0000 (11:29 -0800)]
Remove desugared `async-trait` example

4 years agoMark -Zgenerate-arange-section as TRACKED
Josh Stone [Tue, 19 Nov 2019 17:13:10 +0000 (09:13 -0800)]
Mark -Zgenerate-arange-section as TRACKED

4 years agoUpdate E0706.md
Dylan DPC [Tue, 19 Nov 2019 16:09:39 +0000 (17:09 +0100)]
Update E0706.md

4 years ago[RISCV] Disable Atomics on all Non-A RISC-V targets
Sam Elliott [Tue, 19 Nov 2019 15:29:43 +0000 (15:29 +0000)]
[RISCV] Disable Atomics on all Non-A RISC-V targets

4 years agoAuto merge of #66454 - cjgillot:lift, r=Zoxc
bors [Tue, 19 Nov 2019 15:24:09 +0000 (15:24 +0000)]
Auto merge of #66454 - cjgillot:lift, r=Zoxc

Derive Lift using a proc-macro

Based on #66384

r? @Zoxc

4 years agoRemove duplicate function
Aliaksandr Radzivanovich [Tue, 19 Nov 2019 13:12:30 +0000 (14:12 +0100)]
Remove duplicate function

Function source_name declared in file

  src/librustc_driver/lib.rs

is a duplicate of a function by the same name declared in file

  src/librustc/session/config.rs

4 years agoAuto merge of #66545 - Centril:rollup-xv2rx7v, r=Centril
bors [Tue, 19 Nov 2019 12:11:09 +0000 (12:11 +0000)]
Auto merge of #66545 - Centril:rollup-xv2rx7v, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #66090 (Misc CI improvements)
 - #66155 (Add long error explanation for E0594)
 - #66239 (Suggest calling async closure when needed)
 - #66430 ([doc] Fix the source code highlighting on source comments)
 - #66431 (Fix 'type annotations needed' error with opaque types)
 - #66461 (Add explanation message for E0641)
 - #66493 (Add JohnTitor to rustc-guide toolstate notification list)
 - #66511 (std::error::Chain: remove Copy)
 - #66529 (resolve: Give derive helpers highest priority during resolution)
 - #66536 (Move the definition of `QueryResult` into `plumbing.rs`.)
 - #66538 (Remove compiler_builtins_lib feature from libstd)

Failed merges:

r? @ghost

4 years agoRollup merge of #66538 - dingelish:master, r=Centril
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:26 +0000 (13:10 +0100)]
Rollup merge of #66538 - dingelish:master, r=Centril

Remove compiler_builtins_lib feature from libstd

Test if we can close #66368 by this patch.

4 years agoRollup merge of #66536 - nnethercote:mv-QueryResult, r=Centril
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:24 +0000 (13:10 +0100)]
Rollup merge of #66536 - nnethercote:mv-QueryResult, r=Centril

Move the definition of `QueryResult` into `plumbing.rs`.

Because it's the only file that uses it, and removes the need for importing it.

r? @Centril

4 years agoRollup merge of #66529 - petrochenkov:reshelp2, r=davidtwco
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:23 +0000 (13:10 +0100)]
Rollup merge of #66529 - petrochenkov:reshelp2, r=davidtwco

resolve: Give derive helpers highest priority during resolution

So they just shadow everything else and don't create ambiguity errors.
This matches the old pre-#64694 behavior most closely.

---
The change doesn't apply to this "compatibility" case
```rust
#[trait_helper] // The helper attribute is used before it introduced.
                        // Sadly, compiles on stable, supported via hacks.
                        // I plan to make a compatibility warning for this.
#[derive(Trait)]
struct S;
```
, such attributes still create ambiguities, but #64694 didn't change anything for this case.

Fixes https://github.com/rust-lang/rust/issues/66508
Fixes https://github.com/rust-lang/rust/issues/66525

4 years agoRollup merge of #66511 - haraldh:error_chain_nocopy, r=dtolnay
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:22 +0000 (13:10 +0100)]
Rollup merge of #66511 - haraldh:error_chain_nocopy, r=dtolnay

std::error::Chain: remove Copy

remove Copy from Iterator as per comment
https://github.com/rust-lang/rust/issues/58520#issuecomment-553682166

Tracker: #58520

4 years agoRollup merge of #66493 - JohnTitor:ping-me-rustc-guide, r=spastorino
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:20 +0000 (13:10 +0100)]
Rollup merge of #66493 - JohnTitor:ping-me-rustc-guide, r=spastorino

Add JohnTitor to rustc-guide toolstate notification list

Add JohnTitor to rustc-guide toolstate notification list
Also, update org names of some books

r? @spastorino

4 years agoRollup merge of #66461 - clemencetbk:master, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:19 +0000 (13:10 +0100)]
Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomez

Add explanation message for E0641

Part of #61137

4 years agoRollup merge of #66431 - Aaron1011:fix/opaque-type-infer, r=varkor
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:17 +0000 (13:10 +0100)]
Rollup merge of #66431 - Aaron1011:fix/opaque-type-infer, r=varkor

Fix 'type annotations needed' error with opaque types

Related: #66426

This commit adds handling for opaque types during inference variable
fallback. Type variables generated from the instantiation of opaque
types now fallback to the opaque type itself.

Normally, the type variable for an instantiated opaque type is either
unified with the concrete type, or with the opaque type itself (e.g when
a function returns an opaque type by calling another function).

However, it's possible for the type variable to be left completely
unconstrained. This can occur in code like this:

```rust
pub type Foo = impl Copy;
fn produce() -> Option<Foo> {
    None
}
```

Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type
variable, but we will never unify it with anything due to the fact
that we return a `None`.

This results in the error message:
```
type annotations needed: cannot resolve `_: std::marker::Copy
```

pointing at `pub type Foo = impl Copy`.

This message is not only confusing, it's incorrect. When an opaque type
inference variable is completely unconstrained, we can always fall back
to using the opaque type itself. This effectively turns that particular
use of the opaque type into a non-defining use, even if it appears in a
defining scope.

4 years agoRollup merge of #66430 - dns2utf8:fix_code_selection_click_handler, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:15 +0000 (13:10 +0100)]
Rollup merge of #66430 - dns2utf8:fix_code_selection_click_handler, r=GuillaumeGomez

[doc] Fix the source code highlighting on source comments

The code would always forget the previous selection.

r? @GuillaumeGomez

4 years agoRollup merge of #66239 - estebank:suggest-async-closure-call, r=Centril
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:14 +0000 (13:10 +0100)]
Rollup merge of #66239 - estebank:suggest-async-closure-call, r=Centril

Suggest calling async closure when needed

When using an async closure as a value in a place that expects a future,
suggest calling the closure.

Fix #65923.

4 years agoRollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:12 +0000 (13:10 +0100)]
Rollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPC

Add long error explanation for E0594

Part of #61137.

r? @Dylan-DPC

4 years agoRollup merge of #66090 - pietroalbini:ci-improvements, r=alexcrichton
Mazdak Farrokhzad [Tue, 19 Nov 2019 12:10:09 +0000 (13:10 +0100)]
Rollup merge of #66090 - pietroalbini:ci-improvements, r=alexcrichton

Misc CI improvements

This PR contains some misc improvements to our CI configuration:

* The environment variables for MinGW builders were greatly simplified, with just `CUSTOM_MINGW=1` to tell the install scripts to install the vendored copy. All the others (`MINGW_URL`, `MINGW_DIR`, `MINGW_ARCHIVE` and `MSYS_BITS`) are detected either from the builder name or the environment.
* Collecting CPU stats and running the build were moved into scripts.
* Toolstate scripts validation was previously a separate step, ran just when `IMAGE=mingw-check`. This moves the validation code inside the actual image.
* Vendored copies are now fetched from https://ci-mirrors.rust-lang.org instead of directly from the bucket.

r? @alexcrichton

4 years agoAuto merge of #66206 - PotHix:master, r=estebank
bors [Tue, 19 Nov 2019 07:49:54 +0000 (07:49 +0000)]
Auto merge of #66206 - PotHix:master, r=estebank

Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]`

The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead.

r? @estebank

Ref: #61286.

4 years agoMove the definition of `QueryResult` into `plumbing.rs`.
Nicholas Nethercote [Fri, 1 Nov 2019 04:16:52 +0000 (15:16 +1100)]
Move the definition of `QueryResult` into `plumbing.rs`.

Because it's the only file that uses it, and removes the need for
importing it.

4 years agoAuto merge of #66074 - wesleywiser:test_run_const_prop, r=oli-obk
bors [Tue, 19 Nov 2019 04:38:47 +0000 (04:38 +0000)]
Auto merge of #66074 - wesleywiser:test_run_const_prop, r=oli-obk

[mir-opt] Turn on the `ConstProp` pass by default

perf.rlo shows that running the `ConstProp` pass results in
across-the-board wins regardless of debug or opt complilation mode. As a
result, we're turning it on to get the compile time benefits.

4 years agoRemove compiler_builtins_lib feature from libstd
Yu Ding [Tue, 19 Nov 2019 03:43:24 +0000 (19:43 -0800)]
Remove compiler_builtins_lib feature from libstd

4 years agoAvoid ICE when `break`ing to an unreachable label
Esteban Küber [Tue, 19 Nov 2019 02:31:31 +0000 (18:31 -0800)]
Avoid ICE when `break`ing to an unreachable label

4 years agoAuto merge of #65821 - SimonSapin:in-place, r=Amanieu
bors [Tue, 19 Nov 2019 01:16:07 +0000 (01:16 +0000)]
Auto merge of #65821 - SimonSapin:in-place, r=Amanieu

Use `drop_in_place` in `array::IntoIter::drop`

This skips the loop when the element type is known not to have drop glue, even in debug mode.

4 years agoAdd error code documentation
Esteban Küber [Mon, 18 Nov 2019 20:34:22 +0000 (12:34 -0800)]
Add error code documentation

4 years agoGenerate DWARF address ranges for faster lookups
Josh Stone [Mon, 18 Nov 2019 23:05:01 +0000 (15:05 -0800)]
Generate DWARF address ranges for faster lookups

This adds a new option `-Zgenerate-arange-section`, enabled by default,
corresponding to LLVM's `-generate-arange-section`. This creates a
`.debug_aranges` section with DWARF address ranges, which some tools
depend on to optimize address lookups (elfutils [22288], [25173]).

This only has effect when debuginfo is enabled, and the additional data
is small compared to the other debug sections. For example, libstd.so
with full debuginfo is about 11MB, with just 61kB in aranges.

[22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288
[25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173

Closes #45246.

4 years agoMove E0594 to new error code system
Guillaume Gomez [Mon, 18 Nov 2019 18:03:20 +0000 (19:03 +0100)]
Move E0594 to new error code system

4 years agotest: Update tests with fallout of changes
Gabriel Smith [Mon, 18 Nov 2019 19:57:46 +0000 (14:57 -0500)]
test: Update tests with fallout of changes

The error messages of the two tests effected degraded in quality. The
errors no longer suggest types in other modules as they now assume that
the arguments are const args, not type args.

4 years agotest: const-generics: Update tests removing unrequired braces
Gabriel Smith [Mon, 18 Nov 2019 19:57:23 +0000 (14:57 -0500)]
test: const-generics: Update tests removing unrequired braces

Braces were left in cases where generic args were in the generic const
paths.

4 years agorustc: lowering: Lower type args as const args when resolved in value
Gabriel Smith [Mon, 18 Nov 2019 19:30:01 +0000 (14:30 -0500)]
rustc: lowering: Lower type args as const args when resolved in value
namespace

4 years agoAuto merge of #58281 - mark-i-m:synthesis, r=estebank
bors [Mon, 18 Nov 2019 22:08:31 +0000 (22:08 +0000)]
Auto merge of #58281 - mark-i-m:synthesis, r=estebank

Add outlives suggestions for some lifetime errors

This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound:

- If a and b are normal named regions, suggest to add the bound `'a: 'b`
- If b is static, suggest to replace a with static
- If b also needs to outlive a, they must be the same, so suggest unifying  them

We start with a simpler implementation that avoids diagnostic regression or implementation complexity:
- We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions)
- For now, we only emit a help note, not an actually suggestion because it is significantly easier.

Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name.

For more info, see this internals thread:

https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3

TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above.

r? @estebank

TODO
- [x] Clean up code
- [x] Only make idiomatic suggestions
     - [x] don't suggest naming `&'a self`
     - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static`
     - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa
- [x] Performance (maybe need a perf run when this is closer to the finish line?)
     - perf run was clean...
     - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress?
- [x] Needs ui tests
- [x] Integrate the `help` message into the main lifetime `error`

4 years agoresolve: late: Check if type arg is really a const arg
Gabriel Smith [Mon, 18 Nov 2019 19:24:13 +0000 (14:24 -0500)]
resolve: late: Check if type arg is really a const arg

A path type argument could be a generic const argument due to
limitations as to what we can determine at parsing. We double check just
to be sure by trying to resolve in the type namespace first, and if that
fails we try again in the value namespace. If resolution in the value
namespace succeeds, we have a generic const argument on our hands.

4 years agorustc: hir: Add method to check validity of a Res/Def in a namespace
Gabriel Smith [Mon, 18 Nov 2019 19:22:49 +0000 (14:22 -0500)]
rustc: hir: Add method to check validity of a Res/Def in a namespace

4 years agoresolve: Allow idents to resolve to primitives in the type namespace
Gabriel Smith [Mon, 18 Nov 2019 19:22:00 +0000 (14:22 -0500)]
resolve: Allow idents to resolve to primitives in the type namespace

4 years agoresolve: Give derive helpers highest priority during resolution
Vadim Petrochenkov [Mon, 18 Nov 2019 20:22:58 +0000 (23:22 +0300)]
resolve: Give derive helpers highest priority during resolution

4 years agoReword help and add test
Esteban Küber [Mon, 18 Nov 2019 20:08:03 +0000 (12:08 -0800)]
Reword help and add test

4 years agoAdd more context to `async fn` trait error. Suggest `async-trait`.
Agustin Fernandez [Tue, 29 Oct 2019 15:48:14 +0000 (11:48 -0400)]
Add more context to `async fn` trait error. Suggest `async-trait`.

4 years agoreview comments
Esteban Küber [Sun, 17 Nov 2019 19:27:48 +0000 (11:27 -0800)]
review comments

4 years agoAuto merge of #54733 - GuillaumeGomez:stabilize-rustdoc-theme, r=ollie27,Dylan-DPC
bors [Mon, 18 Nov 2019 19:03:21 +0000 (19:03 +0000)]
Auto merge of #54733 - GuillaumeGomez:stabilize-rustdoc-theme, r=ollie27,Dylan-DPC

Stabilize rustdoc theme options

Closes #54730

This PR stabilizes the `--themes` (now `--theme`) and `--theme-checker` (now `--check-theme`) options, for allowing users to add custom themes to their documentation.

Rustdoc includes two themes by default: `light` and `dark`. Using the `--theme` option, you can give rustdoc a CSS file to include as an extra theme for that render. Themes are named after the CSS file used, so using `--theme /path/to/your/custom-theme.css` will add a theme called `custom-theme` to the documentation.

Even though the CLI flag to add a theme is getting stabilized, there's no guarantee that a theme file will always have the same effect on documentation generated with future versions of rustdoc. To aid in ensuring that a theme will work, the flag `--check-theme` is also available, which compares the CSS rules defined by a custom theme against the ones used in the `light` theme. If the `light` theme defines a CSS rule that the custom theme does not, rustdoc will report an error. (Rustdoc also performs this check for themes given to `--theme`, but only reports a warning when a difference is found.)

4 years agoUpdate test output
Aaron Hill [Fri, 15 Nov 2019 21:50:57 +0000 (16:50 -0500)]
Update test output

4 years agoReplace bool with new `FallbackMode` enum
Aaron Hill [Fri, 15 Nov 2019 21:24:51 +0000 (16:24 -0500)]
Replace bool with new `FallbackMode` enum

4 years agoAdd explanation of unconstrained opaque type
Aaron Hill [Fri, 15 Nov 2019 15:47:47 +0000 (10:47 -0500)]
Add explanation of unconstrained opaque type

4 years agoFix 'type annotations needed' error with opaque types
Aaron Hill [Fri, 15 Nov 2019 01:19:34 +0000 (20:19 -0500)]
Fix 'type annotations needed' error with opaque types

Related: #66426

This commit adds handling for opaque types during inference variable
fallback. Type variables generated from the instantiatino of opaque
types now fallback to the opque type itself.

Normally, the type variable for an instantiated opaque type is either
unified with the concrete type, or with the opaque type itself (e.g when
a function returns an opaque type by calling another function).

However, it's possible for the type variable to be left completely
unconstrained. This can occur in code like this:

```rust
pub type Foo = impl Copy;
fn produce() -> Option<Foo> {
    None
}
```

Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type
variable, but we will never unify it with anything due to the fact
that we return a `None`.

This results in the error message:

`type annotations needed: cannot resolve `_: std::marker::Copy``

pointing at `pub type Foo = impl Copy`.

This message is not only confusing, it's incorrect. When an opaque type
inference variable is completely unconstrained, we can always fall back
to using the opaque type itself. This effectively turns that particular
use of the opaque type into a non-defining use, even if it appears in a
defining scope.

4 years agoUpdate ui tests
Guillaume Gomez [Wed, 6 Nov 2019 12:58:44 +0000 (13:58 +0100)]
Update ui tests

4 years agoAdd long error explanation for E0594
Guillaume Gomez [Wed, 6 Nov 2019 12:58:38 +0000 (13:58 +0100)]
Add long error explanation for E0594

4 years agoMove `trait_ref_to_existential` to a closure
Esteban Küber [Sun, 17 Nov 2019 22:57:06 +0000 (14:57 -0800)]
Move `trait_ref_to_existential` to a closure

review comment

4 years agoFix Makefile themes check
Guillaume Gomez [Mon, 18 Nov 2019 17:53:45 +0000 (18:53 +0100)]
Fix Makefile themes check

4 years agoRemove redundant html check
Guillaume Gomez [Mon, 18 Nov 2019 15:49:44 +0000 (16:49 +0100)]
Remove redundant html check

4 years agoTweak diagnostics code
Nadrieril [Mon, 18 Nov 2019 15:47:51 +0000 (15:47 +0000)]
Tweak diagnostics code

4 years agoimprove error messages and documentation
Guillaume Gomez [Thu, 17 Oct 2019 12:26:21 +0000 (14:26 +0200)]
improve error messages and documentation

4 years agoremove -Z option from rustdoc theme checker tool
Guillaume Gomez [Sat, 12 Oct 2019 09:53:02 +0000 (11:53 +0200)]
remove -Z option from rustdoc theme checker tool

4 years agoApply review comments
Guillaume Gomez [Thu, 10 Oct 2019 10:09:01 +0000 (12:09 +0200)]
Apply review comments

4 years agoRename rustdoc options --themes and --check-themes to --theme and --check-theme
Guillaume Gomez [Sun, 22 Sep 2019 20:35:25 +0000 (22:35 +0200)]
Rename rustdoc options --themes and --check-themes to --theme and --check-theme

4 years agoremove unstable docs
Guillaume Gomez [Sat, 14 Sep 2019 15:43:19 +0000 (17:43 +0200)]
remove unstable docs

4 years agorename check-theme option into check-themes
Guillaume Gomez [Sat, 14 Sep 2019 15:43:10 +0000 (17:43 +0200)]
rename check-theme option into check-themes

4 years agoImprove documentation, add checks for themes option arguments, make sure the themes...
Guillaume Gomez [Wed, 21 Aug 2019 13:48:26 +0000 (15:48 +0200)]
Improve documentation, add checks for themes option arguments, make sure the themes file names are js compatible

4 years agoFix typos
Guillaume Gomez [Fri, 26 Jul 2019 08:15:23 +0000 (10:15 +0200)]
Fix typos

Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
4 years agoRename theme-checker option to check-theme
Guillaume Gomez [Sun, 30 Jun 2019 17:24:32 +0000 (19:24 +0200)]
Rename theme-checker option to check-theme

4 years agoAdd sentence to tell other options are ignored when running check-theme
Guillaume Gomez [Sun, 30 Jun 2019 17:23:45 +0000 (19:23 +0200)]
Add sentence to tell other options are ignored when running check-theme

4 years agoPrevent invalid html characters in themes name
Guillaume Gomez [Sun, 30 Jun 2019 17:09:58 +0000 (19:09 +0200)]
Prevent invalid html characters in themes name

4 years agoadd test for rustdoc's --themes flag
QuietMisdreavus [Fri, 24 May 2019 19:04:45 +0000 (14:04 -0500)]
add test for rustdoc's --themes flag

4 years agoApply review comments
Guillaume Gomez [Fri, 24 May 2019 08:39:49 +0000 (10:39 +0200)]
Apply review comments

4 years agoWarn instead of failing for themes
Guillaume Gomez [Thu, 23 May 2019 11:45:30 +0000 (13:45 +0200)]
Warn instead of failing for themes

4 years agoAdd documentation for stabilized flags
Guillaume Gomez [Thu, 23 May 2019 11:45:08 +0000 (13:45 +0200)]
Add documentation for stabilized flags

4 years agoStabilize rustdoc theme options
Guillaume Gomez [Mon, 1 Oct 2018 20:28:12 +0000 (22:28 +0200)]
Stabilize rustdoc theme options

4 years agoUpdate src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs
Nadrieril Feneanar [Mon, 18 Nov 2019 15:40:49 +0000 (15:40 +0000)]
Update src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoUse `drop_in_place` in `array::IntoIter::drop`
Simon Sapin [Fri, 25 Oct 2019 16:11:20 +0000 (18:11 +0200)]
Use `drop_in_place` in `array::IntoIter::drop`

This skips the loop when the element type is known not to have drop glue, even in debug mode.

4 years agoFix selected crate search filter
Guillaume Gomez [Mon, 18 Nov 2019 13:11:21 +0000 (14:11 +0100)]
Fix selected crate search filter