Commit Graph

102742 Commits

Author SHA1 Message Date
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
Esteban Küber
b3517cdee7 review comments 2019-11-18 11:03:04 -08:00
Esteban Küber
6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber
b2e6aef073 review comments: tweak prefix strings 2019-11-18 11:02:44 -08:00
Esteban Küber
83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08: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
Guillaume Gomez
00ef5c1b98 Fix selected crate search filter 2019-11-18 14:15:00 +01:00
bors
a0d40f8bdf Auto merge of #66459 - eddyb:update-llvm-wasm-dwarf, r=alexcrichton
Update src/llvm-project to include rust-lang/llvm-project#27.

See https://github.com/rust-lang/llvm-project/pull/27, which works around https://github.com/rust-lang/llvm-project/pull/20#discussion_r344425408 (where I stumbled over some UB in DWARF emission for WASM, resulting in non-deterministic output).

r? @alexcrichton cc @yurydelendik
2019-11-18 09:14:12 +00:00
Harald Hoyer
de122e673a
std::error::Chain: remove Copy
remove Copy from Iterator as per comment
https://github.com/rust-lang/rust/issues/58520#issuecomment-553682166
2019-11-18 09:01:34 +01:00
Camille GILLOT
a65091ffff Rename generated lifetime. 2019-11-18 08:41:28 +01:00
Camille GILLOT
35cba9eb0b Retire EnumLiftImpl. 2019-11-18 08:41:28 +01:00
Camille GILLOT
033d1df19b Retire BraceStructLiftImpl. 2019-11-18 08:41:28 +01:00
Camille GILLOT
2add2075de Create derive proc-macro for Lift trait. 2019-11-18 08:41:28 +01:00
bors
9966af3897 Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton
Make a test compatible across python versions.

Progress on #65063

This PR allows this test to work on both python2 and python3, ~~and it also allows `./x.py test` to fully complete on my system without python2 installed at all.~~
2019-11-18 06:09:04 +00:00
bors
d67ca28354 Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez
rustdoc: Stabilize `edition` annotation.

The rustdoc `edition` annotation is currently ignored on stable. This means that the tests will be ignored, unless there is a `rust` annotation, then it will use the global edition. I suspect this was just an oversight during the edition stabilization, but I don't know. Example:

```rust
/// ```edition2018
/// // This code block was ignored on stable.
/// ```

/// ```rust,edition2018
/// // This code block would use whatever edition is passed on the command line.
/// ```
```

AFAIK, it is not possible to write a test that verifies stable behavior, as all tests appear to set RUSTC_BOOTSTRAP which forces all tests to run as "nightly", even on a stable release.

Closes #65980
2019-11-18 03:06:42 +00:00
bors
361791bb5f Auto merge of #65456 - estebank:trait-bound-borrow, r=matthewjasper
Suggest borrowing when it would satisfy an unmet trait bound

When there are multiple implementors for the same trait that is present
in an unmet binding, modify the E0277 error to refer to the parent
obligation and verify whether borrowing the argument being passed in
would satisfy the unmet bound. If it would, suggest it.

Fix #56368.
2019-11-18 00:05:38 +00:00
Esteban Küber
8d1c2612f8 review comments 2019-11-17 14:40:41 -08:00
Esteban Küber
578bc438b0 Do not ICE on trait aliases with missing obligations 2019-11-17 14:40:41 -08:00