102630 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
49077c59a8
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
2019-11-19 13:10:09 +01:00
bors
2cad8bb659 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.
2019-11-19 07:49:54 +00:00
Nicholas Nethercote
c84fae13e5 Move the definition of QueryResult into plumbing.rs.
Because it's the only file that uses it, and removes the need for
importing it.
2019-11-19 17:23:44 +11:00
bors
d1da8023da 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.
2019-11-19 04:38:47 +00:00
Yu Ding
f6b327baa6
Remove compiler_builtins_lib feature from libstd 2019-11-18 19:43:24 -08:00
Esteban Küber
31620fbdea Avoid ICE when breaking to an unreachable label 2019-11-18 18:33:57 -08:00
bors
5c5a120958 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.
2019-11-19 01:16:07 +00:00
Esteban Küber
e565329144 Add error code documentation 2019-11-18 15:23:05 -08:00
Josh Stone
a5d624d32c 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.
2019-11-18 15:05:01 -08:00
Guillaume Gomez
c981c994d4 Move E0594 to new error code system 2019-11-18 23:38:25 +01:00
Gabriel Smith
0207a15fa1 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.
2019-11-18 17:23:22 -05:00
Gabriel Smith
eaf8fd0569 test: const-generics: Update tests removing unrequired braces
Braces were left in cases where generic args were in the generic const
paths.
2019-11-18 17:23:22 -05:00
Gabriel Smith
fb6cfde5ba rustc: lowering: Lower type args as const args when resolved in value
namespace
2019-11-18 17:23:22 -05:00
bors
0ccee30773 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`
2019-11-18 22:08:31 +00:00
Gabriel Smith
7b4642f441 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.
2019-11-18 17:01:48 -05:00
Gabriel Smith
128ca7415f rustc: hir: Add method to check validity of a Res/Def in a namespace 2019-11-18 17:01:48 -05:00
Gabriel Smith
041a612dad resolve: Allow idents to resolve to primitives in the type namespace 2019-11-18 17:01:33 -05:00
Vadim Petrochenkov
f74fe812fe resolve: Give derive helpers highest priority during resolution 2019-11-19 00:50:53 +03:00
Esteban Küber
a7678779a1 Reword help and add test 2019-11-18 12:30:21 -08:00
Agustin Fernandez
aae76304f9 Add more context to async fn trait error. Suggest async-trait. 2019-11-18 12:08:15 -08:00
Esteban Küber
614da98454 review comments 2019-11-18 11:46:14 -08:00
bors
3e525e3f6d 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.)
2019-11-18 19:03:21 +00:00
Aaron Hill
a11abe0d6b
Update test output 2019-11-18 14:01:37 -05:00
Aaron Hill
f87177b1c5
Replace bool with new FallbackMode enum 2019-11-18 14:01:37 -05:00
Aaron Hill
61c75bdb11
Add explanation of unconstrained opaque type 2019-11-18 14:01:36 -05:00
Aaron Hill
0e2ccaaa3e
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.
2019-11-18 14:01:36 -05:00
Guillaume Gomez
cd13335ae2 Update ui tests 2019-11-18 19:00:10 +01:00
Guillaume Gomez
4610867c2b Add long error explanation for E0594 2019-11-18 19:00:10 +01:00
Esteban Küber
0ff73535ed Move trait_ref_to_existential to a closure
review comment
2019-11-18 09:55:54 -08:00
Guillaume Gomez
45b83c9164 Fix Makefile themes check 2019-11-18 18:53:45 +01:00
Guillaume Gomez
a9e8d4c0c5 Remove redundant html check 2019-11-18 16:49:44 +01:00
Nadrieril
1425ae1154 Tweak diagnostics code 2019-11-18 15:49:29 +00:00
Guillaume Gomez
71c7dace89 improve error messages and documentation 2019-11-18 16:43:48 +01:00
Guillaume Gomez
b004a50f73 remove -Z option from rustdoc theme checker tool 2019-11-18 16:43:48 +01:00
Guillaume Gomez
530d866aef Apply review comments 2019-11-18 16:43:48 +01:00
Guillaume Gomez
8f9014d98f Rename rustdoc options --themes and --check-themes to --theme and --check-theme 2019-11-18 16:43:48 +01:00
Guillaume Gomez
685b63a163 remove unstable docs 2019-11-18 16:43:48 +01:00
Guillaume Gomez
7cbf31aa04 rename check-theme option into check-themes 2019-11-18 16:43:48 +01:00
Guillaume Gomez
bbfd63c89a Improve documentation, add checks for themes option arguments, make sure the themes file names are js compatible 2019-11-18 16:43:48 +01:00
Guillaume Gomez
6f2d1f51eb Fix typos
Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
2019-11-18 16:43:48 +01:00
Guillaume Gomez
8f44c604d2 Rename theme-checker option to check-theme 2019-11-18 16:43:48 +01:00
Guillaume Gomez
82872addf1 Add sentence to tell other options are ignored when running check-theme 2019-11-18 16:43:48 +01:00
Guillaume Gomez
e365120243 Prevent invalid html characters in themes name 2019-11-18 16:43:48 +01:00
QuietMisdreavus
d350008c88 add test for rustdoc's --themes flag 2019-11-18 16:43:47 +01:00
Guillaume Gomez
f3e4279ccc Apply review comments 2019-11-18 16:43:47 +01:00
Guillaume Gomez
dcccd28e42 Warn instead of failing for themes 2019-11-18 16:43:47 +01:00
Guillaume Gomez
3eba28432f Add documentation for stabilized flags 2019-11-18 16:43:47 +01:00
Guillaume Gomez
add6204484 Stabilize rustdoc theme options 2019-11-18 16:43:47 +01:00
Nadrieril Feneanar
2079ae3a52
Update src/test/ui/pattern/issue-53820-slice-pattern-large-array.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-18 15:40:49 +00:00
Simon Sapin
74b571402f 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.
2019-11-18 15:56:26 +01:00