]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoremove `_with_applicability` from suggestion fns
Andy Russell [Fri, 25 Jan 2019 21:03:27 +0000 (16:03 -0500)]
remove `_with_applicability` from suggestion fns

5 years agodocument `Applicability`
Andy Russell [Fri, 25 Jan 2019 19:56:27 +0000 (14:56 -0500)]
document `Applicability`

5 years agoAuto merge of #57871 - Mark-Simulacrum:fix-compiletest-stamp, r=oli-obk
bors [Sun, 27 Jan 2019 00:07:53 +0000 (00:07 +0000)]
Auto merge of #57871 - Mark-Simulacrum:fix-compiletest-stamp, r=oli-obk

Correctly set filetime for copied LLVM

This also makes compiletest no longer always retest everything.

Fixes #57864

5 years agoAuto merge of #57918 - Centril:rollup, r=Centril
bors [Sat, 26 Jan 2019 18:14:46 +0000 (18:14 +0000)]
Auto merge of #57918 - Centril:rollup, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #57407 (Stabilize extern_crate_self)
 - #57703 (Make MutexGuard's Debug implementation more useful.)
 - #57764 (Fix some minor warnings)
 - #57825 (un-deprecate mem::zeroed)
 - #57827 (Ignore aarch64 in simd-intrinsic-generic-reduction)
 - #57908 (resolve: Fix span arithmetics in the import conflict error)
 - #57913 (Change crate-visibility-modifier issue number in The Unstable Book)

Failed merges:

r? @ghost

5 years agoRollup merge of #57913 - h-michael:fix-crate-visibility-modifier-issue-number, r...
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:49 +0000 (18:21 +0100)]
Rollup merge of #57913 - h-michael:fix-crate-visibility-modifier-issue-number, r=Centril

Change crate-visibility-modifier issue number in The Unstable Book

#45388 is closed.
Because, it's duplicate issue of #53120.

5 years agoRollup merge of #57908 - petrochenkov:errepice, r=estebank
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:47 +0000 (18:21 +0100)]
Rollup merge of #57908 - petrochenkov:errepice, r=estebank

resolve: Fix span arithmetics in the import conflict error

https://github.com/rust-lang/rust/pull/56937 rebased and fixed

Fixes https://github.com/rust-lang/rust/issues/56411
Fixes https://github.com/rust-lang/rust/issues/57071
Fixes https://github.com/rust-lang/rust/issues/57787

r? @estebank

5 years agoRollup merge of #57827 - parched:ignore, r=nikomatsakis
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:46 +0000 (18:21 +0100)]
Rollup merge of #57827 - parched:ignore, r=nikomatsakis

Ignore aarch64 in simd-intrinsic-generic-reduction

This fails on AArch64 see https://github.com/rust-lang/rust/issues/54510

Disabling it for now until it's fixed/implemented in LLVM

cc @gnzlbg

5 years agoRollup merge of #57825 - RalfJung:zeroed, r=nikomatsakis
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:45 +0000 (18:21 +0100)]
Rollup merge of #57825 - RalfJung:zeroed, r=nikomatsakis

un-deprecate mem::zeroed

as per the discussion around <https://github.com/rust-lang/rust/issues/53491#issuecomment-451454793>

5 years agoRollup merge of #57764 - Xanewok:tiny-tweaks, r=nikomatsakis
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:44 +0000 (18:21 +0100)]
Rollup merge of #57764 - Xanewok:tiny-tweaks, r=nikomatsakis

Fix some minor warnings

Since apparently RLS works when initialized in the root repository (:tada:) I decided to fix some of the issues it caught.

There are a lot of unused attribute warnings left on `rustc_on_unimplemented` and `rustc_layout_scalar_valid_range_start` but I imagine we can't do much about it due to 2-stage compilation?

5 years agoRollup merge of #57703 - m-ou-se:mutexguard-debug, r=cramertj
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:42 +0000 (18:21 +0100)]
Rollup merge of #57703 - m-ou-se:mutexguard-debug, r=cramertj

Make MutexGuard's Debug implementation more useful.

Fixes #57702.

5 years agoRollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=Centril
Mazdak Farrokhzad [Sat, 26 Jan 2019 17:21:41 +0000 (18:21 +0100)]
Rollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=Centril

Stabilize extern_crate_self

Fixes #56409

5 years agoAuto merge of #57852 - davidtwco:issue-57819, r=estebank
bors [Sat, 26 Jan 2019 15:33:43 +0000 (15:33 +0000)]
Auto merge of #57852 - davidtwco:issue-57819, r=estebank

Suggest removing leading left angle brackets.

Fixes #57819.

This PR adds errors and accompanying suggestions as below:

```
bar::<<<<<T as Foo>::Output>();
     ^^^ help: remove extra angle brackets
```

r? @estebank

5 years agoAuto merge of #57726 - Zoxc:combine-early-lints, r=estebank
bors [Sat, 26 Jan 2019 12:21:03 +0000 (12:21 +0000)]
Auto merge of #57726 - Zoxc:combine-early-lints, r=estebank

Combine all builtin early lints

This also adds a -Z no-interleave-lints option to allow benchmarking lints.

r? @estebank

5 years agoAuto merge of #57425 - alexcrichton:stabilize-atomics, r=sfackler
bors [Sat, 26 Jan 2019 09:46:10 +0000 (09:46 +0000)]
Auto merge of #57425 - alexcrichton:stabilize-atomics, r=sfackler

std: Stabilize fixed-width integer atomics

This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the
`std::sync::atomic` and `core::sync::atomic` modules. Proposed in #56753
and tracked in #32976 this feature has been unstable for quite some time
and is hopefully ready to go over the finish line now!

The API is being stabilized as-is. The API of `AtomicU8` and friends
mirrors that of `AtomicUsize`. A list of changes made here are:

* A portability documentation section has been added to describe the
  current state of affairs.
* Emulation of smaller-size atomics with larger-size atomics has been
  documented.
* As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation
  across the board in 1.34.0 now that `const` functions can be invoked
  in statics.

Note that the 128-bit atomic types are omitted from this stabilization
explicitly. They have far less platform support than the other atomic
types, and will likely require further discussion about their best
location.

Closes #32976
Closes #56753

5 years agoAuto merge of #55641 - nagisa:optimize-attr, r=pnkfelix
bors [Sat, 26 Jan 2019 07:08:18 +0000 (07:08 +0000)]
Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelix

Implement optimize(size) and optimize(speed) attributes

This PR implements both `optimize(size)` and `optimize(speed)` attributes.

While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example.

# TODO

* [x] Improve compiletest so that tests can be written;
* [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly);
* [ ] Perhaps reduce the duplication in LLVM attribute assignment code…

5 years agoChange crate-visibility-modifier issue number in The Unstable Book
Hirokazu Hata [Sat, 26 Jan 2019 06:50:05 +0000 (15:50 +0900)]
Change crate-visibility-modifier issue number in The Unstable Book

5 years agoAuto merge of #57675 - cuviper:llvm-monorepo, r=alexcrichton
bors [Sat, 26 Jan 2019 02:10:15 +0000 (02:10 +0000)]
Auto merge of #57675 - cuviper:llvm-monorepo, r=alexcrichton

Rebase to the llvm-project monorepo

The new git submodule src/llvm-project is a monorepo replacing src/llvm
and src/tools/{clang,lld,lldb}.  This also serves as a rebase for these
projects to the new 8.x branch from trunk.

The src/llvm-emscripten fork is unchanged for now.

r? @alexcrichton

5 years agoUpdate `dlmalloc` to 0.1.2
Alex Crichton [Fri, 25 Jan 2019 15:23:18 +0000 (07:23 -0800)]
Update `dlmalloc` to 0.1.2

Remove usage of an old and removed wasm intrinsic

5 years agoSet LLDB_NO_DEBUGSERVER=ON
Josh Stone [Fri, 25 Jan 2019 02:02:54 +0000 (18:02 -0800)]
Set LLDB_NO_DEBUGSERVER=ON

5 years ago[rust-lldb] Adapt to changes in LLDB APIs
Josh Stone [Thu, 24 Jan 2019 18:42:52 +0000 (10:42 -0800)]
[rust-lldb] Adapt to changes in LLDB APIs

5 years agolibrustc_llvm: default to libc++ for darwin
Josh Stone [Thu, 24 Jan 2019 00:17:24 +0000 (16:17 -0800)]
librustc_llvm: default to libc++ for darwin

5 years agoUpdate LLVM for a CodeView fix
Josh Stone [Wed, 23 Jan 2019 03:50:45 +0000 (19:50 -0800)]
Update LLVM for a CodeView fix

5 years agoSet the DICompileUnit emissionKind
Josh Stone [Tue, 22 Jan 2019 21:01:14 +0000 (13:01 -0800)]
Set the DICompileUnit emissionKind

5 years agoAdd two more wasm-related LLVM commits
Alex Crichton [Thu, 17 Jan 2019 20:56:50 +0000 (12:56 -0800)]
Add two more wasm-related LLVM commits

5 years agoRebase to the llvm-project monorepo
Josh Stone [Wed, 16 Jan 2019 17:59:03 +0000 (09:59 -0800)]
Rebase to the llvm-project monorepo

The new git submodule src/llvm-project is a monorepo replacing src/llvm
and src/tools/{clang,lld,lldb}.  This also serves as a rebase for these
projects to the new 8.x branch from trunk.

The src/llvm-emscripten fork is unchanged for now.

5 years agoAuto merge of #57898 - Centril:rollup, r=Centril
bors [Fri, 25 Jan 2019 23:27:20 +0000 (23:27 +0000)]
Auto merge of #57898 - Centril:rollup, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #56233 (Miri and miri-related code contains repetitions of `(n << amt) >> amt`)
 - #57645 (distinguish "no data" from "heterogeneous" in ABI)
 - #57734 (Fix evaluating trivial drop glue in constants)
 - #57886 (Add suggestion for moving type declaration before associated type bindings in generic arguments.)
 - #57890 (Fix wording in diagnostics page)

Failed merges:

r? @ghost

5 years agoAddress review comments and cleanup code
Vadim Petrochenkov [Fri, 25 Jan 2019 21:36:50 +0000 (00:36 +0300)]
Address review comments and cleanup code

5 years agoCorrectly set filetime for copied LLVM
Mark Rousskov [Thu, 24 Jan 2019 00:34:43 +0000 (17:34 -0700)]
Correctly set filetime for copied LLVM

This also makes compiletest no longer always retest everything.

5 years agoAuto merge of #57435 - Dylan-DPC:fi/compiler-builtins-lock, r=alexcrichton
bors [Fri, 25 Jan 2019 20:30:43 +0000 (20:30 +0000)]
Auto merge of #57435 - Dylan-DPC:fi/compiler-builtins-lock, r=alexcrichton

Update Cargo.lock to use the latest `compiler_builtins`

A very tiny PR per the request of @alexcrichton : rust-lang-nursery/compiler-builtins#267 (comment)

Rewrite of #57414

cc @Lokathor

r? @alexcrichton

5 years agostd: Stabilize fixed-width integer atomics
Alex Crichton [Mon, 7 Jan 2019 20:41:55 +0000 (12:41 -0800)]
std: Stabilize fixed-width integer atomics

This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the
`std::sync::atomic` and `core::sync::atomic` modules. Proposed in #56753
and tracked in #32976 this feature has been unstable for quite some time
and is hopefully ready to go over the finish line now!

The API is being stabilized as-is. The API of `AtomicU8` and friends
mirrors that of `AtomicUsize`. A list of changes made here are:

* A portability documentation section has been added to describe the
  current state of affairs.
* Emulation of smaller-size atomics with larger-size atomics has been
  documented.
* As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation
  across the board in 1.34.0 now that `const` functions can be invoked
  in statics.

Note that the 128-bit atomic types are omitted from this stabilization
explicitly. They have far less platform support than the other atomic
types, and will likely require further discussion about their best
location.

Closes #32976
Closes #56753

5 years ago#56411 do not suggest a fix for a import conflict in a macro
François Mockers [Tue, 18 Dec 2018 01:22:08 +0000 (02:22 +0100)]
#56411 do not suggest a fix for a import conflict in a macro

5 years agoResolve breakage
Simonas Kazlauskas [Fri, 18 Jan 2019 22:37:52 +0000 (00:37 +0200)]
Resolve breakage

5 years agoRollup merge of #57890 - feinorgh:fix-diagnostics-typo, r=zackmdavis
Mazdak Farrokhzad [Fri, 25 Jan 2019 15:59:31 +0000 (16:59 +0100)]
Rollup merge of #57890 - feinorgh:fix-diagnostics-typo, r=zackmdavis

Fix wording in diagnostics page

Fix a tiny wording error in the diagnostics text for E0070.

5 years agoRollup merge of #57886 - davidtwco:issue-57385, r=estebank
Mazdak Farrokhzad [Fri, 25 Jan 2019 15:59:29 +0000 (16:59 +0100)]
Rollup merge of #57886 - davidtwco:issue-57385, r=estebank

Add suggestion for moving type declaration before associated type bindings in generic arguments.

Fixes #57385.

r? @estebank

5 years agoRollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelix
Mazdak Farrokhzad [Fri, 25 Jan 2019 15:59:27 +0000 (16:59 +0100)]
Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelix

Fix evaluating trivial drop glue in constants

```rust
struct A;
impl Drop for A {
    fn drop(&mut self) {}
}

const FOO: Option<A> = None;

const BAR: () = (FOO, ()).1;
```

was erroring with

```
error: any use of this value will cause an error
 --> src/lib.rs:9:1
  |
9 | const BAR: () = (FOO, ()).1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^
  |                           |
  |                           calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))`
  |
  = note: #[deny(const_err)] on by default

error: aborting due to previous error
```

before this PR. According to godbolt this last compiled successfully in 1.27

5 years agoRollup merge of #57645 - nikomatsakis:issue-56877-abi-aggregates, r=eddyb
Mazdak Farrokhzad [Fri, 25 Jan 2019 15:59:26 +0000 (16:59 +0100)]
Rollup merge of #57645 - nikomatsakis:issue-56877-abi-aggregates, r=eddyb

distinguish "no data" from "heterogeneous" in ABI

Ignore zero-sized types when computing whether something is a homogeneous aggregate, except be careful of VLA.

cc #56877

r? @arielb1
cc @eddyb

5 years agoRollup merge of #56233 - kenta7777:kenta7777#49937, r=oli-obk
Mazdak Farrokhzad [Fri, 25 Jan 2019 15:59:25 +0000 (16:59 +0100)]
Rollup merge of #56233 - kenta7777:kenta7777#49937, r=oli-obk

Miri and miri-related code contains repetitions of `(n << amt) >> amt`

I reduced some code repetitions contains `(n << amt) >> amt`.
This pull request is related to #49937.

5 years agodistinguish "no data" from "heterogeneous" for ABI purposes
Niko Matsakis [Wed, 9 Jan 2019 20:16:32 +0000 (15:16 -0500)]
distinguish "no data" from "heterogeneous" for ABI purposes

Also, add a testing infrastructure and tests that lets us dump layout.

5 years agoAuto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix
bors [Fri, 25 Jan 2019 14:25:37 +0000 (14:25 +0000)]
Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix

[NLL] Clean up handling of type annotations

* Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free.
* Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943)
* Use the inferred type to allow infallible handling of user type projections (#57531)
* Uses revisions for the tests in #56993
* Check the types of `Unevaluated` constants with no annotations (#46702)
* Some drive-by cleanup

Closes #46702
Closes #54943
Closes #57531
Closes #57731
cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment

r? @nikomatsakis

5 years agoUnit test from #57866.
Felix S. Klock II [Fri, 25 Jan 2019 14:19:37 +0000 (15:19 +0100)]
Unit test from #57866.

5 years agoAuto merge of #57891 - michaelwoerister:no-default-incr-bootstrap, r=pietroalbini
bors [Fri, 25 Jan 2019 11:25:14 +0000 (11:25 +0000)]
Auto merge of #57891 - michaelwoerister:no-default-incr-bootstrap, r=pietroalbini

bootstrap: Don't rely on any default settings regarding incr. comp. in Cargo

https://github.com/rust-lang/cargo/pull/6564 (temporarily) makes incremental compilation the default for release builds. We don't want this default to apply to building the compiler itself, that is, `bootstrap`'s `incremental` flag should always be respected. Otherwise we'll get incrementally build releases, which we really don't want `:)`.

r? @Mark-Simulacrum

Anybody else from @rust-lang/release should feel free to r+ this too if they get around to it earlier.

5 years agoCombining move lifetime and type suggestions.
David Wood [Thu, 24 Jan 2019 23:36:28 +0000 (00:36 +0100)]
Combining move lifetime and type suggestions.

This commit combines the move lifetime and move type suggestions so that
when rustfix applies them they don't conflict with each other.

5 years agobootstrap: Don't rely on any default settings regarding incr. comp. in Cargo.
Michael Woerister [Fri, 25 Jan 2019 10:23:08 +0000 (11:23 +0100)]
bootstrap: Don't rely on any default settings regarding incr. comp. in Cargo.

5 years agoSuggestion moving types before associated types.
David Wood [Thu, 24 Jan 2019 22:24:58 +0000 (23:24 +0100)]
Suggestion moving types before associated types.

This commit extends existing suggestions to move lifetimes before types
in generic arguments to also suggest moving types behind associated type
bindings.

5 years agoAdd a compile-fail test for `Drop` in constants in the presence of `Option`s
Oliver Scherer [Wed, 23 Jan 2019 15:21:33 +0000 (16:21 +0100)]
Add a compile-fail test for `Drop` in constants in the presence of `Option`s

5 years agoAuto merge of #57881 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
bors [Fri, 25 Jan 2019 08:34:53 +0000 (08:34 +0000)]
Auto merge of #57881 - matthiaskrgr:clippy_submodule_upd, r=oli-obk

submodules: update clippy from 280069dd to f1753522

Changes:
````
Rustup
allow assertions_on_constants for collapsible_if and missing_test_files
Improving comments.
Added rustfix to the test.
Improve span shortening.
Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool".
Fixed potential mistakes with nesting. Added tests.
Fix automatic suggestion on `use_self`.
run ./util/dev update_lints
add assert(true/false, some message) tests
change assert_checks to assertions_on_constants
run ./util/dev update_lints
Add unreachable!() as option
Add assert(true) and assert(false) lints
````

Fixes clippy toolstate

r? @oli-obk

5 years agoFix wording in diagnostics page
Pär Karlsson [Fri, 25 Jan 2019 07:43:56 +0000 (08:43 +0100)]
Fix wording in diagnostics page

5 years agolock after rebase
dylan_DPC [Thu, 17 Jan 2019 10:22:48 +0000 (15:52 +0530)]
lock after rebase

5 years agofix lock after running build
dylan_DPC [Tue, 8 Jan 2019 07:01:50 +0000 (12:31 +0530)]
fix lock after running build

5 years agoThe file should be fully consistent now.
Lokathor [Mon, 7 Jan 2019 19:14:59 +0000 (12:14 -0700)]
The file should be fully consistent now.

5 years agoUpdate Cargo.lock to use the latest `compiler_builtins`
Lokathor [Mon, 7 Jan 2019 19:52:05 +0000 (14:52 -0500)]
Update Cargo.lock to use the latest `compiler_builtins`

5 years agoAuto merge of #57888 - Centril:rollup, r=Centril
bors [Fri, 25 Jan 2019 01:18:13 +0000 (01:18 +0000)]
Auto merge of #57888 - Centril:rollup, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #56217 (Add grammar in docs for {f32,f64}::from_str, mention known bug.)
 - #57294 (When using value after move, point at span of local)
 - #57652 (Update/remove some old readmes)
 - #57802 (Print visible name for types as well as modules.)
 - #57865 (Don't ICE when logging unusual types)

Failed merges:

r? @ghost

5 years agoRollup merge of #57865 - Aaron1011:fix/debug-ice, r=estebank
Mazdak Farrokhzad [Fri, 25 Jan 2019 00:37:03 +0000 (01:37 +0100)]
Rollup merge of #57865 - Aaron1011:fix/debug-ice, r=estebank

Don't ICE when logging unusual types

MonoItemExt#to_string is used for both debug logging and LLVM symbol
name generation. When debugging, we want to print out any type we
encounter, even if it's something weird like GeneratorWitness. However,
during codegen, we still want to error if we encounter an unexpected
type when generating a name.

To resolve this issue, this commit introduces a new 'debug' parameter to
the relevant methods. When set to 'true', it allows any type to be
printed - when set to 'false', it 'bug!'s when encountering an
unexpected type.

This prevents an ICE when enabling debug logging (via RUST_LOG) while
running rustc on generator-related code.

5 years agoRollup merge of #57802 - davidtwco:issue-56943, r=estebank
Mazdak Farrokhzad [Fri, 25 Jan 2019 00:37:02 +0000 (01:37 +0100)]
Rollup merge of #57802 - davidtwco:issue-56943, r=estebank

Print visible name for types as well as modules.

Fixes #56943 and fixes #57713.

This commit extends previous work in #55007 where the name from the
visible parent was used for modules. Now, we also print the name from
the visible parent for types.

r? @estebank

5 years agoRollup merge of #57652 - mark-i-m:remove-old, r=nikomatsakis
Mazdak Farrokhzad [Fri, 25 Jan 2019 00:37:00 +0000 (01:37 +0100)]
Rollup merge of #57652 - mark-i-m:remove-old, r=nikomatsakis

Update/remove some old readmes

r? @nikomatsakis

cc #48478

There are a bunch of READMEs with content that I would like to see a final decision made on:
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
- https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve
- https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/borrowck

It's not clear how useful or obsolete any of these are. I would really appreciate if the appropriate domain experts for each of these could respond with one of (a) delete it, (b) wait for system to be remove, or (c) move it to rustc-guide. @nikomatsakis do you know who to ping for any of these (sorry, I suspect many of them are you)?

5 years agoRollup merge of #57294 - estebank:point-copy-less, r=nikomatsakis
Mazdak Farrokhzad [Fri, 25 Jan 2019 00:36:59 +0000 (01:36 +0100)]
Rollup merge of #57294 - estebank:point-copy-less, r=nikomatsakis

When using value after move, point at span of local

When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.

```
error[E0382]: use of moved value: `x`
  --> $DIR/issue-34721.rs:27:9
   |
LL |     pub fn baz<T: Foo>(x: T) -> T {
   |                -       - move occurs because `x` has type `T`, which does not implement the `Copy` trait
   |                |
   |                consider adding a `Copy` constraint to this type argument
LL |         if 0 == 1 {
LL |             bar::bar(x.zero())
   |                      - value moved here
LL |         } else {
LL |             x.zero()
   |             - value moved here
LL |         };
LL |         x.zero()
   |         ^ value used here after move
```

Fix #34721.

5 years agoRollup merge of #56217 - frewsxcv:frewsxcv-float-parse, r=QuietMisdreavus
Mazdak Farrokhzad [Fri, 25 Jan 2019 00:36:57 +0000 (01:36 +0100)]
Rollup merge of #56217 - frewsxcv:frewsxcv-float-parse, r=QuietMisdreavus

Add grammar in docs for {f32,f64}::from_str, mention known bug.

- Original bug about documenting grammar
  - https://github.com/rust-lang/rust/issues/32243
- Known bug with parsing
  - https://github.com/rust-lang/rust/issues/31407

5 years agosubmodules: update clippy from 280069dd to f1753522
Matthias Krüger [Thu, 24 Jan 2019 21:25:13 +0000 (22:25 +0100)]
submodules: update clippy from 280069dd to f1753522

Changes:
````
Rustup
allow assertions_on_constants for collapsible_if and missing_test_files
Improving comments.
Added rustfix to the test.
Improve span shortening.
Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool".
Fixed potential mistakes with nesting. Added tests.
Fix automatic suggestion on `use_self`.
run ./util/dev update_lints
add assert(true/false, some message) tests
change assert_checks to assertions_on_constants
run ./util/dev update_lints
Add unreachable!() as option
Add assert(true) and assert(false) lints
````

5 years agoAuto merge of #57879 - Centril:rollup, r=Centril
bors [Thu, 24 Jan 2019 21:23:11 +0000 (21:23 +0000)]
Auto merge of #57879 - Centril:rollup, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #57380 (Fix Instant/Duration math precision & associativity on Windows)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57803 (Several changes to libunwind for SGX target)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost

5 years agoFix --compare-mode=nll tests
Esteban Küber [Thu, 24 Jan 2019 18:53:43 +0000 (10:53 -0800)]
Fix --compare-mode=nll tests

5 years agoreview comments
Esteban Küber [Fri, 18 Jan 2019 23:47:25 +0000 (15:47 -0800)]
review comments

5 years agoPoint at type argument suggesting adding `Copy` constraint
Esteban Küber [Sun, 6 Jan 2019 23:23:30 +0000 (15:23 -0800)]
Point at type argument suggesting adding `Copy` constraint

5 years agobreak eagerly from loop
Esteban Küber [Fri, 4 Jan 2019 21:47:35 +0000 (13:47 -0800)]
break eagerly from loop

5 years agoAdd test for #34721
Esteban Küber [Thu, 3 Jan 2019 00:56:45 +0000 (16:56 -0800)]
Add test for #34721

5 years agoWhen using value after move, point at span of local
Esteban Küber [Thu, 3 Jan 2019 00:43:08 +0000 (16:43 -0800)]
When using value after move, point at span of local

When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.

5 years agoAdd a feature gate test for #[optimize]
Simonas Kazlauskas [Sun, 25 Nov 2018 17:56:10 +0000 (19:56 +0200)]
Add a feature gate test for #[optimize]

5 years agoSupport revisions for codegen tests
Simonas Kazlauskas [Sun, 18 Nov 2018 18:51:56 +0000 (20:51 +0200)]
Support revisions for codegen tests

`compile-flags: -Copt-level` will avoid adding -O. Similarly for -g and
-Cdebuglevel.

5 years agoAdd an idealistic test for optimize attribute
Simonas Kazlauskas [Sat, 3 Nov 2018 09:13:10 +0000 (11:13 +0200)]
Add an idealistic test for optimize attribute

Alas it does not currently work, because of limitations in compiletest…

5 years agoImplement optimize(size) and optimize(speed)
Simonas Kazlauskas [Sat, 27 Oct 2018 12:29:06 +0000 (15:29 +0300)]
Implement optimize(size) and optimize(speed)

5 years agoRollup merge of #57873 - milesand:master, r=Centril
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:52 +0000 (18:25 +0100)]
Rollup merge of #57873 - milesand:master, r=Centril

Stabilize no_panic_pow

This would close #48320.

I'm not sure if I've done this right, I've just changed attribute name to stable and set `since` to two minor versions above current stable since that seemed like what others were doing.

5 years agoRollup merge of #57867 - Aaron1011:fix/gen-future-doc, r=Centril
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:50 +0000 (18:25 +0100)]
Rollup merge of #57867 - Aaron1011:fix/gen-future-doc, r=Centril

Fix std::future::from_generator documentation

This function takes a generator and wraps it in a future, not
vice-versa.

5 years agoRollup merge of #57863 - davidtwco:issue-57684, r=estebank
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:49 +0000 (18:25 +0100)]
Rollup merge of #57863 - davidtwco:issue-57684, r=estebank

Add suggestion for incorrect field syntax.

Fixes #57684.

This commit adds a suggestion when a `=` character is used when
specifying the value of a field in a struct constructor incorrectly
instead of a `:` character.

r? @estebank

5 years agoRollup merge of #57861 - pepyakin:wasm-dont-export-table, r=alexcrichton
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:48 +0000 (18:25 +0100)]
Rollup merge of #57861 - pepyakin:wasm-dont-export-table, r=alexcrichton

Don't export table by default in wasm

Revert of https://github.com/rust-lang/rust/pull/53237
As per discussion here https://github.com/rustwasm/team/issues/251

5 years agoRollup merge of #57860 - jethrogb:jb/sgx-os-ffi, r=joshtriplett
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:47 +0000 (18:25 +0100)]
Rollup merge of #57860 - jethrogb:jb/sgx-os-ffi, r=joshtriplett

Add os::fortanix_sgx::ffi module

This uses the same byte slice accessors that Unix has. The [ABI specifies](https://docs.rs/fortanix-sgx-abi/0.3.2/fortanix_sgx_abi/struct.ByteBuffer.html) byte slices.

5 years agoRollup merge of #57846 - QuietMisdreavus:proc-macro-links, r=GuillaumeGomez
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:45 +0000 (18:25 +0100)]
Rollup merge of #57846 - QuietMisdreavus:proc-macro-links, r=GuillaumeGomez

rustdoc: fix ICE from loading proc-macro stubs

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

When trying to resolve a macro, rustdoc first tries to load it from the resolver to see whether it's a Macros 2.0 macro, so it can return that Def before looking for any other kind of macro. However, this becomes a problem when you try to load proc-macros: since you can't use a proc-macro inside its own crate, this lookup also fails when attempting to link to it.

However, we have a hint that this lookup will fail: Macros which are actually `ProcMacroStub`s will fail the lookup, so we can use that information to skip loading the macro. Rustdoc will then happily check `resolve.all_macros`, which will return a usable Def that we can link to.

5 years agoRollup merge of #57803 - jethrogb:jb/sgx-unwind-version, r=alexcrichton
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:44 +0000 (18:25 +0100)]
Rollup merge of #57803 - jethrogb:jb/sgx-unwind-version, r=alexcrichton

Several changes to libunwind for SGX target

Two fixes:
* #34978 bites again!
* __rust_alloc are actually private symbols. Add new public versions. Also, these ones are `extern "C"`.

Upstream changes (https://github.com/fortanix/llvm-project/pull/2, https://github.com/fortanix/llvm-project/pull/3):
b7357de Avoid too new relocation types being emitted
0feefe5 Use new symbol names to call Rust allocator

Fixes https://github.com/fortanix/rust-sgx/issues/65

5 years agoRollup merge of #57606 - oli-obk:shrink, r=RalfJung
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:43 +0000 (18:25 +0100)]
Rollup merge of #57606 - oli-obk:shrink, r=RalfJung

Get rid of the fake stack frame for reading from constants

r? @RalfJung

fixes the ice in https://github.com/rust-lang/rust/issues/53708 but still keeps around the wrong "non-exhaustive match" error

cc @varkor

5 years agoRollup merge of #57380 - bearcage:master, r=alexcrichton
Mazdak Farrokhzad [Thu, 24 Jan 2019 17:25:41 +0000 (18:25 +0100)]
Rollup merge of #57380 - bearcage:master, r=alexcrichton

Fix Instant/Duration math precision & associativity on Windows

**tl;dr** Addition and subtraction on Duration/Instant are not associative on windows because we use the perfcounter frequency in every calculation instead of just when we measure time.

This is my first contrib (PR or Issue) to Rust, so please lmk if I've done this wrong. I followed CONTRIBUTING to the extent I could given my system doesn't seem to be able to build the compiler with changes in the source tree. I also asked about this issue in #rust-beginners a week or so ago, before digging through libstd -- I'm unsure if there's a good way to follow up on that, but I'd be happy to update the docs on the timing structs if this fixes the problem.

## Issue

The `Duration` type keeps seconds in the upper-64 and nanoseconds in the lower-32 bits. In theory doing math on these ought to be basically the same as doing math on any other 64 or 32 bit integral number.

On windows (and I think macos too), however, our math gets messy because the Instant type stores the current point in time in units of HPET Performance Counter counts, not nanoseconds, and does unit conversions on every math operation, rather than just when we measure the time from the system clock.

I tried this code:

```
use std::time::{Duration, Instant};

fn main() {
    let now = Instant::now();
    let offset = Duration::from_millis(5);
    assert_eq!((now + offset) - now, (now - now) + offset);
}
```

On UNIX machines (linux and macos) it behaves as you'd expect -- [no crash](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cf2206c0b7e07d8ecc7767a512364094).

On Windows hosts, however, it blows up because of a precision problem in the Instant +/- Duration math:

```
C:\Users\aberg\work\timetest (master -> origin)
λ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target\debug\timetest.exe`
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `4.999914ms`,
 right: `5ms`', src\main.rs:6:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: process didn't exit successfully: `target\debug\timetest.exe` (exit code: 101)

C:\Users\aberg\work\timetest (master -> origin)
λ cat src\main.rs
use std::time::{Duration, Instant};

fn main() {
    let now = Instant::now();
    let offset = Duration::from_millis(5);
    assert_eq!((now + offset) - now, (now - now) + offset);
}
```

On windows I think this is a consequence of doing the HPET-PerfCounter-Unit conversion on each math operation. I suspect the reason it works on macs is that (from what I could find online) most apple machines report timing in nanoseconds anyway. For anyone interested, the equivalent functions on macos, with a little work to fish out the numerator/denominator from a timebase struct:

* `QueryPerformanceCounter()` -> `mach_absolute_time()`
* `QueryPerformanceFrequency()` -> `mach_timebase_info()`

If this PR ends up working as I expect it to when CI runs the tests, I can make the same changes to the macos implementation.

## Potential Fix

We ought to be able to sort this out by storing nanoseconds, rather than PerfCounter units, that way intermediate math is done in the most precise units we support and we're only doing unit conversions when we actually measure the system clock (and it might even translate to a small perf gain for people doing tons of Instant/Duration math).

I believe this will address the underlying cause of #56034, and make the guessed epsilon constant from #56059 unnecessary. If it's of interest, I can write up how these timing types work on the tier 1 platforms to address #32626 as well, since I'm already in here figuring it out.

## This Patch

To that end, I've got this patch, which I think should fix it on windows, but I'm having trouble testing it -- any time I change anything in libstd I start getting this error, which no amount of clean building seems to resolve:

```
C:\Users\aberg\work\rust (master -> origin)
λ python x.py test --stage 0 --no-doc src/libstd
Updating only changed submodules
Submodules updated in 0.27 seconds
    Finished dev [unoptimized] target(s) in 2.41s
Building stage0 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
    Finished release [optimized] target(s) in 6.78s
Copying stage0 std from stage0 (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc / x86_64-pc-windows-msvc)
Building stage0 test artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
   Compiling test v0.0.0 (C:\Users\aberg\work\rust\src\libtest)
error[E0460]: found possibly newer version of crate `std` which `getopts` depends on
  --> src\libtest\lib.rs:36:1
   |
36 | extern crate getopts;
   | ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `std`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-sysroot\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-d7a80ca2ae113c97.rlib
           crate `std`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-sysroot\lib\rustlib\x86_64-pc-windows-msvc\lib\std-d7a80ca2ae113c97.dll
           crate `getopts`: \\?\C:\Users\aberg\work\rust\build\x86_64-pc-windows-msvc\stage0-test\x86_64-pc-windows-msvc\release\deps\libgetopts-ae40a96de5f5d144.rlib

error: aborting due to previous error

For more information about this error, try `rustc --explain E0460`.
error: Could not compile `test`.

To learn more, run the command again with --verbose.
command did not execute successfully: "C:\\Users\\aberg\\work\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\cargo.exe" "build" "--target" "x86_64-pc-windows-msvc" "-j" "12" "--release" "--manifest-path" "C:\\Users\\aberg\\work\\rust\\src/libtest/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
failed to run: C:\Users\aberg\work\rust\build\bootstrap\debug\bootstrap test --stage 0 --no-doc src/libstd
Build completed unsuccessfully in 0:00:20
```

---

Since you wrote the linked PRs and might remember looking at related problems:

r? @alexcrichton

5 years agoAuto merge of #51285 - Mark-Simulacrum:remove-quote_apis, r=Manishearth
bors [Thu, 24 Jan 2019 15:48:46 +0000 (15:48 +0000)]
Auto merge of #51285 - Mark-Simulacrum:remove-quote_apis, r=Manishearth

Remove quote_*! macros

This deletes a considerable amount of test cases, some of which we may want to keep. I'm not entirely certain what the primary intent of many of them was; if we should keep them I can attempt to edit each case to continue compiling without the quote_*! macros involved.

Fixes #46849.
Fixes #12265.
Fixes #12266.
Fixes #26994.

r? @Manishearth

5 years agoRemove quote_*! macros and associated APIs
Mark Simulacrum [Fri, 1 Jun 2018 22:40:33 +0000 (16:40 -0600)]
Remove quote_*! macros and associated APIs

5 years agoAuto merge of #57269 - gnzlbg:simd_bitmask, r=rkruppe
bors [Thu, 24 Jan 2019 13:11:06 +0000 (13:11 +0000)]
Auto merge of #57269 - gnzlbg:simd_bitmask, r=rkruppe

Add intrinsic to create an integer bitmask from a vector mask

This PR adds a new simd intrinsic: `simd_bitmask(vector) -> unsigned integer` that creates an integer bitmask from a vector mask by extracting one bit of each vector lane.

This is required to implement: https://github.com/rust-lang-nursery/packed_simd/issues/166 .

EDIT: the reason we need an intrinsics for this is that we have to truncate the vector lanes to an `<i1 x N>` vector, and then bitcast that to an `iN` integer (while making sure that we only materialize `i8`, ... , `i64` - that is, no `i1`, `i2`, `i4`, types), and we can't do any of that in a Rust library.

r? @rkruppe

5 years agoAuto merge of #57066 - Zoxc:graph-race, r=michaelwoerister
bors [Thu, 24 Jan 2019 10:20:12 +0000 (10:20 +0000)]
Auto merge of #57066 - Zoxc:graph-race, r=michaelwoerister

Fix race condition when emitting stored diagnostics

r? @michaelwoerister

5 years agoStabilize no_panic_pow
Jewoo Lee [Thu, 24 Jan 2019 04:38:46 +0000 (13:38 +0900)]
Stabilize no_panic_pow

5 years agoAdd a comment on the meaning of Instant t: Duration
Alex Berghage [Thu, 24 Jan 2019 04:36:38 +0000 (21:36 -0700)]
Add a comment on the meaning of Instant t: Duration

5 years agoAuto merge of #57869 - Centril:rollup, r=Centril
bors [Thu, 24 Jan 2019 01:24:13 +0000 (01:24 +0000)]
Auto merge of #57869 - Centril:rollup, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)
 - #57836 (Fix some cross crate existential type ICEs)
 - #57840 (Fix issue 57762)
 - #57844 (use port 80 for retrieving GPG key)
 - #57858 (Ignore line ending on older git versions)

Failed merges:

r? @ghost

5 years agoRollup merge of #57858 - pietroalbini:ignore-eol-images, r=GuillaumeGomez
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:20:03 +0000 (00:20 +0100)]
Rollup merge of #57858 - pietroalbini:ignore-eol-images, r=GuillaumeGomez

Ignore line ending on older git versions

On Ubuntu 16.04 git 2.7.4 tries to fix the line ending of `.png` and `.ico` files, and obviously it ruins them. This PR adds an attribute to those files to ignore which line ending they use.

r? @GuillaumeGomez

5 years agoRollup merge of #57844 - euclio:keyserver-port, r=alexcrichton
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:20:02 +0000 (00:20 +0100)]
Rollup merge of #57844 - euclio:keyserver-port, r=alexcrichton

use port 80 for retrieving GPG key

This works around firewalls blocking port 11371.

See https://unix.stackexchange.com/questions/75892/keyserver-timed-out-when-trying-to-add-a-gpg-public-key.

5 years agoRollup merge of #57840 - tromey:fix-issue-57762, r=nikic
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:20:00 +0000 (00:20 +0100)]
Rollup merge of #57840 - tromey:fix-issue-57762, r=nikic

Fix issue 57762

against a stock LLVM 7.  LLVM 7 was released without a necessary fix
for a bug in the DWARF discriminant code.

This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7.

Closes #57762

5 years agoRollup merge of #57836 - oli-obk:existential_crisis, r=estebank
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:59 +0000 (00:19 +0100)]
Rollup merge of #57836 - oli-obk:existential_crisis, r=estebank

Fix some cross crate existential type ICEs

fixes #53443

5 years agoRollup merge of #57834 - SimonSapin:type_id, r=Centril
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:58 +0000 (00:19 +0100)]
Rollup merge of #57834 - SimonSapin:type_id, r=Centril

Stabilize Any::get_type_id and rename to type_id

FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749

Closes https://github.com/rust-lang/rust/issues/27745.

5 years agoRollup merge of #57817 - davidtwco:issue-54521, r=estebank
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:57 +0000 (00:19 +0100)]
Rollup merge of #57817 - davidtwco:issue-54521, r=estebank

Add error for trailing angle brackets.

Fixes #54521.

This PR adds a error (and accompanying machine applicable
suggestion) for trailing angle brackets on function calls with a
turbofish.

r? @estebank

5 years agoRollup merge of #57795 - estebank:did-you-mean, r=zackmdavis
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:55 +0000 (00:19 +0100)]
Rollup merge of #57795 - estebank:did-you-mean, r=zackmdavis

Use structured suggestion in stead of notes

5 years agoRollup merge of #57793 - estebank:impl-trait-resolve, r=oli-obk
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:54 +0000 (00:19 +0100)]
Rollup merge of #57793 - estebank:impl-trait-resolve, r=oli-obk

Explain type mismatch cause pointing to return type when it is `impl Trait`

Fix #57743.

5 years agoRollup merge of #57779 - estebank:recover-struct-fields, r=davidtwco
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:53 +0000 (00:19 +0100)]
Rollup merge of #57779 - estebank:recover-struct-fields, r=davidtwco

Recover from parse errors in literal struct fields and incorrect float literals

Fix #52496.

5 years agoRollup merge of #57730 - Zoxc:combined-ast-validator, r=cramertj
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:52 +0000 (00:19 +0100)]
Rollup merge of #57730 - Zoxc:combined-ast-validator, r=cramertj

Merge visitors in AST validation

Cuts runtime for AST validation on `syntex_syntax` from 31.5 ms to 17 ms.

5 years agoRollup merge of #57179 - Xaeroxe:patch-1, r=QuietMisdreavus
Mazdak Farrokhzad [Wed, 23 Jan 2019 23:19:50 +0000 (00:19 +0100)]
Rollup merge of #57179 - Xaeroxe:patch-1, r=QuietMisdreavus

Update std/lib.rs docs to reflect Rust 2018 usage

Fixes #56544

This paragraph was written for Rust 2015.  Since 2018 has been stable for a while I think we can update it.

5 years agoAdd suggestion for incorrect field syntax.
David Wood [Wed, 23 Jan 2019 15:42:23 +0000 (16:42 +0100)]
Add suggestion for incorrect field syntax.

This commit adds a suggestion when a `=` character is used when
specifying the value of a field in a struct constructor incorrectly
instead of a `:` character.

5 years agoFix std::future::from_generator documentation
Aaron Hill [Wed, 23 Jan 2019 22:39:26 +0000 (17:39 -0500)]
Fix std::future::from_generator documentation

This function takes a generator and wraps it in a future, not
vice-versa.

5 years agoDon't ICE when logging unusual types
Aaron Hill [Wed, 23 Jan 2019 21:32:59 +0000 (16:32 -0500)]
Don't ICE when logging unusual types

MonoItemExt#to_string is used for both debug logging and LLVM symbol
name generation. When debugging, we want to print out any type we
encounter, even if it's something weird like GeneratorWitness. However,
during codegen, we still want to error if we encounter an unexpected
type when generating a name.

To resolve this issue, this commit introduces a new 'debug' parameter to
the relevant methods. When set to 'true', it allows any type to be
printed - when set to 'false', it 'bug!'s when encountering an
unexpected type.

This prevents an ICE when enabling debug logging (via RUST_LOG) while
running rustc on generator-related code.

5 years agoOptimize snapshot usage.
David Wood [Wed, 23 Jan 2019 20:39:15 +0000 (21:39 +0100)]
Optimize snapshot usage.

This commit implements a suggestion from @estebank that optimizes the
use of snapshots.

Instead of creating a snapshot for each recursion in `parse_path_segment`
and then replacing `self` with them until the first invocation where if
leading angle brackets are detected, `self` is not replaced and instead the
snapshot is used to inform how parsing should continue.

Now, a snapshot is created in the first invocation that acts as a backup
of the parser state before any generic arguments are parsed (and
therefore, before recursion starts). This backup replaces `self` if after
all parsing of generic arguments has concluded we can determine that
there are leading angle brackets. Parsing can then proceed from the
backup state making use of the now known number of unmatched leading
angle brackets to recover.