]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoApply suggestions from lzutao
Pietro Albini [Tue, 29 Oct 2019 09:14:42 +0000 (10:14 +0100)]
Apply suggestions from lzutao

Co-Authored-By: lzutao <taolzu@gmail.com>
4 years agoci: upload toolstates.json to rust-lang-ci2
Pietro Albini [Thu, 10 Oct 2019 15:32:50 +0000 (17:32 +0200)]
ci: upload toolstates.json to rust-lang-ci2

Uploading the toolstate data for each commit will help our release
tooling understand which components are failing, to possibly skip
shipping broken tools to users.

4 years agoci: extract uploading artifacts into a script
Pietro Albini [Thu, 10 Oct 2019 15:04:44 +0000 (17:04 +0200)]
ci: extract uploading artifacts into a script

4 years agoAuto merge of #65919 - Centril:rollup-qrgwnt6, r=Centril
bors [Tue, 29 Oct 2019 04:12:23 +0000 (04:12 +0000)]
Auto merge of #65919 - Centril:rollup-qrgwnt6, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #65294 (Lint ignored `#[inline]` on function prototypes)
 - #65318 (Call out the types that are non local on E0117)
 - #65531 (Update backtrace to 0.3.40)
 - #65562 (Improve the "try using a variant of the expected type" hint.)
 - #65809 (Add new EFIAPI ABI)

Failed merges:

r? @ghost

4 years agoRollup merge of #65809 - roblabla:eficall-abi, r=nagisa
Mazdak Farrokhzad [Tue, 29 Oct 2019 03:08:23 +0000 (04:08 +0100)]
Rollup merge of #65809 - roblabla:eficall-abi, r=nagisa

Add new EFIAPI ABI

Fixes #54527

Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI.

Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?

4 years agoRollup merge of #65562 - Patryk27:master, r=estebank
Mazdak Farrokhzad [Tue, 29 Oct 2019 03:08:21 +0000 (04:08 +0100)]
Rollup merge of #65562 - Patryk27:master, r=estebank

Improve the "try using a variant of the expected type" hint.

Fix https://github.com/rust-lang/rust/issues/65494.

- Change type-printing output.
- Use `span_to_snippet` when possible.
- Change the message to `try using a variant of the expected enum`

4 years agoRollup merge of #65531 - tmandry:bump-backtrace, r=cramertj
Mazdak Farrokhzad [Tue, 29 Oct 2019 03:08:20 +0000 (04:08 +0100)]
Rollup merge of #65531 - tmandry:bump-backtrace, r=cramertj

Update backtrace to 0.3.40

Diff: https://github.com/rust-lang/backtrace-rs/compare/0.3.37...b5cc5b12fa4fd03cb83546a7c62b9fff40086b63

Pretty low risk, considering the only changes are in low-tier targets.

r? @cramertj
cc @alexcrichton

4 years agoRollup merge of #65318 - estebank:coherence, r=varkor
Mazdak Farrokhzad [Tue, 29 Oct 2019 03:08:19 +0000 (04:08 +0100)]
Rollup merge of #65318 - estebank:coherence, r=varkor

Call out the types that are non local on E0117

CC #24745.

4 years agoRollup merge of #65294 - varkor:lint-inline-prototype, r=matthewjasper
Mazdak Farrokhzad [Tue, 29 Oct 2019 03:08:18 +0000 (04:08 +0100)]
Rollup merge of #65294 - varkor:lint-inline-prototype, r=matthewjasper

Lint ignored `#[inline]` on function prototypes

Fixes https://github.com/rust-lang/rust/issues/51280.

- Adds a `unused_attribute` lint for `#[inline]` on function prototypes.
- As a consequence, foreign items, impl items and trait items now have their attributes checked, which could cause some code to no longer compile (it was previously erroneously ignored).

4 years agoUpdate backtrace to 0.3.40
Tyler Mandry [Thu, 17 Oct 2019 22:58:48 +0000 (15:58 -0700)]
Update backtrace to 0.3.40

4 years agoAuto merge of #65907 - Centril:rollup-9i8ev23, r=Centril
bors [Mon, 28 Oct 2019 20:59:36 +0000 (20:59 +0000)]
Auto merge of #65907 - Centril:rollup-9i8ev23, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #65563 (Add long error explanation for E0587)
 - #65640 (Use heuristics to recover parsing of missing `;`)
 - #65643 (Correct handling of type flags with `ConstValue::Placeholder`)
 - #65825 (rustc: use IndexVec<DefIndex, T> instead of Vec<T>.)
 - #65858 (suggest `const_in_array_repeat_expression` flag)
 - #65877 (doc: introduce `once` in `iter::chain` document)
 - #65887 (doc: mention `get(_mut)` in Vec)
 - #65891 (self-profiling: Record something more useful for crate metadata generation event.)
 - #65893 (Output previous stable  error messaging when using stable build.)

Failed merges:

r? @ghost

4 years agoRollup merge of #65893 - jafern14:let-expr-stable-error-messaging, r=Centril
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:08 +0000 (21:36 +0100)]
Rollup merge of #65893 - jafern14:let-expr-stable-error-messaging, r=Centril

Output previous stable  error messaging when using stable build.

Fixes #65254

As I had mentioned previously there I have the logic running right now however I'm not getting the exact same syntax highlighting as there was originally for this error.

I'm currently getting the following:
```
error: expected expression, found statement (`let`)
 --> src/main.rs:2:14
  |
2 |     let x = (let y = 6);
  |              ^^^^^^^^^
  |
  = note: variable declaration using `let` is a statement
```

I'd like to get the following instead:

```
  |     let x = (let y = 6);
  |              ^^^
```

My current understanding is that the `span` being passed into `lower_expr_let` is coming from `lowering.rs`. I still don't know how the byte range is calculated for the erroneous syntax and need to look into it a bit more. In the meantime does anybody have any hints/tips regarding this??

4 years agoRollup merge of #65891 - michaelwoerister:sp-crate-metadata, r=wesleywiser
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:07 +0000 (21:36 +0100)]
Rollup merge of #65891 - michaelwoerister:sp-crate-metadata, r=wesleywiser

self-profiling: Record something more useful for crate metadata generation event.

Before this commit, we had an event that would only track the compression step
for proc-macros and Rust dylibs. After the commit we measure the time for
acutally generating the crate metadata bytes.

r? @wesleywiser

4 years agoRollup merge of #65887 - lzutao:doc-vec-get, r=rkruppe
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:06 +0000 (21:36 +0100)]
Rollup merge of #65887 - lzutao:doc-vec-get, r=rkruppe

doc: mention `get(_mut)` in Vec

4 years agoRollup merge of #65877 - lzutao:iter-chain-once, r=Centril
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:04 +0000 (21:36 +0100)]
Rollup merge of #65877 - lzutao:iter-chain-once, r=Centril

doc: introduce `once` in `iter::chain` document

I find it hard to find which one to use with `chain` when I only need to
chain one value. Also [`once`][1] talks about `chain`.

[1]: https://doc.rust-lang.org/nightly/std/iter/fn.once.html

4 years agoRollup merge of #65858 - davidtwco:rfc-2203-feature-gate-in-error, r=ecstatic-morse
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:02 +0000 (21:36 +0100)]
Rollup merge of #65858 - davidtwco:rfc-2203-feature-gate-in-error, r=ecstatic-morse

suggest `const_in_array_repeat_expression` flag

This PR adds a suggestion to add the `#![feature(const_in_array_repeat_expression)]` attribute to the crate when a promotable expression is used in a repeat expression and the feature gate is not enabled.

Unfortunately, this ended up being a little bit more complex than I anticipated, which may not have been worth it given that this would all be removed when the feature is stabilized. However, with #65732 and #65737 being open, and the feature gate having not been being suggested to potential users, the feature might not be stabilized in a while, so maybe this is worth landing.

cc @Centril (addresses [this comment](https://github.com/rust-lang/rust/pull/61749#discussion_r307863857))
r? @ecstatic-morse (opened issues related to RFC 2203 recently)

4 years agoRollup merge of #65825 - eddyb:def-index-vec, r=varkor
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:36:01 +0000 (21:36 +0100)]
Rollup merge of #65825 - eddyb:def-index-vec, r=varkor

rustc: use IndexVec<DefIndex, T> instead of Vec<T>.

Now that `DefIndex` is a proper index type, we can do that.
There was also an unnecessary `Option` I removed, I wonder if that has perf implications.

4 years agoRollup merge of #65643 - varkor:remove-free-regions-from-const-placeholder, r=eddyb
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:35:59 +0000 (21:35 +0100)]
Rollup merge of #65643 - varkor:remove-free-regions-from-const-placeholder, r=eddyb

Correct handling of type flags with `ConstValue::Placeholder`

This fixes a mistake, but not https://github.com/rust-lang/rust/issues/65623.

r? @eddyb

4 years agoRollup merge of #65640 - estebank:recover-missing-semi, r=Centril
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:35:58 +0000 (21:35 +0100)]
Rollup merge of #65640 - estebank:recover-missing-semi, r=Centril

Use heuristics to recover parsing of missing `;`

- Detect `,` and `:` typos where `;` was intended.
- When the next token could have been the start of a new statement,
  detect a missing semicolon.

Fix #48160, fix #44767 (after adding note about statements).

4 years agoRollup merge of #65563 - GuillaumeGomez:long-err-explanation-E0587, r=Dylan-DPC
Mazdak Farrokhzad [Mon, 28 Oct 2019 20:35:56 +0000 (21:35 +0100)]
Rollup merge of #65563 - GuillaumeGomez:long-err-explanation-E0587, r=Dylan-DPC

Add long error explanation for E0587

Part of #61137.

r? @kinnison

4 years agoOutput previous stable error messaging when using stable build.
Agustin Fernandez [Mon, 28 Oct 2019 13:15:46 +0000 (09:15 -0400)]
Output previous stable error messaging when using stable build.

4 years agosuggest `const_in_array_repeat_expression` flag
David Wood [Sat, 26 Oct 2019 22:59:24 +0000 (23:59 +0100)]
suggest `const_in_array_repeat_expression` flag

This commit adds a suggestion to add the
`#![feature(const_in_array_repeat_expression)]` attribute to the crate
when a promotable expression is used in a repeat expression.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoreview comments
Esteban Küber [Thu, 24 Oct 2019 22:57:43 +0000 (15:57 -0700)]
review comments

4 years agoTweak unexpected token wording
Esteban Küber [Tue, 22 Oct 2019 18:46:19 +0000 (11:46 -0700)]
Tweak unexpected token wording

4 years agoUse heuristics to recover parsing of missing `;`
Esteban Küber [Sun, 20 Oct 2019 21:35:46 +0000 (14:35 -0700)]
Use heuristics to recover parsing of missing `;`

- Detect `,` and `:` typos where `;` was intended.
- When the next token could have been the start of a new statement,
  detect a missing semicolon.

4 years agoImprove pretty-printing for compound qualified paths.
Patryk Wychowaniec [Sun, 27 Oct 2019 15:43:42 +0000 (16:43 +0100)]
Improve pretty-printing for compound qualified paths.

4 years agoFix a previously forgotten pretty-printing test after a change to the pretty-printing...
Patryk Wychowaniec [Sat, 26 Oct 2019 13:48:27 +0000 (15:48 +0200)]
Fix a previously forgotten pretty-printing test after a change to the pretty-printing mechanism.

4 years agoImprove the "try using a variant of the expected type" hint.
Patryk Wychowaniec [Fri, 18 Oct 2019 16:05:54 +0000 (18:05 +0200)]
Improve the "try using a variant of the expected type" hint.

4 years agoFix rebase
Esteban Küber [Mon, 28 Oct 2019 17:43:17 +0000 (10:43 -0700)]
Fix rebase

4 years agoAuto merge of #65202 - pietroalbini:scriptify-ci-config, r=alexcrichton
bors [Mon, 28 Oct 2019 17:17:30 +0000 (17:17 +0000)]
Auto merge of #65202 - pietroalbini:scriptify-ci-config, r=alexcrichton

ci: move most of the prepare config into scripts

This PR moves most of the configuration from the CI yamls into bash scripts, driven by a small Python script (which understands and emulates the two `##vso[` commands we use).

There are two reasons why we'd want to do this:

* Being able to prepare the build environment locally by just running `src/ci/prepare.py` simplifies a lot setting up a local VM similar to CI (software pre-installed in the CI images won't be prepared, but it's a start anyway).
* When we'll switch to GitHub Actions we'll need to either duplicate code in multiple workflows or write a preprocessor. Having all the prepare steps in a single one is going to simplify the implementation of both options.

Along with the move I did a few changes to the actual scripts:

* Mirrored all the remaining external URLs we download (except chocolatey) to the `rust-lang-ci-mirrors` bucket, to increase reliability and reduce the chance of supply chain attacks. I didn't audit and mirror the CI scripts outside this PR though.
* Extracted CI-specific behavior (like issuing `##vso[` commands and detecting the host platform) into `shared.sh` and included it in most of the scripts. This way a switch to another CI provider will be less painful.

It's possible (and easier) to review this commit-by-commit.
r? @alexcrichton
cc @rust-lang/infra

4 years agoadd comment
Esteban Küber [Sun, 27 Oct 2019 17:22:22 +0000 (10:22 -0700)]
add comment

4 years agoDo not display ADT type arguments and fix rebase
Esteban Küber [Thu, 24 Oct 2019 00:06:01 +0000 (17:06 -0700)]
Do not display ADT type arguments and fix rebase

4 years agoAccount for tuples in explanation
Esteban Küber [Sun, 13 Oct 2019 18:35:21 +0000 (11:35 -0700)]
Account for tuples in explanation

4 years agoTalk about specific types and remove lifetimes from output
Esteban Küber [Sun, 13 Oct 2019 18:25:30 +0000 (11:25 -0700)]
Talk about specific types and remove lifetimes from output

4 years agoFurther tweak spans for better readability
Esteban Küber [Sat, 12 Oct 2019 21:44:16 +0000 (14:44 -0700)]
Further tweak spans for better readability

4 years agoUse more targeted spans for orphan rule errors
Esteban Küber [Sat, 12 Oct 2019 21:31:23 +0000 (14:31 -0700)]
Use more targeted spans for orphan rule errors

4 years agoCall out the types that are non local on E0117
Esteban Küber [Fri, 11 Oct 2019 19:37:48 +0000 (12:37 -0700)]
Call out the types that are non local on E0117

4 years agoci: fix wrong path for wix being set
Pietro Albini [Mon, 28 Oct 2019 14:09:18 +0000 (15:09 +0100)]
ci: fix wrong path for wix being set

4 years agoAuto merge of #65421 - estebank:variants, r=petrochenkov
bors [Mon, 28 Oct 2019 13:41:13 +0000 (13:41 +0000)]
Auto merge of #65421 - estebank:variants, r=petrochenkov

Point at local similarly named element and tweak references to variants

Partially address #65386.

4 years agoself-profiling: Record something more useful for crate metadata generation event.
Michael Woerister [Mon, 28 Oct 2019 09:57:54 +0000 (10:57 +0100)]
self-profiling: Record something more useful for crate metadata generation event.

Before this commit, we had an event that would only track the compression step
for proc-macros and Rust dylibs. After the commit we measure the time for
acutally generating the crate metadata bytes.

4 years agorustc: use IndexVec<DefIndex, T> instead of Vec<T>.
Eduard-Mihai Burtescu [Fri, 25 Oct 2019 17:30:11 +0000 (20:30 +0300)]
rustc: use IndexVec<DefIndex, T> instead of Vec<T>.

4 years agoci: fix execution condition for install-clang
Pietro Albini [Mon, 28 Oct 2019 09:03:55 +0000 (10:03 +0100)]
ci: fix execution condition for install-clang

4 years agoAuto merge of #65188 - matthewjasper:stabilize-const-constructor, r=Centril
bors [Mon, 28 Oct 2019 07:38:49 +0000 (07:38 +0000)]
Auto merge of #65188 - matthewjasper:stabilize-const-constructor, r=Centril

Stabilize `const_constructor`

# Stabilization proposal

I propose that we stabilize `#![feature(const_constructor)]`.

Tracking issue: https://github.com/rust-lang/rust/issues/61456
Version target: 1.40 (2019-11-05 => beta, 2019-12-19 => stable).

## What is stabilized

### User guide

Tuple struct and tuple variant constructors are now considered to be constant functions. As such a call expression where the callee has a tuple struct or variant constructor "function item" type can be called:

```rust
const fn make_options() {
    // These already work because they are special cased:
    Some(0);
    (Option::Some)(1);
    // These also work now:
    let f = Option::Some;
    f(2);
    {Option::Some}(3);
    <Option<_>>::Some(5);
}
```

### Motivation

Consistency with other `const fn`. Consistency between syntactic path forms.

This should also ensure that constructors implement `const Fn` traits and can be coerced to `const fn` function pointers, if they are introduced.

## Tests

* [ui/consts/const_constructor/const-construct-call.rs](https://github.com/rust-lang/rust/blob/0d75ab2293a106eb674ac01860910cfc1580837e/src/test/ui/consts/const_constructor/const-construct-call.rs) - Tests various syntactic forms, use in both `const fn` and `const` items, and constructors in both the current and extern crates.
* [ui/consts/const_constructor/const_constructor_qpath.rs](https://github.com/rust-lang/rust/blob/1850dfcdabf8258a1f023f26c2c59e96b869dd95/src/test/ui/consts/const_constructor/const_constructor_qpath.rs) - Tests that type qualified paths to enum variants are also considered to be `const fn`.(#64247)

r? @oli-obk

Closes #61456
Closes  #64247

4 years agodoc: mention `get(_mut)` in Vec
Lzu Tao [Mon, 28 Oct 2019 05:39:37 +0000 (05:39 +0000)]
doc: mention `get(_mut)` in Vec

4 years agoAuto merge of #65885 - Centril:rollup-y6b2qbf, r=Centril
bors [Mon, 28 Oct 2019 04:21:44 +0000 (04:21 +0000)]
Auto merge of #65885 - Centril:rollup-y6b2qbf, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #64747 (Stabilize `Option::flatten`)
 - #65664 (`std::panic::Location` is a lang_item, add `core::intrinsics::caller_location` (RFC 2091 3/N))
 - #65792 (rustc, rustc_passes: reduce deps on rustc_expand)
 - #65849 (librustc_lexer: Enhance documentation)
 - #65873 (doc: explain why it is unsafe to construct Vec<u8> from Vec<u16>)
 - #65880 (Gather together usefulness tests)

Failed merges:

r? @ghost

4 years agoRollup merge of #65880 - Nadrieril:gather-usefulness-tests, r=varkor
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:12 +0000 (04:53 +0100)]
Rollup merge of #65880 - Nadrieril:gather-usefulness-tests, r=varkor

Gather together usefulness tests

I took most tests that were testing only for match exhaustiveness, pattern refutability or match arm reachability, and put them in the same test folder. I found it helpful to have them all in the same place when working on the usefulness algorithm.

4 years agoRollup merge of #65873 - lzutao:doc-vec-from-raw-parts, r=rkruppe
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:11 +0000 (04:53 +0100)]
Rollup merge of #65873 - lzutao:doc-vec-from-raw-parts, r=rkruppe

doc: explain why it is unsafe to construct Vec<u8> from Vec<u16>

4 years agoRollup merge of #65849 - popzxc:document-librustc_lexer, r=petrochenkov
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:09 +0000 (04:53 +0100)]
Rollup merge of #65849 - popzxc:document-librustc_lexer, r=petrochenkov

librustc_lexer: Enhance documentation

This PR enhances documentation state of the `librustc_lexer` (as initiative caused by [rustc-guide#474](https://github.com/rust-lang/rustc-guide/issues/474)), by adding:

- Module documentation.
- Doc-comments (and a bit of usual comments) in non-obvious (as for me) places.

r? @petrochenkov

cc @Centril

4 years agoRollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:07 +0000 (04:53 +0100)]
Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov

rustc, rustc_passes: reduce deps on rustc_expand

Part of #65324.

r? @petrochenkov

4 years agoRollup merge of #65664 - anp:panic-location, r=eddyb
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:06 +0000 (04:53 +0100)]
Rollup merge of #65664 - anp:panic-location, r=eddyb

`std::panic::Location` is a lang_item, add `core::intrinsics::caller_location` (RFC 2091 3/N)

[Tracking issue](https://github.com/rust-lang/rust/issues/47809)
[RFC text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md)

@eddyb suggested doing this intrinsic implementation ahead of actually implementing the `#[track_caller]` attribute so that there's an easily tested intermediate step between adding the shim and wiring up the attribute.

4 years agoRollup merge of #64747 - ethanboxx:master, r=Centril
Mazdak Farrokhzad [Mon, 28 Oct 2019 03:53:05 +0000 (04:53 +0100)]
Rollup merge of #64747 - ethanboxx:master, r=Centril

Stabilize `Option::flatten`

- PR: https://github.com/rust-lang/rust/pull/60256
- Tracking issue: https://github.com/rust-lang/rust/issues/60258

@elahn

> I was trying to `flat_map()` and found `map().flatten()` does the trick. This has been on nightly for 4 months, can we stabilise it?

@ethanboxx

> @Centril Helped me get this merged. What is the stabilization process?

@Centril

> @ethanboxx I'd just file a PR to stabilize it and we'll ask T-libs to FCP.

So here I am.

I am was unsure what number to put in `since = "-"` so I copied what someone had done in a recent PR.

4 years agodoc: introduce `once` in `iter::chain` document
Lzu Tao [Mon, 28 Oct 2019 03:22:59 +0000 (03:22 +0000)]
doc: introduce `once` in `iter::chain` document

4 years agoStabilize `const_constructor`
Matthew Jasper [Mon, 7 Oct 2019 20:08:39 +0000 (21:08 +0100)]
Stabilize `const_constructor`

4 years agoGather together usefulness tests
Nadrieril [Sat, 28 Sep 2019 14:05:38 +0000 (16:05 +0200)]
Gather together usefulness tests

I took most tests that were testing only for match exhaustiveness,
pattern refutability or match arm reachability, and put them in
the same test folder.

4 years agoAlways use consteval to codegen caller_location.
Adam Perry [Fri, 25 Oct 2019 00:35:02 +0000 (17:35 -0700)]
Always use consteval to codegen caller_location.

4 years agoImplementation of const caller_location.
Adam Perry [Thu, 24 Oct 2019 15:03:57 +0000 (08:03 -0700)]
Implementation of const caller_location.

4 years agoPanicking infra uses &core::panic::Location.
Adam Perry [Thu, 24 Oct 2019 02:30:21 +0000 (19:30 -0700)]
Panicking infra uses &core::panic::Location.

This allows us to remove `static_panic_msg` from the SSA<->LLVM
boundary, along with its fat pointer representation for &str.

Also changes the signature of PanicInfo::internal_contructor to
avoid copying.

Closes #65856.

4 years agoImplement core::intrinsics::caller_location.
Adam Perry [Wed, 9 Oct 2019 15:25:41 +0000 (08:25 -0700)]
Implement core::intrinsics::caller_location.

Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.

4 years agoPoint at local similarly named element and tweak references to variants
Esteban Küber [Tue, 15 Oct 2019 00:20:50 +0000 (17:20 -0700)]
Point at local similarly named element and tweak references to variants

Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.

4 years agodoc: explain why it is unsafe to construct Vec<u8> from Vec<u16>
Lzu Tao [Sun, 27 Oct 2019 17:31:01 +0000 (17:31 +0000)]
doc: explain why it is unsafe to construct Vec<u8> from Vec<u16>

Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
4 years agolibrustc_lexer: Enhance documentation
Igor Aleksanov [Sat, 26 Oct 2019 16:12:58 +0000 (19:12 +0300)]
librustc_lexer: Enhance documentation

Apply review suggestions

Apply review suggestions

4 years agoAuto merge of #65869 - Centril:rollup-bzlo74f, r=Centril
bors [Sun, 27 Oct 2019 16:15:40 +0000 (16:15 +0000)]
Auto merge of #65869 - Centril:rollup-bzlo74f, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #65566 (Use heuristics to suggest assignment)
 - #65738 (Coherence should allow fundamental types to impl traits when they are local)
 - #65777 (Don't ICE for completely unexpandable `impl Trait` types)
 - #65834 (Remove lint callback from driver)
 - #65839 (Clean up `check_consts` now that new promotion pass is implemented)
 - #65855 (Add long error explaination for E0666)

Failed merges:

r? @ghost

4 years agorustc, rustc_passes: don't depend on syntax_expand.
Mazdak Farrokhzad [Wed, 9 Oct 2019 14:47:38 +0000 (16:47 +0200)]
rustc, rustc_passes: don't depend on syntax_expand.

This is done by moving some data definitions to syntax::expand.

4 years agosyntax/attr: reduce reliance on parser
Mazdak Farrokhzad [Wed, 9 Oct 2019 11:19:15 +0000 (13:19 +0200)]
syntax/attr: reduce reliance on parser

4 years agoRollup merge of #65855 - ObsidianMinor:extended_error/E0666, r=varkor
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:58 +0000 (16:46 +0100)]
Rollup merge of #65855 - ObsidianMinor:extended_error/E0666, r=varkor

Add long error explaination for E0666

In the spirit of the month of spooks, here's a long explanation for E0666 for #61137.

4 years agoRollup merge of #65839 - ecstatic-morse:promo-sanity-fixes, r=eddyb
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:56 +0000 (16:46 +0100)]
Rollup merge of #65839 - ecstatic-morse:promo-sanity-fixes, r=eddyb

Clean up `check_consts` now that new promotion pass is implemented

`check_consts::resolver` contained a layer of abstraction (`QualifResolver`) to allow the existing, eager style of qualif propagation to work with either a dataflow results cursor or by applying the transfer function directly (if dataflow was not needed e.g. for promotion). However, #63812 uses a different, lazy paradigm for checking promotability, which makes this unnecessary. This PR cleans up `check_consts::validation` to use `FlowSensitiveResolver` directly, instead of through the now obselete `QualifResolver` API.

Also, this contains a few commits (the first four) that address some FIXMEs in #63812 regarding code duplication. They could be split out, but I think they will be relatively noncontroversial? Notably, `validation::Mode` is renamed to `ConstKind` and used in `promote_consts` to denote what kind of item we are in.

This is best reviewed commit-by-commit and is low priority.

r? @eddyb

4 years agoRollup merge of #65834 - Mark-Simulacrum:driver-clean, r=nikomatsakis
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:55 +0000 (16:46 +0100)]
Rollup merge of #65834 - Mark-Simulacrum:driver-clean, r=nikomatsakis

Remove lint callback from driver

This is leftover from a restructuring of lint registration for drivers; it should now happen via the register_lints field on Config rather than this function.

This is not used by anyone to my knowledge (including the compiler itself); it was introduced in an abandoned refactor in #65193.

4 years agoRollup merge of #65777 - matthewjasper:allow-impl-trait-expansion, r=davidtwco
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:54 +0000 (16:46 +0100)]
Rollup merge of #65777 - matthewjasper:allow-impl-trait-expansion, r=davidtwco

Don't ICE for completely unexpandable `impl Trait` types

Save the resolution of these types (to themselves) to the typeck tables so that they will eventually reach E0720.

closes #65561

4 years agoRollup merge of #65738 - ohadravid:re-rebalance-coherence-allow-fundamental-local...
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:52 +0000 (16:46 +0100)]
Rollup merge of #65738 - ohadravid:re-rebalance-coherence-allow-fundamental-local, r=nikomatsakis

Coherence should allow fundamental types to impl traits when they are local

After #64414, `impl<T> Remote for Box<T> { }` is disallowed, but it is also disallowed in liballoc, where `Box` is a local type!

Enabling `#![feature(re_rebalance_coherence)]` in `liballoc` results in:
```
error[E0210]: type parameter `F` must be used as the type parameter for some local type (e.g., `MyStruct<F>`)
    --> src\liballoc\boxed.rs:1098:1
     |
1098 | impl<F: ?Sized + Future + Unpin> Future for Box<F> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `F` must be used as the type parameter for some local type
```

This PR relaxes `uncover_fundamental_ty` to skip local fundamental types.
I didn't add a test since `liballoc` already fails to compile, but I can add one if needed.

r? @nikomatsakis

cc #63599

4 years agoRollup merge of #65566 - estebank:let-expr-as-ty, r=Centril
Mazdak Farrokhzad [Sun, 27 Oct 2019 15:46:51 +0000 (16:46 +0100)]
Rollup merge of #65566 - estebank:let-expr-as-ty, r=Centril

Use heuristics to suggest assignment

When detecting a possible `=` -> `:` typo in a `let` binding, suggest
assigning instead of setting the type.

Partially address #57828.

4 years agoAuto merge of #65541 - eddyb:spanned-inferred-outlives, r=nikomatsakis
bors [Sun, 27 Oct 2019 12:58:10 +0000 (12:58 +0000)]
Auto merge of #65541 - eddyb:spanned-inferred-outlives, r=nikomatsakis

rustc: add `Span`s to `inferred_outlives_of` predicates.

This would simplify #59789, and I suspect it has some potential in diagnostics (although we don't seem to use the predicate `Span`s much atm).

4 years agoAuto merge of #65519 - pnkfelix:issue-63438-trait-based-structural-match, r=matthewjasper
bors [Sun, 27 Oct 2019 09:35:12 +0000 (09:35 +0000)]
Auto merge of #65519 - pnkfelix:issue-63438-trait-based-structural-match, r=matthewjasper

trait-based structural match implementation

Moves from using a `#[structural_match]` attribute to using a marker trait (or pair of such traits, really) instead.

Fix #63438.

(This however does not remove the hacks that I believe were put into place to support the previous approach of injecting the attribute based on the presence of both derives... I have left that for follow-on work.)

4 years agoAuto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakis
bors [Sun, 27 Oct 2019 03:34:54 +0000 (03:34 +0000)]
Auto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakis

Point at associated type for some obligations

Partially address #57663.

4 years agoUpdate with word change suggestion
ObsidianMinor [Sat, 26 Oct 2019 23:42:31 +0000 (18:42 -0500)]
Update with word change suggestion

Co-Authored-By: varkor <github@varkor.com>
4 years agoAuto merge of #65852 - flip1995:clippyup, r=Manishearth
bors [Sat, 26 Oct 2019 23:37:08 +0000 (23:37 +0000)]
Auto merge of #65852 - flip1995:clippyup, r=Manishearth

Update Clippy

Fixes https://github.com/rust-lang/rust/pull/65845#issuecomment-546633123

r? @Manishearth

4 years agoAdd detailed explaination for E0666
Sydney Acksman [Sat, 26 Oct 2019 22:44:23 +0000 (17:44 -0500)]
Add detailed explaination for E0666

4 years agoFix rebase
Esteban Küber [Sat, 26 Oct 2019 22:34:28 +0000 (15:34 -0700)]
Fix rebase

4 years agoreview comment: use `Default`
Esteban Küber [Sat, 19 Oct 2019 20:27:54 +0000 (13:27 -0700)]
review comment: use `Default`

4 years agoreview comments and tweaks
Esteban Küber [Sat, 19 Oct 2019 17:13:56 +0000 (10:13 -0700)]
review comments and tweaks

4 years agoRemove unnecessary error in test
Esteban Küber [Fri, 18 Oct 2019 17:37:28 +0000 (10:37 -0700)]
Remove unnecessary error in test

4 years agoUse heuristics to suggest assignment
Esteban Küber [Fri, 18 Oct 2019 17:33:25 +0000 (10:33 -0700)]
Use heuristics to suggest assignment

When detecting a possible `=` -> `:` typo in a `let` binding, suggest
assigning instead of setting the type.

4 years agoOnly run efiapi test on llvm 9.0+
roblabla [Sat, 26 Oct 2019 21:05:13 +0000 (21:05 +0000)]
Only run efiapi test on llvm 9.0+

4 years agoUpdate Clippy
flip1995 [Sat, 26 Oct 2019 21:02:23 +0000 (23:02 +0200)]
Update Clippy

4 years agoAuto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichton
bors [Sat, 26 Oct 2019 19:35:59 +0000 (19:35 +0000)]
Auto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichton

Redesign the interface to the unikernel HermitCore

We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs.

We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.

4 years agoAuto merge of #65845 - Centril:rollup-28jtjfc, r=Centril
bors [Sat, 26 Oct 2019 16:14:16 +0000 (16:14 +0000)]
Auto merge of #65845 - Centril:rollup-28jtjfc, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #65743 (rustc_typeck: don't record direct callees in generator_interior.)
 - #65761 (libsyntax: Enhance documentation of the AST module)
 - #65772 (Remove the last remaining READMEs)
 - #65773 (Increase spacing for suggestions in diagnostics)
 - #65791 (Adding doc on keyword continue)
 - #65824 (rustc: make DefPathData (and friends) Copy (now that it uses Symbol).)
 - #65828 (Derive Eq and Hash for SourceInfo again)
 - #65842 (Add more information on rustdoc search)

Failed merges:

 - #65825 (rustc: use IndexVec<DefIndex, T> instead of Vec<T>.)

r? @ghost

4 years agoRollup merge of #65842 - GuillaumeGomez:more-search-information, r=Dylan-DPC
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:51 +0000 (14:17 +0200)]
Rollup merge of #65842 - GuillaumeGomez:more-search-information, r=Dylan-DPC

Add more information on rustdoc search

Fixes #65735.

r? @kinnison

4 years agoRollup merge of #65828 - bjorn3:add_source_info_eq_hash, r=petrochenkov
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:50 +0000 (14:17 +0200)]
Rollup merge of #65828 - bjorn3:add_source_info_eq_hash, r=petrochenkov

Derive Eq and Hash for SourceInfo again

In https://github.com/bjorn3/rustc_codegen_cranelift/blob/75c24b9c9677600422ec86fa9f4c78fe3678d2ce/src/common.rs#L368 I store it in a `indexmap::IndexSet`, which requires `Eq` and `Hash`. Unfortunately they were removed in https://github.com/rust-lang/rust/pull/65647, so I can't update to latest nightly.

4 years agoRollup merge of #65824 - eddyb:def-key-copy, r=varkor
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:48 +0000 (14:17 +0200)]
Rollup merge of #65824 - eddyb:def-key-copy, r=varkor

rustc: make DefPathData (and friends) Copy (now that it uses Symbol).

Spotted this while working on something else.

4 years agoRollup merge of #65791 - dorfsmay:doc_keyword_continue, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:46 +0000 (14:17 +0200)]
Rollup merge of #65791 - dorfsmay:doc_keyword_continue, r=Mark-Simulacrum

Adding doc on keyword continue

Partial solution of issue #34601.

4 years agoRollup merge of #65773 - estebank:sugg-whitespace, r=Centril
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:45 +0000 (14:17 +0200)]
Rollup merge of #65773 - estebank:sugg-whitespace, r=Centril

Increase spacing for suggestions in diagnostics

Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.

r? @Centril

4 years agoRollup merge of #65772 - mark-i-m:final-readmes, r=nikomatsakis
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:43 +0000 (14:17 +0200)]
Rollup merge of #65772 - mark-i-m:final-readmes, r=nikomatsakis

Remove the last remaining READMEs

cc https://github.com/rust-lang/rustc-guide/pull/481

closes #48478

r? @nikomatsakis

4 years agoRollup merge of #65761 - popzxc:document-ast, r=petrochenkov
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:42 +0000 (14:17 +0200)]
Rollup merge of #65761 - popzxc:document-ast, r=petrochenkov

libsyntax: Enhance documentation of the AST module

This PR enhances documentation state to the `libsyntax/ast.rs` (as initiative caused by [rustc-guide#474](https://github.com/rust-lang/rustc-guide/issues/474)), by adding:
- Module documentation.
- Doc-comments (and a bit of usual comments) in non-obvious (as for me) places.
- Minor style fixes to improve module readability.

4 years agoRollup merge of #65743 - eddyb:generator-on-call, r=matthewjasper
Mazdak Farrokhzad [Sat, 26 Oct 2019 12:17:40 +0000 (14:17 +0200)]
Rollup merge of #65743 - eddyb:generator-on-call, r=matthewjasper

rustc_typeck: don't record direct callees in generator_interior.

For expressions like `f(g().await)` we were recording `f` as needing to be kept in a temporary (and therefore be tracked by the generator type) across the suspend, even if a function/method path.
However, this is never needed, and can cause issues with complex function types (see #65244).

cc @Zoxc @nikomatsakis

4 years agoCoherence should allow fundamental types to impl traits
Ohad Ravid [Wed, 23 Oct 2019 20:22:13 +0000 (22:22 +0200)]
Coherence should allow fundamental types to impl traits

4 years agoAdd more information on search
Guillaume Gomez [Sat, 26 Oct 2019 09:26:02 +0000 (11:26 +0200)]
Add more information on search

4 years agoAuto merge of #65758 - RalfJung:miri, r=oli-obk
bors [Sat, 26 Oct 2019 09:19:48 +0000 (09:19 +0000)]
Auto merge of #65758 - RalfJung:miri, r=oli-obk

update Miri

Fixes https://github.com/rust-lang/rust/issues/65684

4 years agoupdate miri
Ralf Jung [Sat, 26 Oct 2019 08:14:56 +0000 (10:14 +0200)]
update miri

4 years agouse plain cargo to install xargo
Ralf Jung [Fri, 25 Oct 2019 07:22:17 +0000 (09:22 +0200)]
use plain cargo to install xargo

4 years agobootstrap now takes care of installing xargo
Ralf Jung [Thu, 24 Oct 2019 13:39:20 +0000 (15:39 +0200)]
bootstrap now takes care of installing xargo

4 years agoupdate Miri
Ralf Jung [Thu, 24 Oct 2019 10:04:05 +0000 (12:04 +0200)]
update Miri