Commit Graph

101635 Commits

Author SHA1 Message Date
Patryk Wychowaniec
273ee611f0
Improve the "try using a variant of the expected type" hint. 2019-10-28 18:43:51 +01:00
Esteban Küber
627691f138 Fix rebase 2019-10-28 10:43:17 -07:00
bors
b497e18995 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
2019-10-28 17:17:30 +00:00
Esteban Küber
2cd28c15ee add comment 2019-10-28 09:57:36 -07:00
Esteban Küber
95364df6bc Do not display ADT type arguments and fix rebase 2019-10-28 09:57:36 -07:00
Esteban Küber
db1bfbdbc0 Account for tuples in explanation 2019-10-28 09:57:36 -07:00
Esteban Küber
daeafd895d Talk about specific types and remove lifetimes from output 2019-10-28 09:57:36 -07:00
Esteban Küber
56aa89cdbe Further tweak spans for better readability 2019-10-28 09:57:36 -07:00
Esteban Küber
9b4f811b7f Use more targeted spans for orphan rule errors 2019-10-28 09:57:36 -07:00
Esteban Küber
adfe9a45d6 Call out the types that are non local on E0117 2019-10-28 09:56:53 -07:00
Michael Woerister
a63dfb3b82 Ignore issue-64153 run-make test on Windows since supporting a Windows version is not worth the trouble. 2019-10-28 17:07:25 +01:00
Pietro Albini
7e051236b0
ci: fix wrong path for wix being set 2019-10-28 15:09:18 +01:00
Stefan Lankes
7cecfab386 add basic HermitCore support within libtest 2019-10-28 09:54:24 -04:00
bors
8d78bf6b27 Auto merge of #65421 - estebank:variants, r=petrochenkov
Point at local similarly named element and tweak references to variants

Partially address #65386.
2019-10-28 13:41:13 +00:00
Michael Woerister
46a39a2d42 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.
2019-10-28 13:55:13 +01:00
Quentin Boyer
652b1bd45d fix tidy 2019-10-28 11:22:26 +01:00
Eduard-Mihai Burtescu
cc575a6ad5 rustc: use IndexVec<DefIndex, T> instead of Vec<T>. 2019-10-28 11:38:36 +02:00
Pietro Albini
c854c4482b
ci: fix execution condition for install-clang 2019-10-28 10:04:26 +01:00
bors
03a50ae9b8 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](0d75ab2293/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](1850dfcdab/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
2019-10-28 07:38:49 +00:00
Lzu Tao
e2c450b8da doc: mention get(_mut) in Vec 2019-10-28 05:39:37 +00:00
bors
9285d401a6 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
2019-10-28 04:21:44 +00:00
Mazdak Farrokhzad
606743e8c7
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.
2019-10-28 04:53:12 +01:00
Mazdak Farrokhzad
75a127c48b
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>
2019-10-28 04:53:11 +01:00
Mazdak Farrokhzad
575058f3d7
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
2019-10-28 04:53:09 +01:00
Mazdak Farrokhzad
83260d5c43
Rollup merge of #65792 - Centril:split-syntax-2, r=petrochenkov
rustc, rustc_passes: reduce deps on rustc_expand

Part of #65324.

r? @petrochenkov
2019-10-28 04:53:07 +01:00
Mazdak Farrokhzad
4728d66206
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.
2019-10-28 04:53:06 +01:00
Mazdak Farrokhzad
c8eefdffe9
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.
2019-10-28 04:53:05 +01:00
Lzu Tao
9c4f60eecf doc: introduce once in iter::chain document 2019-10-28 03:22:59 +00:00
Quentin Boyer
de9413bd34 changing non-empty glob must import something to a lint 2019-10-28 00:57:25 +01:00
Matthew Jasper
170718c93f Stabilize const_constructor 2019-10-27 21:25:35 +00:00
Nadrieril
09f9947ebc 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.
2019-10-27 21:20:26 +00:00
Adam Perry
86e55b1882 Always use consteval to codegen caller_location. 2019-10-27 12:51:55 -07:00
Adam Perry
017877cbbe Implementation of const caller_location. 2019-10-27 12:51:34 -07:00
Adam Perry
aec97e050e 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.
2019-10-27 12:50:58 -07:00
Adam Perry
743964ad3f Implement core::intrinsics::caller_location.
Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.
2019-10-27 12:50:52 -07:00
Esteban Küber
b26ddb8af3 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.
2019-10-27 11:50:43 -07:00
Lzu Tao
3f980785fb doc: explain why it is unsafe to construct Vec<u8> from Vec<u16>
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2019-10-27 17:31:01 +00:00
Igor Aleksanov
993b920032 librustc_lexer: Enhance documentation
Apply review suggestions

Apply review suggestions
2019-10-27 20:08:08 +03:00
bors
95f437b3cf 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
2019-10-27 16:15:40 +00:00
Mazdak Farrokhzad
fb12c70852 rustc, rustc_passes: don't depend on syntax_expand.
This is done by moving some data definitions to syntax::expand.
2019-10-27 17:05:57 +01:00
Mazdak Farrokhzad
16329402bf syntax/attr: reduce reliance on parser 2019-10-27 16:54:12 +01:00
Mazdak Farrokhzad
b5b4f9b304
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.
2019-10-27 16:46:58 +01:00
Mazdak Farrokhzad
dae8ded9f5
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
2019-10-27 16:46:56 +01:00
Mazdak Farrokhzad
0982060a69
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.
2019-10-27 16:46:55 +01:00
Mazdak Farrokhzad
5406f7ad49
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
2019-10-27 16:46:54 +01:00
Mazdak Farrokhzad
53568f3fb3
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
2019-10-27 16:46:52 +01:00
Mazdak Farrokhzad
a466f014b5
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.
2019-10-27 16:46:51 +01:00
bors
0f677c65e8 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).
2019-10-27 12:58:10 +00:00
Guillaume Gomez
91ef9600db reduce size of generated HTML files by moving the popup helper code to the JS 2019-10-27 11:42:38 +01:00
Guillaume Gomez
1d2808341a Cleanup search element getter 2019-10-27 11:40:47 +01:00