]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoMinor refactoring.
Alexander Regueiro [Sun, 24 Jun 2018 23:08:36 +0000 (00:08 +0100)]
Minor refactoring.

6 years agoAdded incremental test for interlinking static references.
Alexander Regueiro [Mon, 4 Jun 2018 22:48:00 +0000 (23:48 +0100)]
Added incremental test for interlinking static references.

6 years agoAdded tests fo referring to statics by value in other statics.
Alexander Regueiro [Mon, 4 Jun 2018 17:38:59 +0000 (18:38 +0100)]
Added tests fo referring to statics by value in other statics.

6 years agoAdded tests for writing to static mut's in statics.
Alexander Regueiro [Sun, 3 Jun 2018 18:47:19 +0000 (19:47 +0100)]
Added tests for writing to static mut's in statics.

6 years agoFixed bug with miri const evaluation where allocation is recursively borrowed.
Alexander Regueiro [Wed, 30 May 2018 18:27:45 +0000 (19:27 +0100)]
Fixed bug with miri const evaluation where allocation is recursively borrowed.

6 years agoAdded miri error for evaluating foreign statics.
Alexander Regueiro [Tue, 29 May 2018 00:38:18 +0000 (01:38 +0100)]
Added miri error for evaluating foreign statics.

Updated tests accordingly.

6 years agoLoosened rules involving statics mentioning other statics.
Alexander Regueiro [Sun, 27 May 2018 16:07:23 +0000 (17:07 +0100)]
Loosened rules involving statics mentioning other statics.

Updated tests accordingly.

6 years agoAuto merge of #51849 - nikomatsakis:issue-51820-places-conflict, r=eddyb
bors [Sat, 30 Jun 2018 18:55:09 +0000 (18:55 +0000)]
Auto merge of #51849 - nikomatsakis:issue-51820-places-conflict, r=eddyb

optimize `places_conflict` to avoid complex vectors etc

Fixes #51820

6 years agoAuto merge of #51862 - estebank:lifetime-spans, r=nikomatsakis
bors [Sat, 30 Jun 2018 16:52:12 +0000 (16:52 +0000)]
Auto merge of #51862 - estebank:lifetime-spans, r=nikomatsakis

Point to lifetime spans on lifetime errors

6 years agoAuto merge of #51828 - kennytm:no-simd-swap-for-mac, r=alexcrichton
bors [Sat, 30 Jun 2018 14:00:24 +0000 (14:00 +0000)]
Auto merge of #51828 - kennytm:no-simd-swap-for-mac, r=alexcrichton

Do not allow LLVM to increase a TLS's alignment on macOS.

This addresses the various TLS segfault on macOS 10.10.

Fix #51794.
Fix #51758.
Fix #50867.
Fix #48866.
Fix #46355.
Fix #44056.

6 years agoDo not allow LLVM to increase a TLS's alignment on macOS.
kennytm [Wed, 27 Jun 2018 22:24:09 +0000 (06:24 +0800)]
Do not allow LLVM to increase a TLS's alignment on macOS.

6 years agoAuto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obk
bors [Sat, 30 Jun 2018 09:19:21 +0000 (09:19 +0000)]
Auto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obk

hygiene: Implement transparent marks and use them for call-site hygiene in proc-macros

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

6 years agoAuto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertj
bors [Sat, 30 Jun 2018 07:10:18 +0000 (07:10 +0000)]
Auto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertj

Lowering cleanups [1/N]

6 years agoAuto merge of #51178 - GabrielMajeri:os-str-compare, r=SimonSapin
bors [Sat, 30 Jun 2018 04:03:14 +0000 (04:03 +0000)]
Auto merge of #51178 - GabrielMajeri:os-str-compare, r=SimonSapin

Implement PartialEq between &str and OsString

This fixes #49854.

It allows equality comparison between `OsString` values and `str` references, such as `os_string == "something"`.

6 years agoAddress comments
Vadim Petrochenkov [Fri, 29 Jun 2018 22:53:17 +0000 (01:53 +0300)]
Address comments

6 years agoRestore the old behavior of `$crate` in nested `macro_rules`
Vadim Petrochenkov [Fri, 29 Jun 2018 00:45:47 +0000 (03:45 +0300)]
Restore the old behavior of `$crate` in nested `macro_rules`

`$crate` is not resolved at def-site of a macro, but rather at "transitive def-site"

6 years agoFortify dummy span checking
Vadim Petrochenkov [Sun, 24 Jun 2018 22:00:21 +0000 (01:00 +0300)]
Fortify dummy span checking

6 years agoproc-macro: Use transparent marks for call-site hygiene
Vadim Petrochenkov [Sun, 24 Jun 2018 17:02:24 +0000 (20:02 +0300)]
proc-macro: Use transparent marks for call-site hygiene

6 years agohygiene: Implement transparent marks
Vadim Petrochenkov [Sun, 24 Jun 2018 16:54:23 +0000 (19:54 +0300)]
hygiene: Implement transparent marks

6 years agoexpansion: Give names to some fields of `SyntaxExtension`
Vadim Petrochenkov [Sun, 24 Jun 2018 16:24:51 +0000 (19:24 +0300)]
expansion: Give names to some fields of `SyntaxExtension`

6 years agoresolve: Cleanup `resolve_crate_root`
Vadim Petrochenkov [Sun, 24 Jun 2018 16:12:00 +0000 (19:12 +0300)]
resolve: Cleanup `resolve_crate_root`

6 years agoAuto merge of #46720 - estebank:issue-46302, r=nikomatsakis
bors [Fri, 29 Jun 2018 20:22:03 +0000 (20:22 +0000)]
Auto merge of #46720 - estebank:issue-46302, r=nikomatsakis

Fix incorrect type mismatch label pointing at return type

CC #46302.

6 years agoFix incorrect type mismatch label pointing at return type
Esteban Küber [Thu, 14 Dec 2017 01:34:47 +0000 (17:34 -0800)]
Fix incorrect type mismatch label pointing at return type

6 years agoAuto merge of #51569 - SimonSapin:liballoc, r=sfackler
bors [Fri, 29 Jun 2018 16:48:57 +0000 (16:48 +0000)]
Auto merge of #51569 - SimonSapin:liballoc, r=sfackler

Make the public API of the alloc crate a subset of std

This only affects **unstable** APIs.

I plan to submit an RFC proposing to stabilize the crate. The reason it isn’t stable yet (https://github.com/rust-lang/rust/issues/27783) is in case we end up merging the standard library crates into one. However the `core` crate is already stable, so if that happens we’ll need to keep it working somehow (likely by making replacing its contents by `pub use` items). We can do the same for `alloc`. This PR will hopefully make this easier, but even if that doesn’t happen consistency with `std` seems good.

6 years agoAuto merge of #51891 - glandium:llvm, r=alexcrichton
bors [Fri, 29 Jun 2018 14:43:40 +0000 (14:43 +0000)]
Auto merge of #51891 - glandium:llvm, r=alexcrichton

Update LLVM to 1c817c7a0c828b8fc8e8e462afbe5db41c7052d1

https://github.com/rust-lang/llvm/pull/118
https://github.com/rust-lang/llvm/pull/119

6 years agoAuto merge of #51729 - matthewjasper:move-errors, r=nikomatsakis
bors [Fri, 29 Jun 2018 12:40:12 +0000 (12:40 +0000)]
Auto merge of #51729 - matthewjasper:move-errors, r=nikomatsakis

[NLL] Better move errors

Make a number of changes to improve the quality of NLL cannot move errors.

* Group errors that occur in the same `match` with the same cause.
* Suggest `ref`, `&` or removing `*` to avoid the move.
* Show the place being matched on.

Differences from AST borrowck:

* `&` is suggested over `ref` when matching on a place that can't be moved from.
* Removing `*` is suggested instead of adding `&` when applicable.
* Sub-pattern spans aren't used, this would probably need Spans on Places.

Closes #45699
Closes #46627
Closes #51187
Closes #51189

r? @pnkfelix

6 years agoliballoc docs: Remove “not intended for general usage”
Simon Sapin [Sat, 23 Jun 2018 19:48:56 +0000 (21:48 +0200)]
liballoc docs: Remove “not intended for general usage”

6 years agoRename alloc::arc to alloc::sync, to match std::sync
Simon Sapin [Fri, 15 Jun 2018 02:07:09 +0000 (04:07 +0200)]
Rename alloc::arc to alloc::sync, to match std::sync

6 years agoRemove the Vec and String reexports at the root of the alloc crate
Simon Sapin [Fri, 15 Jun 2018 01:59:59 +0000 (03:59 +0200)]
Remove the Vec and String reexports at the root of the alloc crate

… since `std` has no corresponding reexports.

Use `alloc::vec::Vec` and `alloc::string::String` instead.

6 years agoMove core::alloc::CollectionAllocErr to alloc::collections
Simon Sapin [Fri, 15 Jun 2018 01:56:35 +0000 (03:56 +0200)]
Move core::alloc::CollectionAllocErr to alloc::collections

6 years agoMove some alloc crate top-level items to a new alloc::collections module
Simon Sapin [Fri, 15 Jun 2018 01:52:25 +0000 (03:52 +0200)]
Move some alloc crate top-level items to a new alloc::collections module

This matches std::collections

6 years agoRemove the unstable alloc::allocator module reexport, deprecated since 1.27
Simon Sapin [Fri, 15 Jun 2018 01:39:17 +0000 (03:39 +0200)]
Remove the unstable alloc::allocator module reexport, deprecated since 1.27

6 years agoMake raw_vec perma-unstable and hidden
Simon Sapin [Fri, 15 Jun 2018 01:36:34 +0000 (03:36 +0200)]
Make raw_vec perma-unstable and hidden

6 years agoAdd run-pass test
Gabriel Majeri [Tue, 5 Jun 2018 05:50:06 +0000 (08:50 +0300)]
Add run-pass test

6 years agoFix stability attributes
Gabriel Majeri [Wed, 30 May 2018 05:26:24 +0000 (08:26 +0300)]
Fix stability attributes

6 years agoImplement PartialEq between &str and OsString
Gabriel Majeri [Tue, 29 May 2018 16:16:49 +0000 (19:16 +0300)]
Implement PartialEq between &str and OsString

Allows for example `os_string == "something"`

6 years agoAuto merge of #50526 - moxian:just-fix, r=alexcrichton
bors [Fri, 29 Jun 2018 09:42:40 +0000 (09:42 +0000)]
Auto merge of #50526 - moxian:just-fix, r=alexcrichton

Add a fallback for stacktrace printing for older Windows versions.

Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends.

Tested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace.

Fixes #50138

6 years agoAuto merge of #51290 - Pslydhh:master, r=alexcrichton
bors [Fri, 29 Jun 2018 07:34:13 +0000 (07:34 +0000)]
Auto merge of #51290 - Pslydhh:master, r=alexcrichton

park/park_timeout: prohibit spurious wakeups in next park

<pre><code>
// The implementation currently uses the trivial strategy of a Mutex+Condvar
// with wakeup flag, which does not actually allow spurious wakeups.
</pre></code>

Because does not actually allow spurious wakeups.
so we have let thread.inner.cvar.wait(m) in the loop to prohibit spurious wakeups.
but if notified after we locked, this notification doesn't be consumed, it return, the next park will consume this notification...this is also 'spurious wakeup' case, 'one unpark() wakeups two  park()'.

We should improve this situation:
`thread.inner.state.store(EMPTY, SeqCst);`

6 years agoUpdate LLVM to 1c817c7a0c828b8fc8e8e462afbe5db41c7052d1
Mike Hommey [Fri, 29 Jun 2018 04:58:15 +0000 (13:58 +0900)]
Update LLVM to 1c817c7a0c828b8fc8e8e462afbe5db41c7052d1

https://github.com/rust-lang/llvm/pull/118
https://github.com/rust-lang/llvm/pull/119

6 years agoAuto merge of #50357 - seanmonstar:arc-weak-null, r=KodrAus
bors [Fri, 29 Jun 2018 04:09:02 +0000 (04:09 +0000)]
Auto merge of #50357 - seanmonstar:arc-weak-null, r=KodrAus

Arc: remove unused allocation from Weak::new()

It seems non-obvious that calling `Weak::new()` actually allocates space for the entire size of `T`, even though you can **never** access that data from such a constructed weak pointer. Besides that, if someone were to create many `Weak:new()`s, they could be unknowingly wasting a bunch of memory.

This change makes it so that `Weak::new()` allocates no memory at all. Instead, it is created with a null pointer. The only things done with a `Weak` are trying to upgrade, cloning, and dropping, meaning there are very few places that the code actually needs to check if the pointer is null.

6 years agoAuto merge of #51592 - GuillaumeGomez:fix-macro-doc-search, r=GuillaumeGomez
bors [Fri, 29 Jun 2018 01:05:02 +0000 (01:05 +0000)]
Auto merge of #51592 - GuillaumeGomez:fix-macro-doc-search, r=GuillaumeGomez

Fix macro missing from doc search

Fixes #51095.

r? @QuietMisdreavus

6 years agoAuto merge of #51884 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Thu, 28 Jun 2018 22:20:14 +0000 (22:20 +0000)]
Auto merge of #51884 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 6 pull requests

Successful merges:

 - #51636 (Refactor error reporting of constants)
 - #51765 (Use assert_eq! in copy_from_slice)
 - #51822 (Provide existing ref suggestions for more E0308 errors)
 - #51839 (Detect overflows of non u32 shifts)
 - #51868 (Remove process::id from 'Stabilized APIs' in 1.27.0 release notes)
 - #51875 (Explicitely disable WASM code generation for Emscripten)

Failed merges:

r? @ghost

6 years agoRollup merge of #51875 - badboy:emscripten-no-wasm, r=nikomatsakis
Mark Rousskov [Thu, 28 Jun 2018 22:07:16 +0000 (16:07 -0600)]
Rollup merge of #51875 - badboy:emscripten-no-wasm, r=nikomatsakis

Explicitely disable WASM code generation for Emscripten

Emscripten changed the default behavior recently:
https://github.com/kripken/emscripten/blob/bd050e64bb0d9952df1344b8ea9356252328ad83/ChangeLog.markdown#v1381-05172018

It now defaults to WebAssembly and requires an explicit flag to generate asm.js.
WASM=0 is also valid for older emcc and thus doesn't break it.

6 years agoRollup merge of #51868 - Lireer:master, r=pietroalbini
Mark Rousskov [Thu, 28 Jun 2018 22:07:15 +0000 (16:07 -0600)]
Rollup merge of #51868 - Lireer:master, r=pietroalbini

Remove process::id from 'Stabilized APIs' in 1.27.0 release notes

process::id was already stabilized in 1.26.0 and is marked as such in the docs.

6 years agoRollup merge of #51839 - oli-obk:const_shift_overflow, r=nikomatsakis
Mark Rousskov [Thu, 28 Jun 2018 22:07:14 +0000 (16:07 -0600)]
Rollup merge of #51839 - oli-obk:const_shift_overflow, r=nikomatsakis

Detect overflows of non u32 shifts

6 years agoRollup merge of #51822 - estebank:suggest-more, r=nikomatsakis
Mark Rousskov [Thu, 28 Jun 2018 22:07:13 +0000 (16:07 -0600)]
Rollup merge of #51822 - estebank:suggest-more, r=nikomatsakis

Provide existing ref suggestions for more E0308 errors

6 years agoRollup merge of #51765 - jonas-schievink:patch-1, r=KodrAus
Mark Rousskov [Thu, 28 Jun 2018 22:07:12 +0000 (16:07 -0600)]
Rollup merge of #51765 - jonas-schievink:patch-1, r=KodrAus

Use assert_eq! in copy_from_slice

This will print both lengths when the assertion fails instead of just saying that they're different.

Output of current stable and nightly (modulo the exact line number):
```
thread 'main' panicked at 'destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Output after this PR:
```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `123`,
 right: `456`: destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Note that I have not run the tests locally.

6 years agoRollup merge of #51636 - oli-obk:const_diagnostics, r=eddyb
Mark Rousskov [Thu, 28 Jun 2018 22:07:10 +0000 (16:07 -0600)]
Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddyb

Refactor error reporting of constants

cc @eddyb

This PR should not change any behaviour. It solely simplifies the internal handling of the errors

6 years agoChange traits to bare FnMut where possible.
moxian [Mon, 4 Jun 2018 11:00:12 +0000 (11:00 +0000)]
Change traits to bare FnMut where possible.

6 years agoMake msvc symbol extraction/printing functions generic.
moxian [Fri, 18 May 2018 12:33:23 +0000 (12:33 +0000)]
Make msvc symbol extraction/printing functions generic.

6 years agoMake stackwalking generic instead of matching on enum variants.
moxian [Fri, 18 May 2018 11:38:50 +0000 (11:38 +0000)]
Make stackwalking generic instead of matching on enum variants.

6 years agoLoad backtrace-related functions only once
moxian [Sun, 13 May 2018 08:41:24 +0000 (08:41 +0000)]
Load backtrace-related functions only once

.. and pass them around in BacktraceContext.

6 years agoSplit separate stackwalk variants into their own functions
moxian [Sun, 13 May 2018 04:38:43 +0000 (04:38 +0000)]
Split separate stackwalk variants into their own functions

.. rather than having them be one giant match statement.

6 years agoAdd a fallback for stacktrace printing for older Windows versions.
moxian [Tue, 8 May 2018 06:19:55 +0000 (06:19 +0000)]
Add a fallback for stacktrace printing for older Windows versions.

PR #47252 switched stack inspection functions of dbghelp.dll
to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older
dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll
version 6.1.7601 from 2010, that lacks StackWalkEx and friends.

Fixes #50138

6 years agoFix rebase
Esteban Küber [Thu, 28 Jun 2018 18:14:31 +0000 (11:14 -0700)]
Fix rebase

6 years agoArc: remove unused allocation from Weak::new()
Sean McArthur [Thu, 28 Jun 2018 18:49:47 +0000 (11:49 -0700)]
Arc: remove unused allocation from Weak::new()

6 years agoProvide existing ref suggestions for more E0308 errors
Esteban Küber [Tue, 26 Jun 2018 18:39:37 +0000 (11:39 -0700)]
Provide existing ref suggestions for more E0308 errors

6 years agoreview comments: unify duplicated code
Esteban Küber [Thu, 28 Jun 2018 18:06:30 +0000 (11:06 -0700)]
review comments: unify duplicated code

6 years agoAlso point to free named region on lifetime errors
Esteban Küber [Thu, 28 Jun 2018 00:41:15 +0000 (17:41 -0700)]
Also point to free named region on lifetime errors

6 years agoExtend support to `get_generics` for all `NodeItem`s
Esteban Küber [Wed, 27 Jun 2018 23:44:39 +0000 (16:44 -0700)]
Extend support to `get_generics` for all `NodeItem`s

6 years agoPoint to lifetime in fn definition on lifetime error note
Esteban Küber [Wed, 27 Jun 2018 23:27:47 +0000 (16:27 -0700)]
Point to lifetime in fn definition on lifetime error note

6 years agoPoint at lifetimes instead of def span for E0195
Esteban Küber [Wed, 27 Jun 2018 22:25:18 +0000 (15:25 -0700)]
Point at lifetimes instead of def span for E0195

6 years agoAuto merge of #51687 - japaric:gh51671, r=alexcrichton
bors [Thu, 28 Jun 2018 15:34:17 +0000 (15:34 +0000)]
Auto merge of #51687 - japaric:gh51671, r=alexcrichton

translate / export weak lang items

see #51671 for details

fixes #51671
fixes #51342

r? @michaelwoerister or @alexcrichton

6 years agoAuto merge of #51630 - joshlf:map-split-perf, r=dtolnay
bors [Thu, 28 Jun 2018 13:23:07 +0000 (13:23 +0000)]
Auto merge of #51630 - joshlf:map-split-perf, r=dtolnay

Optimize RefCell refcount tracking

Address the performance concern raised in https://github.com/rust-lang/rust/pull/51466#issuecomment-398255276

cc @dtolnay  @nnethercote @rust-lang/wg-compiler-performance

cc @RalfJung @jhjourdan for soundness concerns

Can somebody kick off a perf run on this? I'm not sure how that's done, but I understand it has to be started manually.

The idea of this change is to switch to representing mutable refcount as values below 0 to eliminate some branching that was required with the old algorithm.

6 years agoExplicitely disable WASM code generation for Emscripten
Jan-Erik Rediger [Thu, 28 Jun 2018 10:24:14 +0000 (12:24 +0200)]
Explicitely disable WASM code generation for Emscripten

Emscripten changed the default behavior recently:
https://github.com/kripken/emscripten/blob/bd050e64bb0d9952df1344b8ea9356252328ad83/ChangeLog.markdown#v1381-05172018

It now defaults to WebAssembly and requires an explicit flag to generate asm.js.
WASM=0 is also valid for older emcc and thus doesn't break it.

Closes #51856

6 years agoadd explanatory comment
Niko Matsakis [Thu, 28 Jun 2018 12:34:04 +0000 (08:34 -0400)]
add explanatory comment

6 years agoAuto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrum
bors [Thu, 28 Jun 2018 11:20:41 +0000 (11:20 +0000)]
Auto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrum

 Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.

This PR removes most of the interior mutability from `FileMap`, which should be beneficial, especially in a multithreaded setting. This is achieved by initializing the state in question when the filemap is constructed instead of during lexing. Hopefully this doesn't degrade performance.

cc @wesleywiser

6 years agoRemove process::id from 'Stabilized APIs' in 1.27
Lireer [Thu, 28 Jun 2018 09:30:53 +0000 (11:30 +0200)]
Remove process::id from 'Stabilized APIs' in 1.27

6 years agoRebase fallout
Oliver Schneider [Thu, 28 Jun 2018 09:19:45 +0000 (11:19 +0200)]
Rebase fallout

6 years agoAuto merge of #51492 - petrochenkov:hirident, r=eddyb
bors [Thu, 28 Jun 2018 09:16:10 +0000 (09:16 +0000)]
Auto merge of #51492 - petrochenkov:hirident, r=eddyb

Use `Ident`s in HIR and remove emulation of hygiene with gensyms

continuation of https://github.com/rust-lang/rust/pull/51072, part of https://github.com/rust-lang/rust/issues/49300

Not all `Name`s in HIR are replaced with `Ident`s, only those needed for hygiene or already having attached spans.

6 years agoTurn the use of erroneous constants into errors again
Oliver Schneider [Wed, 27 Jun 2018 12:55:06 +0000 (14:55 +0200)]
Turn the use of erroneous constants into errors again

6 years agoDon't const propagate the body of constants
Oliver Schneider [Wed, 27 Jun 2018 11:36:30 +0000 (13:36 +0200)]
Don't const propagate the body of constants

6 years agoMerge `ConstVal` and `ConstValue`
Oliver Schneider [Mon, 25 Jun 2018 18:53:02 +0000 (20:53 +0200)]
Merge `ConstVal` and `ConstValue`

6 years agoFixup
Oliver Schneider [Mon, 25 Jun 2018 16:48:11 +0000 (18:48 +0200)]
Fixup

6 years agoMove everything over from `middle::const_val` to `mir::interpret`
Oliver Schneider [Mon, 25 Jun 2018 16:46:02 +0000 (18:46 +0200)]
Move everything over from `middle::const_val` to `mir::interpret`

6 years agoMove the Lrc outside the error type and name the fields
Oliver Schneider [Mon, 25 Jun 2018 15:41:20 +0000 (17:41 +0200)]
Move the Lrc outside the error type and name the fields

6 years agoRemove unused type
Oliver Schneider [Mon, 25 Jun 2018 13:10:33 +0000 (15:10 +0200)]
Remove unused type

6 years agoAddress review comments
Oliver Schneider [Mon, 25 Jun 2018 13:08:05 +0000 (15:08 +0200)]
Address review comments

6 years agoEliminate old CTFE's `ErrKind`
Oliver Schneider [Tue, 19 Jun 2018 14:40:53 +0000 (16:40 +0200)]
Eliminate old CTFE's `ErrKind`

6 years agoSimplify const error reporting
Oliver Schneider [Thu, 14 Jun 2018 23:26:56 +0000 (01:26 +0200)]
Simplify const error reporting

6 years agoFix FileMap::line_begin_pos().
Michael Woerister [Thu, 28 Jun 2018 08:45:57 +0000 (10:45 +0200)]
Fix FileMap::line_begin_pos().

The method relied on the FileMap still being under construction in
order for it to do what the name promises. It's now independent of
the current state.

6 years agoFix rebase
Vadim Petrochenkov [Wed, 27 Jun 2018 21:12:17 +0000 (00:12 +0300)]
Fix rebase

6 years agoincremental: Do not hash spans for things that didn't have spans previously
Vadim Petrochenkov [Sat, 16 Jun 2018 16:44:12 +0000 (19:44 +0300)]
incremental: Do not hash spans for things that didn't have spans previously

6 years agoSupport delegation in stable hashing macros
Vadim Petrochenkov [Sat, 16 Jun 2018 14:09:42 +0000 (17:09 +0300)]
Support delegation in stable hashing macros

6 years agoUse `Ident`s for associated item definitions in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 19:24:24 +0000 (22:24 +0300)]
Use `Ident`s for associated item definitions in HIR

Remove emulation of hygiene with gensyms

6 years agoUse `Ident`s in a number of structures in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 16:33:30 +0000 (19:33 +0300)]
Use `Ident`s in a number of structures in HIR

Namely: labels, type parameters, bindings in patterns, parameter names in functions without body.
All of these do not need hygiene after lowering to HIR, only span locations.

6 years agoUse `Ident`s for path segments in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 14:40:45 +0000 (17:40 +0300)]
Use `Ident`s for path segments in HIR

6 years agoUse `Ident`s for associated type bindings in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 12:55:48 +0000 (15:55 +0300)]
Use `Ident`s for associated type bindings in HIR

6 years agoUse `Ident`s for lifetimes in HIR
Vadim Petrochenkov [Sat, 9 Jun 2018 20:25:33 +0000 (23:25 +0300)]
Use `Ident`s for lifetimes in HIR

6 years agoAuto merge of #51444 - estebank:impl-static, r=nikomatsakis
bors [Thu, 28 Jun 2018 03:57:28 +0000 (03:57 +0000)]
Auto merge of #51444 - estebank:impl-static, r=nikomatsakis

Suggestion for 'static impl Trait return

When encountering a named or anonymous sup requirement (for example,
`&'a self`) and a `'static` impl Trait return type, suggest adding the
`'_` lifetime constraing to the return type.

Fix #43719, #51282.

```
error: cannot infer an appropriate lifetime
  --> $DIR/static-return-lifetime-infered.rs:17:16
   |
LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
   |                                   ----------------------- this return type evaluates to the `'static` lifetime...
LL |         self.x.iter().map(|a| a.0)
   |         ------ ^^^^
   |         |
   |         ...but this borrow...
   |
note: ...can't outlive the anonymous lifetime #1 defined on the method body at 16:5
  --> $DIR/static-return-lifetime-infered.rs:16:5
   |
LL | /     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
LL | |         self.x.iter().map(|a| a.0)
LL | |     }
   | |_____^
help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the method body at 16:5
   |
LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

6 years agoAuto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddyb
bors [Thu, 28 Jun 2018 01:41:40 +0000 (01:41 +0000)]
Auto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddyb

convert NLL ops to caches

This is a extension of <https://github.com/rust-lang/rust/pull/51460>. It uses a lot more caching than we used to do. This caching is not yet as efficient as it could be, but I'm curious to see the current perf results.

This is the high-level idea: in the MIR type checker, use [canonicalized queries](https://rust-lang-nursery.github.io/rustc-guide/traits/canonical-queries.html) for all the major operations. This is helpful because the MIR type check is operating in a context where all types are fully known (mostly, anyway) but regions are completely renumbered. This means we often wind up with duplicate queries like `Foo<'1, '2> :Bar` and `Foo<'3, '4>: Bar`. Canonicalized queries let us re-use the results. By the final commit in this PR, we can essentially just "read off" the resulting region relations and add them to the NLL type check.

6 years agoAuto merge of #51859 - kennytm:rollup, r=kennytm
bors [Wed, 27 Jun 2018 23:41:23 +0000 (23:41 +0000)]
Auto merge of #51859 - kennytm:rollup, r=kennytm

Rollup of 7 pull requests

Successful merges:

 - #49987 (Add str::split_ascii_whitespace.)
 - #50342 (Document round-off error in `.mod_euc()`-method, see issue #50179)
 - #51658 (Only do sanity check with debug assertions on)
 - #51799 (Lower case some feature gate error messages)
 - #51800 (Add a compiletest header for edition)
 - #51824 (Fix the error reference for LocalKey::try_with)
 - #51842 (Document that Layout::from_size_align does not allow align=0)

Failed merges:

r? @ghost

6 years agoRollup merge of #51842 - rust-lang:align-is-nonzero, r=cramertj
kennytm [Wed, 27 Jun 2018 22:15:43 +0000 (06:15 +0800)]
Rollup merge of #51842 - rust-lang:align-is-nonzero, r=cramertj

Document that Layout::from_size_align does not allow align=0

This was already implied since zero is not a power of two, but maybe worth pointing out.

6 years agoRollup merge of #51824 - vorner:thread-local-try-with-doc, r=kennytm
kennytm [Wed, 27 Jun 2018 22:15:42 +0000 (06:15 +0800)]
Rollup merge of #51824 - vorner:thread-local-try-with-doc, r=kennytm

Fix the error reference for LocalKey::try_with

There's no such thing as `ThreadLocalError` and the method obviously returns `AccessError`, so adjusting (probably only outdated docs).

6 years agoRollup merge of #51800 - mark-i-m:edition2018compiletest, r=nikomatsakis
kennytm [Wed, 27 Jun 2018 22:15:41 +0000 (06:15 +0800)]
Rollup merge of #51800 - mark-i-m:edition2018compiletest, r=nikomatsakis

Add a compiletest header for edition

r? @nikomatsakis

Are the `-Zunstable-options` options needed in these tests? It looks like they aren't. If not, I can remove them.

6 years agoRollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-m
kennytm [Wed, 27 Jun 2018 22:15:40 +0000 (06:15 +0800)]
Rollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-m

Lower case some feature gate error messages

6 years agoRollup merge of #51658 - oli-obk:unregress_perf, r=nikomatsakis
kennytm [Wed, 27 Jun 2018 22:15:39 +0000 (06:15 +0800)]
Rollup merge of #51658 - oli-obk:unregress_perf, r=nikomatsakis

Only do sanity check with debug assertions on

r? @nnethercote

I'm slighty confused. These changes address code that the `unused-warnings` benchmark doesn't go through, yet I see a 5% improvement to nightly on the `check` run, and no improvement on the other runs.

Maybe this change allows unrelated code in the same function to be better optimized?

6 years agoRollup merge of #50342 - fkjogu:euclidean, r=BurntSushi
kennytm [Wed, 27 Jun 2018 22:15:38 +0000 (06:15 +0800)]
Rollup merge of #50342 - fkjogu:euclidean, r=BurntSushi

Document round-off error in `.mod_euc()`-method, see issue #50179

Due to a round-off error the method `.mod_euc()` of both `f32` and `f64` can produce mathematical invalid outputs. If `self` in magnitude is much small than the modulus `rhs` and negative, `self + rhs` in the first branch cannot be represented in the given precision and results into `rhs`. In the mathematical strict sense, this breaks the definition. But given the limitation of floating point arithmetic it can be thought of the closest representable value to the true result, although it is not strictly in the domain `[0.0, rhs)` of the function. It is rather the left side asymptotical limit. It would be desirable that it produces the mathematical more sound approximation of `0.0`, the right side asymptotical limit. But this breaks the property, that `self == self.div_euc(rhs) * rhs + a.mod_euc(rhs)`.

The discussion in issue #50179 did not find an satisfying conclusion to which property is deemed more important. But at least we can document the behaviour. Which this pull request does.

6 years agoRollup merge of #49987 - clarcharr:split_ascii_whitespace, r=SimonSapin
kennytm [Wed, 27 Jun 2018 22:15:37 +0000 (06:15 +0800)]
Rollup merge of #49987 - clarcharr:split_ascii_whitespace, r=SimonSapin

Add str::split_ascii_whitespace.

As mentioned in #48656.

While `str::split_whitespace` now works in `libcore`, it still makes sense to offer this method, considering how it is still more performant in cases where only ASCII is necessary.

6 years agoAdd str::split_ascii_whitespace.
Clar Charr [Sat, 5 May 2018 04:33:20 +0000 (00:33 -0400)]
Add str::split_ascii_whitespace.