102545 Commits

Author SHA1 Message Date
leo60228
c6bcea965d Test std::env::args in a staticlib on glibc Linux 2019-11-22 12:27:07 -05:00
leo60228
d448ab0cf1 Make std::sys::unix::args::init a no-op on glibc Linux 2019-11-22 12:27:07 -05:00
leo60228
55fe6d8d58 Add documentation to std::env::args[_os] 2019-11-22 12:27:07 -05:00
leo60228
e282b2227f Document ARGV_INIT_ARRAY 2019-11-22 12:27:07 -05:00
leo60228
1ff055d875 Set .init_array priority
I'm not entirely sure *why*, but this fixed a problem I was having.
2019-11-22 12:27:07 -05:00
leo60228
d8b6be9b1f Use .init_array section on glibc 2019-11-22 12:27:07 -05:00
bors
9d6ff1553b 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
2019-11-19 12:11:09 +00:00
Mazdak Farrokhzad
e1a32faf88
Rollup merge of #66538 - dingelish:master, r=Centril
Remove compiler_builtins_lib feature from libstd

Test if we can close #66368 by this patch.
2019-11-19 13:10:26 +01:00
Mazdak Farrokhzad
0ddd298a45
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
2019-11-19 13:10:24 +01:00
Mazdak Farrokhzad
1f0f0adbf4
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
2019-11-19 13:10:23 +01:00
Mazdak Farrokhzad
42e3b86045
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
2019-11-19 13:10:22 +01:00
Mazdak Farrokhzad
e99e5fb67d
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
2019-11-19 13:10:20 +01:00
Mazdak Farrokhzad
b5166b1e85
Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomez
Add explanation message for E0641

Part of #61137
2019-11-19 13:10:19 +01:00
Mazdak Farrokhzad
ee535a0f95
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.
2019-11-19 13:10:17 +01:00
Mazdak Farrokhzad
95b9766e0a
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
2019-11-19 13:10:15 +01:00
Mazdak Farrokhzad
0b0d683805
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.
2019-11-19 13:10:14 +01:00
Mazdak Farrokhzad
40deec82bc
Rollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPC
Add long error explanation for E0594

Part of #61137.

r? @Dylan-DPC
2019-11-19 13:10:12 +01:00
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
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
Guillaume Gomez
c981c994d4 Move E0594 to new error code system 2019-11-18 23:38:25 +01: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
Vadim Petrochenkov
f74fe812fe resolve: Give derive helpers highest priority during resolution 2019-11-19 00:50:53 +03: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
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
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