]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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

4 years agoRemove `QualifResolver` abstraction
Dylan MacKenzie [Wed, 23 Oct 2019 19:10:08 +0000 (12:10 -0700)]
Remove `QualifResolver` abstraction

This is a relic from earlier attempts at dataflow-based const validation
that attempted to do promotion at the same time. #63812 takes a
different approach: `IsNotPromotable` is no longer a `Qualif` and is
computed lazily instead of eagerly. As a result, there's no need for an
eager `TempPromotionResolver`, and we can use the only implementer of
`QualifResolver` directly instead of through a trait.

4 years agoUse `is_lang_panic_fn` from `check_consts` in `promote_consts`
Dylan MacKenzie [Tue, 22 Oct 2019 22:00:51 +0000 (15:00 -0700)]
Use `is_lang_panic_fn` from `check_consts` in `promote_consts`

4 years agoDeduplicate `promote_consts::Validator` and `check_consts::Item`
Dylan MacKenzie [Tue, 22 Oct 2019 21:55:04 +0000 (14:55 -0700)]
Deduplicate `promote_consts::Validator` and `check_consts::Item`

4 years agoMake `Item` fields pub
Dylan MacKenzie [Tue, 22 Oct 2019 21:54:10 +0000 (14:54 -0700)]
Make `Item` fields pub

4 years agoMake `check_consts::Item` work on non-const fns
Dylan MacKenzie [Tue, 22 Oct 2019 21:30:31 +0000 (14:30 -0700)]
Make `check_consts::Item` work on non-const fns

This was originally only needed for validation, which is never run on
non-const `fn`s. The new promotion pass wants to use it, however.

4 years agolibsyntax: Document ast module
Igor Aleksanov [Thu, 24 Oct 2019 13:11:43 +0000 (16:11 +0300)]
libsyntax: Document ast module

Apply review suggestions

Remove links in the module docs

Flatten imports

Apply review suggestions

Remove useless comments

Fix nits

4 years agoAuto merge of #63812 - eddyb:promo-sanity, r=oli-obk
bors [Sat, 26 Oct 2019 00:11:36 +0000 (00:11 +0000)]
Auto merge of #63812 - eddyb:promo-sanity, r=oli-obk

rustc_mir: double-check const-promotion candidates for sanity.

Previously, const promotion involved tracking information about the value in a MIR local (or any part of the computation leading up to that value), aka "qualifs", in a quite stateful manner, which is hard to extend to arbitrary CFGs without a dataflow pass.

However, the nature of the promotion we do is that it's effectively an SSA-like "tree" (or DAG, really), of assigned-once locals - which is how we can take them from the original MIR in the first place.
This structure means that the subset of the MIR responsible for computing any given part of a const-promoted value is readily analyzable by walking that tree/DAG.

This PR implements such an analysis in `promote_consts`, reusing the `HasMutInterior` / `NeedsDrop` computation from `qualify_consts`, but reimplementing the equivalent of `IsNotPromotable` / `IsNotImplicitlyPromotable`.

Eventually we should be able to remove `IsNotPromotable` / `IsNotImplicitlyPromotable` from `qualify_consts`, which will simplify @ecstatic-morse's dataflow-based const-checking efforts.

But currently this is mainly for a crater check-only run - it will compare the results from the old promotion collection and the new promotion validation and ICE if they don't match.

r? @oli-obk

4 years agoRemove lint callback from driver
Mark Rousskov [Fri, 25 Oct 2019 23:27:57 +0000 (19:27 -0400)]
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.

4 years agorustc_mir: use the new validator's Qualif in promotion.
Eduard-Mihai Burtescu [Mon, 21 Oct 2019 18:18:12 +0000 (21:18 +0300)]
rustc_mir: use the new validator's Qualif in promotion.

4 years agorustc_mir: double-check const-promotion candidates for sanity.
Eduard-Mihai Burtescu [Wed, 21 Aug 2019 20:31:58 +0000 (23:31 +0300)]
rustc_mir: double-check const-promotion candidates for sanity.

4 years agoAuto merge of #65826 - JohnTitor:rollup-mr6crka, r=JohnTitor
bors [Fri, 25 Oct 2019 20:41:28 +0000 (20:41 +0000)]
Auto merge of #65826 - JohnTitor:rollup-mr6crka, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #65705 (Add {String,Vec}::into_raw_parts)
 - #65749 (Insurance policy in case `iter.size_hint()` lies.)
 - #65799 (Fill tracking issue number for `array_value_iter`)
 - #65800 (self-profiling: Update measureme to 0.4.0 and remove non-RAII methods from profiler.)
 - #65806 (Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().)
 - #65810 (SGX: Clear additional flag on enclave entry)

Failed merges:

r? @ghost

4 years agoDerive Eq and Hash for SourceInfo again
bjorn3 [Fri, 25 Oct 2019 19:11:29 +0000 (21:11 +0200)]
Derive Eq and Hash for SourceInfo again

4 years agoApply suggestions from code review
matthewjasper [Fri, 25 Oct 2019 17:50:40 +0000 (18:50 +0100)]
Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoRollup merge of #65810 - raoulstrackx:ac_mitigation, r=nagisa
Yuki Okushi [Fri, 25 Oct 2019 17:46:02 +0000 (02:46 +0900)]
Rollup merge of #65810 - raoulstrackx:ac_mitigation, r=nagisa

SGX: Clear additional flag on enclave entry

An attacker could set both the AC flag in CR0 as in rflags. This causes the enclave to perform an AEX upon a misaligned memory access, and an attacker learns some information about the internal enclave state.
The AC flag in rflags is copied from userspace upon an enclave entry. Upon AEX it is copied and later restored. This patch forces the rflag.AC bit to be reset right after an enter.

4 years agoRollup merge of #65806 - fusion-engineering-forks:slice-ptr-range, r=Centril
Yuki Okushi [Fri, 25 Oct 2019 17:46:01 +0000 (02:46 +0900)]
Rollup merge of #65806 - fusion-engineering-forks:slice-ptr-range, r=Centril

Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().

Implementation of https://github.com/rust-lang/rfcs/pull/2791

4 years agoRollup merge of #65800 - michaelwoerister:measureme-0.4.0, r=wesleywiser
Yuki Okushi [Fri, 25 Oct 2019 17:45:59 +0000 (02:45 +0900)]
Rollup merge of #65800 - michaelwoerister:measureme-0.4.0, r=wesleywiser

self-profiling: Update measureme to 0.4.0 and remove non-RAII methods from profiler.

This PR removes all non-RAII based profiling methods from `SelfProfilerRef` :tada:
It also delegates the `TimingGuard` implementation to `measureme`, now that that is available there.

r? @wesleywiser

4 years agoRollup merge of #65799 - LukasKalbertodt:fill-array-value-iter-tracking-issue, r...
Yuki Okushi [Fri, 25 Oct 2019 17:45:58 +0000 (02:45 +0900)]
Rollup merge of #65799 - LukasKalbertodt:fill-array-value-iter-tracking-issue, r=Centril

Fill tracking issue number for `array_value_iter`

Thanks for [noticing](https://github.com/rust-lang/rust/pull/62959#discussion_r338930448)!

r? @Centril

4 years agoRollup merge of #65749 - Centril:insurance-policy, r=RalfJung
Yuki Okushi [Fri, 25 Oct 2019 17:45:57 +0000 (02:45 +0900)]
Rollup merge of #65749 - Centril:insurance-policy, r=RalfJung

Insurance policy in case `iter.size_hint()` lies.

Follow up to https://github.com/rust-lang/rust/pull/64949/files#r334235076.
(If the perf impact is bad we can use `debug_assert!` instead.)

The good news is that the UI tests pass locally so `iter.size_hint()` seems to be honest *thus far*.
On the other hand, with the status quo we do not have an insurance policy should that change in some case. This is problematic because a) this could possibly make some program be accepted which shouldn't, b) the compiler itself could have memory unsafety if the correctness of the iterator is assumed in `unsafe { ... }` code (even though the blame lies with the `unsafe { ... }` block in question.)

r? @RalfJung
cc @nnethercote

4 years agoRollup merge of #65705 - shepmaster:vec-into-raw, r=SimonSapin
Yuki Okushi [Fri, 25 Oct 2019 17:45:56 +0000 (02:45 +0900)]
Rollup merge of #65705 - shepmaster:vec-into-raw, r=SimonSapin

Add {String,Vec}::into_raw_parts

Aspects to address:

- [x] Create a tracking issue
  - #65816

4 years agorustc: replace a few `.cloned()` with `.copied()`.
Eduard-Mihai Burtescu [Fri, 25 Oct 2019 17:21:37 +0000 (20:21 +0300)]
rustc: replace a few `.cloned()` with `.copied()`.

4 years agorustc: make DefPathData (and friends) Copy (now that it uses Symbol).
Eduard-Mihai Burtescu [Fri, 25 Oct 2019 17:03:17 +0000 (20:03 +0300)]
rustc: make DefPathData (and friends) Copy (now that it uses Symbol).

4 years agoFix slice::as_ptr_range doctest.
Mara Bos [Fri, 25 Oct 2019 15:22:03 +0000 (17:22 +0200)]
Fix slice::as_ptr_range doctest.

4 years agoTake out an insurance policy in case `iter.size_hint()`
Mazdak Farrokhzad [Thu, 24 Oct 2019 01:21:23 +0000 (03:21 +0200)]
Take out an insurance policy in case `iter.size_hint()`
lies, underreporting the number of elements.

4 years agoAdd {String,Vec}::into_raw_parts
Jake Goulding [Tue, 22 Oct 2019 16:48:52 +0000 (12:48 -0400)]
Add {String,Vec}::into_raw_parts

4 years agoUse ManuallyDrop in examples for {Vec,String}::from_raw_parts
Jake Goulding [Tue, 22 Oct 2019 19:40:22 +0000 (15:40 -0400)]
Use ManuallyDrop in examples for {Vec,String}::from_raw_parts

4 years agoRemove unneeded pointer casting
Jake Goulding [Tue, 22 Oct 2019 17:54:09 +0000 (13:54 -0400)]
Remove unneeded pointer casting

4 years agoforgot pushfq/popqfq: fixed
Raoul Strackx [Fri, 25 Oct 2019 14:06:13 +0000 (16:06 +0200)]
forgot pushfq/popqfq: fixed

4 years agoExplain why pointer::add in slice::as_ptr_range is safe.
Mara Bos [Fri, 25 Oct 2019 13:21:00 +0000 (15:21 +0200)]
Explain why pointer::add in slice::as_ptr_range is safe.

4 years agocleaning up code
Raoul Strackx [Fri, 25 Oct 2019 13:44:07 +0000 (15:44 +0200)]
cleaning up code

4 years agoremoved unnecessary push
Raoul Strackx [Fri, 25 Oct 2019 13:27:48 +0000 (15:27 +0200)]
removed unnecessary push

4 years agoUpdate test output.
Felix S. Klock II [Fri, 18 Oct 2019 09:37:05 +0000 (11:37 +0200)]
Update test output.

(My inference is that the number changed from 4 to 5 because `derive(PartialEq)` now injects an extra trait impl before.)

4 years agoReview feedback: elaborated comments.
Felix S. Klock II [Fri, 25 Oct 2019 12:47:04 +0000 (14:47 +0200)]
Review feedback: elaborated comments.

4 years agoMigrate from `#[structural_match]` attribute a lang-item trait.
Felix S. Klock II [Thu, 17 Oct 2019 08:54:37 +0000 (10:54 +0200)]
Migrate from `#[structural_match]` attribute a lang-item trait.

(Or more precisely, a pair of such traits: one for `derive(PartialEq)` and one
for `derive(Eq)`.)

((The addition of the second marker trait, `StructuralEq`, is largely a hack to
work-around `fn (&T)` not implementing `PartialEq` and `Eq`; see also issue
rust-lang/rust#46989; otherwise I would just check if `Eq` is implemented.))

Note: this does not use trait fulfillment error-reporting machinery; it just
uses the trait system to determine if the ADT was tagged or not. (Nonetheless, I
have kept an `on_unimplemented` message on the new trait for structural_match
check, even though it is currently not used.)

Note also: this does *not* resolve the ICE from rust-lang/rust#65466, as noted
in a comment added in this commit. Further work is necessary to resolve that and
other problems with the structural match checking, especially to do so without
breaking stable code (adapted from test fn-ptr-is-structurally-matchable.rs):

```rust
fn r_sm_to(_: &SM) {}

fn main() {
    const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
    let input: Wrap<fn(&SM)> = Wrap(r_sm_to);
    match Wrap(input) {
        Wrap(CFN6) => {}
        Wrap(_) => {}
    };
}
```

where we would hit a problem with the strategy of unconditionally checking for
`PartialEq` because the type `for <'a> fn(&'a SM)` does not currently even
*implement* `PartialEq`.

----

added review feedback:
* use an or-pattern
* eschew `return` when tail position will do.
* don't need fresh_expansion; just add `structural_match` to appropriate `allow_internal_unstable` attributes.

also fixed example in doc comment so that it actually compiles.

4 years agoAdd slice_ptr_range tracking issue number.
Mara Bos [Fri, 25 Oct 2019 12:33:07 +0000 (14:33 +0200)]
Add slice_ptr_range tracking issue number.

4 years agoAdd [T]::as_ptr_range() and [T]::as_mut_ptr_range().
Mara Bos [Fri, 25 Oct 2019 12:07:08 +0000 (14:07 +0200)]
Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().

See https://github.com/rust-lang/rfcs/pull/2791 for motivation.

4 years agoAuto merge of #65804 - Centril:rollup-arlxgch, r=Centril
bors [Fri, 25 Oct 2019 11:13:30 +0000 (11:13 +0000)]
Auto merge of #65804 - Centril:rollup-arlxgch, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #64639 (Stabilize `#[non_exhaustive]` (RFC 2008))
 - #65074 (Fix the start/end byte positions in the compiler JSON output)
 - #65315 (Intern place projection)
 - #65685 (Fix check of `statx` and handle EPERM)
 - #65731 (Prevent unnecessary allocation in PathBuf::set_extension.)
 - #65740 (Fix default "disable-shortcuts" feature value)
 - #65787 (move panictry! to where it is used.)
 - #65789 (move Attribute::with_desugared_doc to librustdoc)
 - #65790 (move report_invalid_macro_expansion_item to item.rs)

Failed merges:

r? @ghost

4 years agoRollup merge of #65790 - Centril:move-report-invalid, r=davidtwco
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:55 +0000 (13:12 +0200)]
Rollup merge of #65790 - Centril:move-report-invalid, r=davidtwco

move report_invalid_macro_expansion_item to item.rs

From https://github.com/rust-lang/rust/pull/65324.

r? @Mark-Simulacrum

4 years agoRollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:54 +0000 (13:12 +0200)]
Rollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco

move Attribute::with_desugared_doc to librustdoc

From https://github.com/rust-lang/rust/pull/65324.

r? @varkor

4 years agoRollup merge of #65787 - Centril:panictry, r=davidtwco
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:53 +0000 (13:12 +0200)]
Rollup merge of #65787 - Centril:panictry, r=davidtwco

move panictry! to where it is used.

From https://github.com/rust-lang/rust/pull/65324

r? @davidtwco

4 years agoRollup merge of #65740 - GuillaumeGomez:fix-disable-shortcut-feature, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:51 +0000 (13:12 +0200)]
Rollup merge of #65740 - GuillaumeGomez:fix-disable-shortcut-feature, r=Dylan-DPC

Fix default "disable-shortcuts" feature value

Follow-up of https://github.com/rust-lang/rust/pull/65656

It fixes the bad handling of the default value of the feature (which would disable shortcut by default, which is bad!).

r? @Dylan-DPC
cc @kinnison

4 years agoRollup merge of #65731 - fusion-engineering-forks:set-extension, r=dtolnay
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:50 +0000 (13:12 +0200)]
Rollup merge of #65731 - fusion-engineering-forks:set-extension, r=dtolnay

Prevent unnecessary allocation in PathBuf::set_extension.

It was allocating a new `OsString` that was immediately dropped after using it with `set_file_name`. Now it directly changes the extension in the original buffer, without touching the rest of the file name or allocating a temporary string.

4 years agoRollup merge of #65685 - oxalica:statx-eperm, r=alexcrichton
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:48 +0000 (13:12 +0200)]
Rollup merge of #65685 - oxalica:statx-eperm, r=alexcrichton

Fix check of `statx` and handle EPERM

Should fix #65662

https://github.com/rust-lang/rust/issues/65662#issuecomment-544593939
> I think a reasonable solution might be to do something like try to stat AT_CWD initially and if that fails with EPERM or ENOSYS we disable the syscall entirely, otherwise it's cached as always good to use.

r? @alexcrichton

4 years agoRollup merge of #65315 - spastorino:intern-place-projection, r=oli-obk
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:46 +0000 (13:12 +0200)]
Rollup merge of #65315 - spastorino:intern-place-projection, r=oli-obk

Intern place projection

This should sit on top of https://github.com/rust-lang/rust/pull/65197. After that one merged, I'm gonna rebase on top of it.

The important commits are the last three and there's a bunch of code repetition that I'm going to remove but for that I need to refactor some things that probably need to be added before this PR.

Anyway this work helps as is because we can run perf tests :).

r? @oli-obk /cc @nikomatsakis