Commit Graph

76670 Commits

Author SHA1 Message Date
kennytm
24b3a97986
Rollup merge of #49503 - oli-obk:extern_crate_compiler_builtins, r=alexcrichton
Inject the `compiler_builtins` crate whenever the `core` crate is injected
2018-04-07 15:36:57 +08:00
Oliver Schneider
679657b863
Inject the compiler_builtins crate whenever the core crate is injected 2018-04-07 09:24:35 +02:00
kennytm
3e0b15f824
Rollup merge of #49750 - ishitatsuyuki:boot-no-fast, r=Mark-Simulacrum
bootstrap: Remove the fast path

This is rarely noticed, but when you have old submodules, not updating them will cause you run into https://github.com/rust-lang/cargo/issues/4678.

(Reopen of #49721)

r? @alexcrichton
2018-04-07 14:51:34 +08:00
kennytm
3f26d01635
Rollup merge of #49748 - alexcrichton:proc-macro-debug, r=dtolnay
proc_macro: Improve Debug representations

This commit improves the `fmt::Debug` output of `proc_macro` data structures by
primarily focusing on the representation exposed by `proc_macro` rather than the
compiler's own internal representation. This cuts down quite a bit on assorted
wrapper types and ensure a relatively clean output.

Closes #49720
2018-04-07 14:51:33 +08:00
kennytm
7e28c0f72d
Rollup merge of #49742 - Pulkit07:master, r=steveklabnik
Using X headings instead of 0.X #49739

Fix #49739
2018-04-07 14:51:32 +08:00
kennytm
97511b120b
Rollup merge of #49731 - japaric:std-thumb-for-real, r=alexcrichton
add THUMB targets to rustup manifest

as instructed in https://github.com/rust-lang/rust/pull/49563#issuecomment-379271327

r? @alexcrichton
2018-04-07 14:51:31 +08:00
kennytm
c3eb990716
Rollup merge of #49728 - japaric:no-debug_gdb_scripts, r=alexcrichton
add emit_debug_gdb_scripts target option and ..

set it to false for no-std targets like ARM Cortex-M and MSP430. For the rationale of this change see the comment in thumb_base.rs

this is a temporary workaround until #44993 is implemented

r? @alexcrichton or @michaelwoerister
2018-04-07 14:51:30 +08:00
kennytm
496f026775
Rollup merge of #49702 - alexcrichton:inline-methods, r=Mark-Simulacrum
std: Inline some Termination-related methods

These were showing up in tests and in binaries but are trivially optimize-able
away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them
out.
2018-04-07 14:51:28 +08:00
kennytm
91e81fa2a3
Rollup merge of #49652 - GuillaumeGomez:anchor-collapsed, r=QuietMisdreavus
Fix anchors issue when everything is collapsed

Fixes #49455.

@frewsxcv does it seem good for you like this?

r? @QuietMisdreavus
2018-04-07 14:51:27 +08:00
kennytm
c41b2d6111
Rollup merge of #49510 - GuillaumeGomez:anchor-field-position, r=QuietMisdreavus
Fix anchor position on fields

Take a look at `Option` variants for example and try to click on `§` to get the issue.

r? @QuietMisdreavus
2018-04-07 14:51:26 +08:00
David Tolnay
52766b5747
Print proc_macro spans as a half-open range
A span covering a single byte, such as for an operator `+` token, should
print as e.g. `80..81` rather than `80...81`. The lo end of the range is
inclusive and the hi end is exclusive.
2018-04-06 22:57:45 -07:00
bors
e0a9bd0f3c Auto merge of #49419 - leodasvacas:small-typeck-refactorings, r=nikomatsakis
Small typeck refactorings

Some code improvements I noticed while reading the code.
2018-04-07 05:33:11 +00:00
Shotaro Yamada
3832e8b3e3 [incremental] Hash Allocations 2018-04-07 12:48:33 +09:00
bors
ee1014e505 Auto merge of #49222 - Zoxc:print-query-stack, r=nikomatsakis
Print query stack on ICEs

ICE output is now:
```
thread 'rustc' panicked at 'no borrowck', librustc_borrowck\borrowck\mod.rs:95:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
query stack during panic:
#0 [borrowck] processing `main`
  --> no-std.rs:10:1
   |
10 | fn main() {}
   | ^^^^^^^^^
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.26.0-dev running on x86_64-pc-windows-msvc
```

Fixes #42529.

r? @eddyb
2018-04-07 02:51:17 +00:00
bors
5911314efd Auto merge of #49623 - steveklabnik:update-mdbook, r=GuillaumeGomez
update mdbook

This includes search for all books, a long-requested feature!
2018-04-07 00:20:21 +00:00
Alex Crichton
6c08bb8b08 proc_macro: Improve Debug representations
This commit improves the `fmt::Debug` output of `proc_macro` data structures by
primarily focusing on the representation exposed by `proc_macro` rather than the
compiler's own internal representation. This cuts down quite a bit on assorted
wrapper types and ensure a relatively clean output.

Closes #49720
2018-04-06 15:20:57 -07:00
bors
0e35dddbd3 Auto merge of #49392 - retep007:nll-issue-48962, r=nikomatsakis
fixes move analysis

Fixed compiler error by correct checking when dereferencing

Fix #48962

r? @nikomatsakis
2018-04-06 21:50:12 +00:00
Pulkit Goyal
ee880b96ae Using X headings instead of 0.X #49739 2018-04-07 00:42:47 +05:30
bobtwinkles
bacd120957 Add test from #49736
Fixes #49736
2018-04-06 15:00:45 -04:00
Tyler Mandry
7ac35eaa12 chalkify: Implement Rule Implied-Bound-From-Trait 2018-04-06 13:05:45 -05:00
bors
eeea94c11d Auto merge of #49064 - QuietMisdreavus:piercing-the-veil, r=GuillaumeGomez
rustdoctest: suppress the default allow(unused) under --display-warnings

If you're passing rustdoc `--display-warnings`, you probably want to see the default ones too. This change modifies `test::make_test` to suppress the default `#![allow(unused)]` if the `--display-warnings` CLI flag was provided to rustdoc.

cc https://github.com/rust-lang/rust/issues/41574
2018-04-06 17:38:41 +00:00
bors
7678d5021e Auto merge of #48779 - michaelwoerister:share-generics4, r=alexcrichton
Allow for re-using monomorphizations in upstream crates.

Followup to #48611. This implementation is pretty much finished modulo failing tests if there are any. Not quite ready for review yet though.

### DESCRIPTION

This PR introduces a `share-generics` mode for RLIBs and Rust dylibs. When a crate is compiled in this mode, two things will happen:
- before instantiating a monomorphization in the current crate, the compiler will look for that monomorphization in all upstream crates and link to it, if possible.
- monomorphizations are not internalized during partitioning. Instead they are added to the list of symbols exported from the crate.

This results in less code being translated and LLVMed. However, there are also downsides:
- it will impede optimization somewhat, since fewer functions can be internalized, and
- Rust dylibs will have bigger symbol tables since they'll also export monomorphizations.

Consequently, this PR only enables the `shared-generics` mode for opt-levels `No`, `Less`, `Size`, and `MinSize`, and for when incremental compilation is activated. `-O2` and `-O3` will still generate generic functions per-crate.

Another thing to note is that this has a somewhat similar effect as MIR-only RLIBs, in that monomorphizations are shared, but it is less effective because it cannot share monomorphizations between sibling crates:

```
         A        <--- defines `fn foo<T>() { .. }`
       /   \
      /     \
     B       C    <--- both call `foo<u32>()`
      \     /
       \   /
         D        <--- calls `foo<u32>()` too
```

With `share-generics`, both `B` and `C` have to instantiate `foo<u32>` and only `D` can re-use it (from either `B` or `C`). With MIR-only RLIBs, `B` and `C` would not instantiate anything, and in `D` we would then only instantiate `foo<u32>` once.
On the other hand, when there are many leaf crates in the graph (e.g. when compiling many individual test binaries) then the `share-generics` approach will often be more effective.

### TODO
 - [x] Add codegen test that makes sure monomorphizations can be internalized in non-Rust binaries.
 - [x] Add codegen-units test that makes sure we share generics.
 - [x] Add run-make test that makes sure we don't export any monomorphizations from non-Rust binaries.
 - [x] Review for reproducible-builds implications.
2018-04-06 15:01:27 +00:00
Jorge Aparicio
f9bfd8117a add THUMB targets to rustup manifest 2018-04-06 16:35:03 +02:00
John Kåre Alsaker
4fd188e5f3 Print query stack on ICEs 2018-04-06 16:23:31 +02:00
Jorge Aparicio
1eed662fc4 refactor: simplify needs_gdb_debug_scripts_section 2018-04-06 15:48:06 +02:00
Jorge Aparicio
ea08bdf30c add emit_debug_gdb_scripts target option and ..
set it to false for no-std targets like ARM Cortex-M and MSP430. For the rationale of this change
see the comment in thumb_base.rs
2018-04-06 15:47:57 +02:00
bors
2253216ec5 Auto merge of #49335 - GuillaumeGomez:remove-unneeded-trait-implementations-title, r=QuietMisdreavus
Remove unneeded trait implementations titles

r? @QuietMisdreavus
2018-04-06 12:03:16 +00:00
Michael Woerister
61991a544f Update run-make/symbol-visibility to also cover shared-generics 2018-04-06 12:14:08 +02:00
Michael Woerister
07704a4e1d Allow for re-using hidden monomorphizations on platforms that don't support Rust dylibs. 2018-04-06 12:14:08 +02:00
Michael Woerister
ec55390387 Update a few comments about symbol visibility. 2018-04-06 12:14:08 +02:00
Michael Woerister
69c7f5ccbb Add codegen-units test for shared-generics. 2018-04-06 12:14:08 +02:00
Michael Woerister
94d36cf294 Make sure that generics are internalized in executables even with -Zshare-generics 2018-04-06 12:14:08 +02:00
Michael Woerister
2d2cf0306c Don't internalize generics that are re-exported 2018-04-06 12:14:08 +02:00
Michael Woerister
a1a986cfae Fix some rebasing fallout. 2018-04-06 12:14:08 +02:00
Michael Woerister
213ef111cf Select upstream monomorphizations in a stable way. 2018-04-06 12:14:08 +02:00
Michael Woerister
5316a458b2 Adapt codegen-unit test to shared-generics. 2018-04-06 12:14:08 +02:00
Michael Woerister
9b90674d01 Allow for internalizing monomorphizations that cannot be shared. 2018-04-06 12:14:08 +02:00
Michael Woerister
e203b3ab71 Remove the (inaccurate) symbol_export_level query. 2018-04-06 12:14:08 +02:00
Michael Woerister
8d95c86974 Make generics sharing the default for non-optimized builds. 2018-04-06 12:14:08 +02:00
Michael Woerister
4f6d05dc48 Allow for re-using monomorphizations from upstream crates. 2018-04-06 12:14:08 +02:00
Michael Woerister
435477dc65 Move export level computation to reachable_non_generics query. 2018-04-06 12:14:08 +02:00
Michael Woerister
dad194a10d Allow for representing exported monomorphizations in crate metadata. 2018-04-06 12:14:08 +02:00
Michael Woerister
d3b5451991 Fix incomplete ICH implementation for ty::subst::UnpackedKind. 2018-04-06 12:14:08 +02:00
bors
a143462783 Auto merge of #49154 - petrochenkov:spident, r=eddyb
AST: Give spans to all identifiers

Change representation of `ast::Ident` from `{ name: Symbol, ctxt: SyntaxContext }` to `{ name: Symbol, span: Span }`.
Syntax contexts still can be extracted from spans (`span.ctxt()`).

Why this should not require more memory:
- `Span` is `u32` just like `SyntaxContext`.
- Despite keeping more spans in AST we don't actually *create* more spans, so the number of "outlined" spans kept in span interner shouldn't become larger.

Why this may be slightly slower:
- When we need to extract ctxt from an identifier instead of just field read we need to do bit field extraction possibly followed by and access by index into span interner's vector. Both operations should be fast (unless the span interner is under some synchronization) and we already do ctxt extraction from spans all the time during macro expansion, so the difference should be lost in noise.

cc https://github.com/rust-lang/rust/pull/48842#issuecomment-373365661
2018-04-06 09:32:03 +00:00
Vadim Petrochenkov
1458684279 Fix feature gating for crate/extern in paths 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
3a30bad6de Use Ident instead of Name in MetaItem 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
303298b1d5 Fix stable hash for identifiers 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
bfaf4180ae Make lifetime nonterminals closer to identifier nonterminals 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
b3b5ef186c Remove more duplicated spans 2018-04-06 11:50:49 +03:00
Vadim Petrochenkov
62000c072e Rename ast::Variant_::name into ident + Fix rebase 2018-04-06 11:48:19 +03:00