Commit graph

88818 commits

Author SHA1 Message Date
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
Mazdak Farrokhzad
d27224e0d8
Rollup merge of #57736 - phansch:remove_delay, r=oli-obk
Remove delay_span_bug from qualify_min_const_fn

This is causing issues with a new Clippy lint that will be able to
detect possible const functions.

As per https://github.com/rust-lang/rust-clippy/pull/3648#discussion_r247927450

r? @oli-obk
2019-01-19 19:41:24 +01:00
Mazdak Farrokhzad
5b9e02a39c
Rollup merge of #57723 - estebank:fix, r=davidtwco
Point at cause for expectation in return type type error

Various improvements and fixes for type errors in return expressions.

Fix #57664.
2019-01-19 19:41:22 +01:00
Mazdak Farrokhzad
3bc61cd13c
Rollup merge of #57689 - nnethercote:redo-hir-Stmt, r=petrochenkov
Redo `hir::Stmt`

A couple of changes that make things simpler and more consistent.

This should probably wait until after 1.32 lands to land, to avoid late breakage for tools.
2019-01-19 19:41:21 +01:00
Mazdak Farrokhzad
286ce3c36a
Rollup merge of #57452 - steveklabnik:improve-formatter-docs, r=frewsxcv
Improve docs for Formatter

Some improvements to `std::fmt::Formatter` to make it a bit more consistent with other documentation, as well as calling out that you don't ever instantiate one yourself.
2019-01-19 19:41:20 +01:00
bors
52fec814db Auto merge of #57721 - ehuss:update-cargo, r=alexcrichton
Update cargo

Unblocks #56884  cc @euclio

6 commits in 2b4a5f1f0bb6e13759e88ea9512527b0beba154f..ffe65875fd05018599ad07e7389e99050c7915be
2019-01-12 04:13:12 +0000 to 2019-01-17 23:57:50 +0000
- Better error message for bad manifest with `cargo install`. (rust-lang/cargo#6560)
- relax rustdoc output assertion (rust-lang/cargo#6559)
- touch some files when we use them (rust-lang/cargo#6477)
- Add documentation for new package/publish feature flags. (rust-lang/cargo#6553)
- Update chat link to Discord. (rust-lang/cargo#6554)
- Fix typo (rust-lang/cargo#6552)

r? @alexcrichton
2019-01-19 18:37:03 +00:00
bors
93234994b8 Auto merge of #57755 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #57486 (Simplify `TokenStream` some more)
 - #57502 (make trait-aliases work across crates)
 - #57598 (Add missing unpretty option help message)
 - #57649 (privacy: Account for associated existential types)
 - #57659 (Fix release manifest generation)
 - #57699 (add applicability to remaining suggestions)
 - #57719 (Tweak `expand_node`)

Failed merges:

r? @ghost
2019-01-19 15:52:58 +00:00
Mazdak Farrokhzad
92fecfbd60
Rollup merge of #57719 - nnethercote:expand_node-FIDDLING, r=nikomatsakis
Tweak `expand_node`

These commits speed up the `unicode_normalization` benchmark a little.
2019-01-19 14:21:24 +01:00
Mazdak Farrokhzad
e78bde4015
Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkov
add applicability to remaining suggestions

Fixes #50723.

I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages.

There's also a PR for clippy at rust-lang/rust-clippy#3667.
2019-01-19 14:21:23 +01:00
Mazdak Farrokhzad
c8c03afa57
Rollup merge of #57659 - jethrogb:jb/release-manifest, r=alexcrichton
Fix release manifest generation

r? @alexcrichton
2019-01-19 14:21:22 +01:00
Mazdak Farrokhzad
4eeb095437
Rollup merge of #57649 - petrochenkov:privexist, r=arielb1
privacy: Account for associated existential types

Turns out they *can* be associated (but only in impls, not traits).
Fixes https://github.com/rust-lang/rust/issues/53546#issuecomment-454372879

r? @arielb1
2019-01-19 14:21:21 +01:00
Mazdak Farrokhzad
bce56888e9
Rollup merge of #57598 - h-michael:unpretty-help, r=oli-obk
Add missing unpretty option help message

There are some missing help messages that is printed `ructc -Zunpretty help` and receiving invalid option.

related with #16419, #45721, #21085, #31916
2019-01-19 14:21:19 +01:00
Mazdak Farrokhzad
5272be5b5e
Rollup merge of #57502 - nikomatsakis:fix-trait-alias-1b, r=nikomatsakis
make trait-aliases work across crates

This is rebase of a small part of @alexreg's PR #55994. It focuses just on the changes that integrate trait aliases properly into crate metadata, excluding the stylistic edits and the trait objects.

The stylistic edits I also rebased and can open a separate PR.

The trait object stuff I found challenging and decided it basically needed to be reimplemented. For now I've excluded it.

Since this is really @alexreg's work (I really just rebased) I am going to make it r=me once it is working.

Fixes #56488.
Fixes #57023.
2019-01-19 14:21:18 +01:00
Mazdak Farrokhzad
349c9eeb35
Rollup merge of #57486 - nnethercote:simplify-TokenStream-more, r=petrochenkov
Simplify `TokenStream` some more

These commits simplify `TokenStream`, remove `ThinTokenStream`, and avoid some clones. The end result is simpler code and a slight perf win on some benchmarks.

r? @petrochenkov
2019-01-19 14:21:17 +01:00
bors
286ac62939 Auto merge of #57370 - petrhosek:llvm-flags, r=alexcrichton
Support passing cflags/cxxflags/ldflags to LLVM build

This may be needed with some host compilers.
2019-01-19 13:11:53 +00:00
bors
c87144f3ca Auto merge of #57752 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #57268 (Add a target option "merge-functions", and a corresponding -Z flag (works around #57356))
 - #57476 (Move glob map use to query and get rid of CrateAnalysis)
 - #57501 (High priority resolutions for associated variants)
 - #57573 (Querify `entry_fn`)
 - #57610 (Fix nested `?` matchers)
 - #57634 (Remove an unused function argument)
 - #57653 (Make the contribution doc reference the guide more)
 - #57666 (Generalize `huge-enum.rs` test and expected stderr for more cross platform cases)
 - #57698 (Fix typo bug in DepGraph::try_mark_green().)
 - #57746 (Update README.md)

Failed merges:

r? @ghost
2019-01-19 10:27:59 +00:00
Alexis Hunt
c7d25a2a40 Make str indexing generic on SliceIndex. 2019-01-19 04:16:05 -05:00
Mazdak Farrokhzad
f7b9084e6e
Rollup merge of #57746 - mark-i-m:patch-2, r=Centril
Update README.md

Point contributors to the rustc-guide...

r? @steveklabnik
2019-01-19 09:03:34 +01:00
Mazdak Farrokhzad
c7686b787f
Rollup merge of #57698 - michaelwoerister:issue57692, r=Zoxc
Fix typo bug in DepGraph::try_mark_green().

r? @Zoxc

Fixes #57692.
2019-01-19 09:03:33 +01:00
Mazdak Farrokhzad
83921c31b8
Rollup merge of #57666 - pnkfelix:generalize-huge-enum-test-to-work-cross-platform, r=nikomatsakis
Generalize `huge-enum.rs` test and expected stderr for more cross platform cases

With this change, I am able to build and test cross-platform `rustc`

In particular, I can use the following in my `config.toml`:

```
[build]
host = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"]
target = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"]
```

Before this change, my attempt to run the test suite would fail
because the error output differs depending on what your host and
targets are.

----

To be concrete, here are the actual messages one can observe:

```
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=x86_64-unknown-linux-gnu
error: the type `std::option::Option<[u32; 35184372088831]>` is too big for the current architecture

error: aborting due to previous error

% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=i686-unknown-linux-gnu
error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture

error: aborting due to previous error

% ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=i686-unknown-linux-gnu
error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture

error: aborting due to previous error

% ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused  --target=x86_64-unknown-linux-gnu
error: the type `[u32; 35184372088831]` is too big for the current architecture

error: aborting due to previous error
```

To address these variations, I changed the test to be more aggressive
in its normalization strategy. We cannot (and IMO should not)
guarantee that `Option` will appear in the error output here. So I
normalized both types `Option<[u32; N]>` and `[u32; N]` to just `TYPE`
2019-01-19 09:03:32 +01:00
Mazdak Farrokhzad
36a34e3dda
Rollup merge of #57653 - mark-i-m:contrib-doc, r=nikomatsakis
Make the contribution doc reference the guide more

and also remove a lot of redundant info already in the guide
2019-01-19 09:03:31 +01:00