Commit Graph

88788 Commits

Author SHA1 Message Date
Oliver Scherer
aedc3a51df Declare some unconst operations as unsafe in const fn 2019-01-21 16:01:57 +01:00
bors
7164a9f151 Auto merge of #55045 - kleimkuhler:add-std-is_sorted, r=KodrAus
Add `is_sorted` to `Iterator` and `[T]`

This is an initial implementation for the first step of [RFC 2351](https://github.com/rust-lang/rfcs/blob/master/text/2351-is-sorted.md)

Tracking issue: https://github.com/rust-lang/rust/issues/53485
2019-01-21 13:55:45 +00:00
bors
0974bdc7e8 Auto merge of #57756 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
submodules: update clippy from 1b89724b to e648adf0

Fixes clippy toolstate

Changes:
````
Catch up with `format_args` change
Fix bad `while_let_on_iterator` suggestion.
rustup https://github.com/rust-lang/rust/pull/57747
Fixing issues pointed out by dogfood tests.
Update to collect all the files then throw the error.
Adding a test for checking if test files are missing.
Remove bors.toml
add applicability to lint name suggestion
````

r? @oli-obk
2019-01-21 11:07:29 +00:00
Oliver Scherer
64afc6b517 Differentiate between closure and function bodies 2019-01-21 10:12:17 +01:00
bors
33b0b7148f Auto merge of #57792 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #56796 (Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`)
 - #57768 (Continue parsing after parent type args and suggest using angle brackets)
 - #57769 (Suggest correct cast for struct fields with shorthand syntax)
 - #57783 (Add "dereference boxed value" suggestion.)
 - #57784 (Add span for bad doc comment)

Failed merges:

r? @ghost
2019-01-21 08:32:19 +00:00
Esteban Küber
45a95b512c Use structured suggestion in stead of notes 2019-01-20 21:41:25 -08:00
bors
b5f5a2715e Auto merge of #57708 - nbigaouette:pr-53774-fix-missing-rust-gdbui-install, r=Mark-Simulacrum
Install missing 'rust-gdbui''

PR #53774 added `rust-gdbui` as wrapper to launch [gdbui](https://gdbgui.com/), similar to `rust-gdb`.

Unfortunately I've never seen the script in my local installation (from rustup, using rust 1.31.1). @tromey on the PR [suggested it might be missing](https://github.com/rust-lang/rust/pull/53774#issuecomment-419704939) from the installation process.

This PR simply adds a line for `rust-gdbui` too.
2019-01-21 03:12:26 +00:00
Esteban Küber
e33f7f7de1 Explain type mismatch cause pointing to return type when it is impl Trait 2019-01-20 18:42:10 -08:00
Matthias Krüger
8c4a7a9701 submodules: update clippy from 1b89724b to 1838bfe5
Changes:
````
Fixing typo in CONTRIBUTING.md
Fix breakage due to rust-lang/rust#57651
Run rustfmt
Fixed breakage due to rust-lang/rust#57489
Fix breakage due to rust-lang/rust#57755
Catch up with `format_args` change
Fix bad `while_let_on_iterator` suggestion.
rustup https://github.com/rust-lang/rust/pull/57747
Fixing issues pointed out by dogfood tests.
Update to collect all the files then throw the error.
Adding a test for checking if test files are missing.
Remove bors.toml
add applicability to lint name suggestion
````
2019-01-21 02:58:57 +01:00
Mazdak Farrokhzad
00c60d115c
Rollup merge of #57784 - JohnTitor:improve-error-message, r=estebank
Add span for bad doc comment

Fixes #57382

r? @estebank
2019-01-21 02:21:58 +01:00
Mazdak Farrokhzad
74b8cd4957
Rollup merge of #57783 - davidtwco:issue-57741, r=estebank
Add "dereference boxed value" suggestion.

Contributes to #57741.

This PR adds a `help: consider dereferencing the boxed value` suggestion to discriminants of match statements when the match arms have type `T` and the discriminant has type `Box<T>`.

r? @estebank
2019-01-21 02:21:57 +01:00
Mazdak Farrokhzad
3bb9fc4007
Rollup merge of #57769 - estebank:cast-suggestion-struct-field, r=matthewjasper
Suggest correct cast for struct fields with shorthand syntax

```
error[E0308]: mismatched types
  --> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
   |
LL |     let _ = RGB { r, g, b };
   |                   ^ expected f64, found f32
help: you can cast an `f32` to `f64` in a lossless way
   |
LL |     let _ = RGB { r: r.into(), g, b };
   |                   ^^^^^^^^^^^
```

Fix #52497.
2019-01-21 02:21:56 +01:00
Mazdak Farrokhzad
627e001a72
Rollup merge of #57768 - estebank:type-args-sugg, r=zackmdavis
Continue parsing after parent type args and suggest using angle brackets

```
error[E0214]: parenthesized parameters may only be used with a trait
--> $DIR/E0214.rs:2:15
   |
LL |     let v: Vec(&str) = vec!["foo"];
   |               ^^^^^^
   |               |
   |               only traits may use parentheses
   |               help: use angle brackets instead: `<&str>`
```

r? @zackmdavis
2019-01-21 02:21:55 +01:00
Mazdak Farrokhzad
ebc70e2e9e
Rollup merge of #56796 - KrishnaSannasi:try_from_impl_change, r=shepmaster
Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`

This is from this [comment](https://github.com/rust-lang/rust/issues/33417#issuecomment-447111156) I made.

This will expand the impls available for `TryFrom` and `TryInto`, without losing anything in the process.
2019-01-21 02:21:53 +01:00
Esteban Küber
3ecbe1efa0 Add regression test for #54582 2019-01-20 17:14:15 -08:00
bors
7bac68a5d3 Auto merge of #57789 - ehuss:update-cargo, r=Mark-Simulacrum
Update cargo

Pull in fix for #57774.

6 commits in ffe65875fd05018599ad07e7389e99050c7915be..907c0febe7045fa02dff2a35c5e36d3bd59ea50d
2019-01-17 23:57:50 +0000 to 2019-01-20 22:31:07 +0000
- Put mtime-on-use behind a feature flag. (rust-lang/cargo#6573)
- Fix a typo in the unstable docs (rust-lang/cargo#6569)
- Perhaps you meant: foo, bar or foobar (rust-lang/cargo#6550)
- Refactor: Create uninstall submodule (rust-lang/cargo#6557)
- Fix spurious Windows errors with switch_features_rerun. (rust-lang/cargo#6561)
- Stop building on master on Travis. (rust-lang/cargo#6562)

r? @Mark-Simulacrum
2019-01-21 00:29:31 +00:00
Eric Huss
c949d8ee69 Update cargo 2019-01-20 15:31:43 -08:00
Esteban Küber
defa61f3fb Tweak field parse error recovery 2019-01-20 15:16:36 -08:00
Esteban Küber
15bad8bbfd Extend incorrect float literal recovery to account for suffixes 2019-01-20 14:25:53 -08:00
Esteban Küber
e387597a8f Reword message for incorrect float literal 2019-01-20 13:59:35 -08:00
Esteban Küber
8f4da0e7ee Use is_dummy instead of comparing against DUMMY_SP 2019-01-20 13:53:13 -08:00
bors
e73069767f Auto merge of #57704 - lenoil98:patch-2, r=alexcrichton
Update bootstrap.py

Add PowerPC64 support on FreeBSD
2019-01-20 21:49:24 +00:00
Esteban Küber
c4b8df5df2 Remove unnecessary dummy span checks
The emitter already verifies wether a given span note or span label
can be emitted to the output. If it can't, because it is a dummy
span, it will be either elided for labels or emitted as an unspanned
note/help when applicable.
2019-01-20 13:29:03 -08:00
David Wood
f13fe5f3f7
Add "dereference boxed value" suggestion.
This commit adds a `help: consider dereferencing the boxed value`
suggestion to discriminants of match statements when the match arms have
type `T` and the discriminant has type `Box<T>`.
2019-01-20 22:26:37 +01:00
Guillaume Gomez
b5d167f58a Add default favicon for documentation 2019-01-20 21:47:43 +01:00
Yuki Okushi
b97c9641f5 Fix tests 2019-01-21 04:52:30 +09:00
Yuki Okushi
ce0e5558da Add span for bad doc comment 2019-01-21 04:52:16 +09:00
bors
846ea58cd5 Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavus
rustdoc: overhaul code block lexing errors

Fixes #53919.

This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level.

Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future.

Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly.

Of note:
- The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is.
- `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review.
- This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.
2019-01-20 19:01:38 +00:00
Björn Steinbrink
98d4f33626 const_eval: Predetermine the layout of all locals when pushing a stack frame
Usually the layout of any locals is required at least three times, once
when it becomes live, once when it is written to, and once it is read
from. By adding a cache for them, we can reduce the number of layout
queries speeding up code that is heavy on const_eval.
2019-01-20 19:08:14 +01:00
Guillaume Gomez
2200fd3c7c Add default rust logo for documentation 2019-01-20 18:53:56 +01:00
Esteban Küber
5b44b3cb1b review comment 2019-01-20 09:11:42 -08:00
bors
794e22862c Auto merge of #57697 - dotdash:fast_lex_reg_resol_item_bodies, r=nagisa
Use a faster early exit during region expansion

Turns out that the equality check for regions is rather expensive, and
the current early exit check works in such a way, that the comparison is
even done twice. As we only really care about the case of equal scopes,
we can perform a faster, more specialized check and move it up one
level, so we can eventually skip the additional full comparison as well.
2019-01-20 16:24:27 +00:00
bors
4db2394156 Auto merge of #57680 - cuviper:codegen-rebuild, r=Mark-Simulacrum
[rustbuild] Rebuild std after changes to codegen backends

Use `clear_if_dirty` on std for backend changes, just as we do for
changes to rustc itself, so new codegen is correctly applied to all
later compiler stages.

Fixes #48298.
2019-01-20 13:46:03 +00:00
bors
d38d6be336 Auto merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton
OSX: fix #57534 registering thread dtors while running thread dtors

r? @alexcrichton

- "fast" `thread_local` destructors get run even on the main thread
- "fast" `thread_local` dtors, can initialize other `thread_local`'s

One corner case where this fix doesn't work, is when a C++ `thread_local` triggers the initialization of a rust `thread_local`.

I did not add any std::thread specific flag to indicate that the thread is currently exiting, which would be checked before registering a new dtor (I didn't really know where to stick that). I think this does the trick tho!

Let me know if anything needs tweaking/fixing/etc.

resolves this for macos: https://github.com/rust-lang/rust/issues/28129
fixes: https://github.com/rust-lang/rust/issues/57534
2019-01-20 11:08:37 +00:00
Esteban Küber
2ab6cefccf Do not suggest angle brackets when there are no type arguments 2019-01-20 02:47:51 -08:00
Esteban Küber
acbda76f23 Recover with suggestion from writing .42 instead of 0.42 2019-01-20 01:49:04 -08:00
Esteban Küber
b1f169fe7a Recover from parse errors in struct literal fields
Attempt to recover from parse errors while parsing a struct's literal fields
by skipping tokens until a comma or the closing brace is found. This allows
errors in other fields to be reported.
2019-01-20 00:37:06 -08:00
bors
2ab5d8ac44 Auto merge of #57651 - JohnTitor:give-char-type, r=estebank
Implement new literal type `Err`

Fixes #57384

I removed `return Ok`, otherwise, two errors occur. Any solutions?

r? @estebank
2019-01-20 08:26:12 +00:00
Yuki Okushi
4005d3a8cb Remove whitespace 2019-01-20 14:59:10 +09:00
Yuki Okushi
7ce2514419 Fix tests 2019-01-20 14:53:28 +09:00
Yuki Okushi
6e59c64326 Revert change 2019-01-20 14:53:16 +09:00
Yuki Okushi
a4ff1dcc53 Mark incorrect recovered char literals as TyErr to avoid type errors 2019-01-20 14:51:54 +09:00
Esteban Küber
b36bf76dec Suggest correct cast for struct fields with shorthand syntax 2019-01-19 20:18:56 -08:00
bors
588f94b37d Auto merge of #57602 - alexcrichton:test-appveyor, r=alexcrichton
Remove GCE cloud setting from AppVeyor config

AppVeyor has informed us that this may no longer be necessary after some
infrastructure upgrades on their side, so let's see how this goes!
2019-01-20 04:16:42 +00:00
Esteban Küber
d37a6d83e1 Suggest usage of angle brackets 2019-01-19 19:39:58 -08:00
Esteban Küber
3235446b39 Accept parenthesized type args for error recovery 2019-01-19 19:27:49 -08:00
Esteban Küber
d38e70036e Continune parsing after encountering Trait with paren args 2019-01-19 18:44:26 -08:00
bors
0c0c585281 Auto merge of #57761 - Centril:rollup, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #57452 (Improve docs for Formatter)
 - #57689 (Redo `hir::Stmt`)
 - #57723 (Point at cause for expectation in return type type error)
 - #57736 (Remove delay_span_bug from qualify_min_const_fn)

Failed merges:

r? @ghost
2019-01-19 21:21:12 +00:00
Yuki Okushi
e9af312932 [WIP] Fix tests 2019-01-20 04:37:58 +09:00
Yuki Okushi
c502a79fa1 [WIP] Improve error behavior 2019-01-20 04:37:29 +09:00