Commit Graph

86048 Commits

Author SHA1 Message Date
Oliver Scherer
e5fd34c1ae Fix fulldeps test with NodeId 2018-11-12 10:29:53 +01:00
Oliver Scherer
4c9ee59584 Reintroduce the original debug formatting for NodeIds 2018-11-12 10:29:53 +01:00
Oliver Scherer
4bf7c33b79 Fix rustdoc 2018-11-12 10:29:53 +01:00
Oliver Scherer
a1d89266e5 Turn HirLocalId into a newtype_index 2018-11-12 10:29:53 +01:00
Oliver Scherer
39a0969e64 Make NodeId a newtype_index to enable niche optimizations 2018-11-12 10:29:53 +01:00
Ralf Jung
3c88cfef67 remove unused import 2018-11-12 09:11:29 +01:00
bors
0195812aea Auto merge of #55604 - nnethercote:avoid-associated_items-Box, r=nnethercote
Avoid the Box in `TyCtxt::associated_items`.

This reduces instruction counts on `packed_simd` by 2%.

r? @nikomatsakis
2018-11-12 08:03:58 +00:00
Ralf Jung
075983c70b global allocators: add a few comments 2018-11-12 09:01:57 +01:00
Ralf Jung
ace20b9646 for uniformity, also move memory_deallocated to AllocationExtra 2018-11-12 08:39:13 +01:00
Niko Matsakis
e927a244ea Avoid the Box in TyCtxt::associated_items.
This reduces instruction counts on packed_simd by 2%.
2018-11-12 16:23:35 +11:00
Nicholas Nethercote
c6862992d9 Change Lit::short_name to Lit::literal_name.
This avoids a moderately hot allocation in `parse_lit_token`.
2018-11-12 15:16:03 +11:00
bors
d1d79ae3ad Auto merge of #55701 - tromey:ice-fix, r=matthewjasper
Fix emission of niche-filling discriminant values

Bug #55606 points out a regression introduced by #54004; namely that
an assertion can erroneously fire when a niche-filling discriminant
value is emitted.

This fixes the bug by removing the assertion, and furthermore by
arranging for the discriminant value to be masked according to the
size of the niche.  This makes handling the discriminant a bit simpler
for debuggers.

The test case is from Jonathan Turner.

Closes #55606
2018-11-12 04:12:26 +00:00
Dan Robertson
c211238180
Fix TLS errors when downloading stage0 2018-11-12 02:35:44 +00:00
Hugo van der Wijst
4fdae853f7 Reference count crate_inherent_implss return value.
The repeated cloning of the result in `inherent_impls` queries has quite
an impact on crates with many inherent trait implementations.
2018-11-11 17:55:39 -08:00
bors
d8f4c9ffac Auto merge of #55525 - nnethercote:MatcherPos-stack-SmallVec, r=nnethercote
Make `MatcherPos::stack` a `SmallVec`.

This avoids some allocations.

This seems like a trivial change, but the compiler rejects it:
```
   Compiling syntax v0.0.0 (/home/njn/moz/rust1/src/libsyntax)
error[E0597]: `initial` does not live long enough=========>           ] 89/110: syntax
   --> libsyntax/ext/tt/macro_parser.rs:647:57
    |
647 |     let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)];
    |                                                         ^^^^^^^^^^^^ borrowed value does not live long enough
...
762 | }
    | -
    | |
    | `initial` dropped here while still borrowed
    | borrow later used here, when `initial` is dropped

error: aborting due to previous error
```
This is either a compiler bug, or there's some subtle thing I don't understand. The lifetimes sure seem straightforward: `initial` is declared, and then `cur_items` is declared immediately afterward, and it uses a reference to `initial`. The error message makes it sound like the compiler is dropping the variables in the wrong order.

r? @nikomatsakis, any idea what the problem is?
2018-11-12 01:20:33 +00:00
Niko Matsakis
68e76dca09 Make MatcherPos::stack a SmallVec.
This avoids some allocations.
2018-11-12 11:37:18 +11:00
bors
775eab5883 Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichton
Remove support for building against LLVM 4

With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-11 22:38:54 +00:00
Igor Matuszewski
04cc0d651e save-analysis: Don't panic for macro-generated use globs
Follow-up to
c2bb7cadf2.
2018-11-11 21:42:20 +01:00
bors
ca79ecd694 Auto merge of #55660 - alexcrichton:cleanup-alloc-system, r=dtolnay,SimonSapin
Remove the `alloc_system` crate

In what's hopefully one of the final nails in the coffin of the "old allocator story of yore" this PR deletes the `alloc_system` crate and all traces of it from the compiler. The compiler no longer needs to inject allocator crates anywhere and the `alloc_system` crate has no real reason to exist outside the standard library.

The unstable `alloc_system` crate is folded directly into the standard library where its stable interface, the `System` type, remains the same. All unstable traces of `alloc_system` are removed, however.
2018-11-11 19:51:56 +00:00
Denis Vasilik
6f3add34ca Minor style guide corrections. 2018-11-11 20:11:25 +01:00
Alex Crichton
cc7590341a std: Delete the alloc_system crate
This commit deletes the `alloc_system` crate from the standard
distribution. This unstable crate is no longer needed in the modern
stable global allocator world, but rather its functionality is folded
directly into the standard library. The standard library was already the
only stable location to access this crate, and as a result this should
not affect any stable code.
2018-11-11 09:22:28 -08:00
Alex Crichton
d3939322e3 rustc: Clean up allocator injection logic
This commit cleans up allocator injection logic found in the compiler
around selecting the global allocator. It turns out that now that
jemalloc is gone the compiler never actually injects anything! This
means that basically everything around loading crates here and there can
be easily pruned.

This also removes the `exe_allocation_crate` option from custom target
specs as it's no longer used by the compiler anywhere.
2018-11-11 09:22:28 -08:00
bors
5a2ca1a6f1 Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelix
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field

Fixes #55651, #55652.

This PR makes two changes:

First, it updates the dataflow builder to add an init for the place
containing a union if there is an assignment into the field of
that union.

Second, it stops a "use of uninitialized" error occuring when there is an
assignment into the field of an uninitialized union that was previously
initialized. Making this assignment would re-initialize the union, as
tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
The check for previous initialization ensures that we do not start
supporting partial initialization yet (cc #21232, #54499, #54986).

This PR also fixes #55652 which was marked as requiring investigation
as the changes in this PR add an error that was previously missing
(and mentioned in the review comments) and confirms that the error
that was present is correct and a result of earlier partial
initialization changes in NLL.

r? @pnkfelix (due to earlier work with partial initialization)
cc @nikomatsakis
2018-11-11 17:05:36 +00:00
Denis Vasilik
dc0fd65af2 Whitespace cleanup according to Rust's style guidelines. 2018-11-11 16:58:00 +01:00
Denis Vasilik
f0bfbd3e72 Added comments for trait implementations. 2018-11-11 15:44:15 +01:00
Denis Vasilik
93b5112c16 Added comment for From trait implementation: boxed string slice to String 2018-11-11 15:43:43 +01:00
bors
a88613c869 Auto merge of #55674 - oli-obk:miri_engine_refactoring, r=RalfJung
Miri engine refactoring

r? @RalfJung

split out the "just moves stuff around" part of https://github.com/rust-lang/rust/pull/55293
2018-11-11 14:24:39 +00:00
Bruce Mitchener
a62af858e0 Fix typos. 2018-11-11 20:52:36 +07:00
Ralf Jung
db13390104 do not skip return code check in release builds 2018-11-11 10:54:13 +01:00
Axary
ab55d9b5d3 change attribute to stable 2018-11-11 10:45:16 +01:00
Axary
5030794248 Merge branch 'master' of https://github.com/rust-lang/rust 2018-11-11 10:41:49 +01:00
Ralf Jung
0c6a093afa Unix RwLock: avoid racy access to write_locked 2018-11-11 10:06:41 +01:00
Dale Wijnand
20ef40ae50
Fix a typo in std::panic 2018-11-11 07:36:10 +00:00
bors
b76ee83254 Auto merge of #55859 - pietroalbini:rollup, r=kennytm
Rollup of 17 pull requests

Successful merges:

 - #55630 (resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition)
 - #55687 (Take supertraits into account when calculating associated types)
 - #55745 (Convert `outlives_components`' return value to a `SmallVec` outparam.)
 - #55764 (Fix Rc/Arc allocation layout)
 - #55792 (Prevent ICE in const-prop array oob check)
 - #55799 (Removed unneeded instance of `// revisions` from a lint test)
 - #55800 (Fix ICE in `return_type_impl_trait`)
 - #55801 (NLL: Update box insensitivity test)
 - #55802 (Don't inline virtual calls (take 2))
 - #55816 (Use `SmallVec` to avoid allocations in `from_decimal_string`.)
 - #55819 (Typecheck patterns of all match arms first, so we get types for bindings)
 - #55822 (ICE with #![feature(nll)] and elided lifetimes)
 - #55828 (Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`)
 - #55839 (Fix docstring spelling mistakes)
 - #55844 (Fix documentation typos.)
 - #55845 (Set BINARYEN_TRAP_MODE=clamp)
 - #55856 (rustdoc: refactor: move all static-file include!s into a single module)
2018-11-11 06:26:21 +00:00
kennytm
7031e4e7c7
Rollup merge of #55856 - QuietMisdreavus:static-discharge, r=GuillaumeGomez
rustdoc: refactor: move all static-file include!s into a single module

This is a smaller refactor that creates a new module `rustdoc::html::static_files`, which contains a bunch of `static` variables with all the files in `html/static` that we use. The idea behind moving them all here was to remove the duplicate `include_bytes!()` that are used by the theme-checker code. It also continues to centralize more operations in rustdoc.
2018-11-11 12:34:23 +08:00
kennytm
d0b68c0dde
Rollup merge of #55845 - nikic:emscripten-clamp-mode, r=alexcrichton
Set BINARYEN_TRAP_MODE=clamp

This fixes the wasm32-unknown-emscripten test failure mentioned in https://github.com/rust-lang/rust/pull/55626#issuecomment-437084774, by making binaryen operate in clamp rather than trap mode.

The issue is that the current `-Zsaturating-float-casts` implementation uses `fpto[us]i` unconditionally (and selects afterwards), which does not work with trapping implementations of fpto[su]i, which emscripten uses by default.

I've left a FIXME to drop this flag once we have a better solution for saturating casts on the LLVM side.
;
2018-11-11 12:33:50 +08:00
kennytm
75e920f847
Rollup merge of #55630 - petrochenkov:noprelude, r=Centril
resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition

This is a tiny thing.
For historical reasons macro prelude (macros from `#[macro_use] extern crate ...`, including `extern crate std`) is still available in modules with `#[no_implicit_prelude]`.
This PR provides proper isolation and removes those names from scope.

`#[no_implicit_prelude]` modules still have built-in types (`u8`), built-in attributes (`#[inline]`) and built-in macros (`env!("PATH")`) in scope. We can introduce some `#[no_implicit_prelude_at_all]` to remove those as well, but that's a separate issue.

The change is done only on 2018 edition for backward compatibility.
I'm pretty sure this can be done on 2015 as well because `#[no_implicit_prelude]` is rarely used, but I don't want to go through the crater/deprecation process right now, maybe later.

cc https://github.com/rust-lang/rust/issues/53977
r? @ghost
2018-11-11 12:32:01 +08:00
bors
9b8f902976 Auto merge of #54993 - TimNN:pda-tdl, r=eddyb
Support for the program data address space option of LLVM's Target Datalayout

This was introduced recently (specifically, for AVR, cc @dylanmckay).

(I came up with this when attempting to run [avr-rust](https://github.com/avr-rust/rust) rebased on the latest [rust-lang](https://github.com/rust-lang/rust) commits. If this requires a different design, some additional discussions, or is not something to pursue right now, I'd be happy to close this PR).

Note that this somewhat overlaps with @DiamondLovesYou's #51576, I think, although the implementation here is significantly simpler: Since the address space applies to _all_ program data, we can just check the pointee's type whenever we create an LLVM pointer type. If it is a function we use the program data address space; if not we use the default address space.

cc @eddyb, who has been reviewing #51576

Ref: https://llvm.org/docs/LangRef.html#data-layout
2018-11-11 03:44:16 +00:00
Pietro Albini
17ae50765e
Rollup merge of #55844 - waywardmonkeys:typo-fixes, r=varkor
Fix documentation typos.
2018-11-11 00:21:25 +01:00
Pietro Albini
417b10a0e3
Rollup merge of #55839 - dralley:docstring-spelling, r=TimNN
Fix docstring spelling mistakes
2018-11-11 00:21:24 +01:00
Pietro Albini
0f1c1eb480
Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb
Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`

cc @pnkfelix

fixes #55806
2018-11-11 00:21:23 +01:00
Pietro Albini
4c50964c5f
Rollup merge of #55822 - davidtwco:issue-55394, r=pnkfelix
ICE with #![feature(nll)] and elided lifetimes

Fixes #55394.

This commit fixes an ICE and determines the correct return span in cases
with a method implemented on a struct with an an elided lifetime.

r? @pnkfelix
2018-11-11 00:21:22 +01:00
Pietro Albini
c4ca49aebd
Rollup merge of #55819 - pnkfelix:issue-55810-must-typeck-pats-eagerly, r=oli-obk
Typecheck patterns of all match arms first, so we get types for bindings

Fix eventually (after backport to beta) the issue #55810
2018-11-11 00:21:21 +01:00
Pietro Albini
e8a3934599
Rollup merge of #55816 - nnethercote:from_decimal_string-SmallVec, r=oli-obk
Use `SmallVec` to avoid allocations in `from_decimal_string`.

This reduces the number of allocations in a "check clean" build of
`tuple-stress` by 14%, reducing instruction counts by 0.6%.
2018-11-11 00:21:20 +01:00
Pietro Albini
5b0b0ce61e
Rollup merge of #55802 - wesleywiser:inlined_calls_2_electric_boogaloo, r=nagisa
Don't inline virtual calls (take 2)

When I fixed the previous mis-optimizations, I didn't realize there were
actually two different places where we mutate `callsites` and both of
them should have the same behavior.

As a result, if a function was inlined and that function contained
virtual function calls, they were incorrectly being inlined. I also
added a test case which covers this.
2018-11-11 00:21:19 +01:00
Pietro Albini
18195d4133
Rollup merge of #55801 - pnkfelix:update-box-insensitivity-test-for-nll, r=davidtwco
NLL: Update box insensitivity test

This is just keeping one of our tests honest with respect to NLL, in two ways:

 1. Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see...
 2. ... I say "would have expected" because all of the errors in this file are part of the reversion of rust-lang/rfcs#130 that is attached to NLL (you can see more discussion of this here https://github.com/rust-lang/rust/issues/43234#issuecomment-411017768 )
2018-11-11 00:21:17 +01:00
Pietro Albini
ff8ee964ae
Rollup merge of #55800 - estebank:abolish-ice-for-lifetime, r=oli-obk
Fix ICE in `return_type_impl_trait`

Fix #55796.
2018-11-11 00:21:16 +01:00
Pietro Albini
8c4bfb833b
Rollup merge of #55799 - pnkfelix:remove-useless-revisions-marker-from-lint-unused-mut-variables, r=davidtwco
Removed unneeded instance of `// revisions` from a lint test

Removed an unneeded instance of `// revisions`; the compare-mode=nll shows the output is identical now.

cc #54528
2018-11-11 00:21:15 +01:00
Pietro Albini
e121305abd
Rollup merge of #55792 - oli-obk:propsicle, r=RalfJung
Prevent ICE in const-prop array oob check

fixes https://github.com/rust-lang/rust/issues/55772
fixes https://github.com/rust-lang/rust/issues/54541
2018-11-11 00:21:14 +01:00
Pietro Albini
d2aeef06f2
Rollup merge of #55764 - murarth:fix-rc-alloc, r=RalfJung
Fix Rc/Arc allocation layout

* Rounds allocation layout up to a multiple of alignment
* Adds a convenience method `Layout::pad_to_align` to perform rounding

Closes #55747

cc #55724
2018-11-11 00:21:13 +01:00