Commit Graph

115 Commits

Author SHA1 Message Date
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Mark Rousskov b8a040fc5f Remove tx_to_llvm_workers from TyCtxt
This can be kept within the codegen backend crates entirely
2019-09-25 16:57:27 -04:00
Guanqun Lu 5355a16150 use println!() 2019-09-15 23:15:06 +08:00
Mark Rousskov 41b39fce98 Remove rustc_diagnostic_macros feature 2019-09-05 12:35:18 -04:00
Mark Rousskov b437240cee Replace diagnostic plugins with macro_rules 2019-09-05 12:35:15 -04:00
Alex Crichton 1a4330d2a2 rustc: Handle modules in "fat" LTO more robustly
When performing a "fat" LTO the compiler has a whole mess of codegen
units that it links together. To do this it needs to select one module
as a "base" module and then link everything else into this module.
Previously LTO passes assume that there's at least one module in-memory
to link into, but nowadays that's not always true! With incremental
compilation modules may actually largely be cached and it may be
possible that there's no in-memory modules to work with.

This commit updates the logic of the LTO backend to handle modules a bit
more uniformly during a fat LTO. This commit immediately splits them
into two lists, one serialized and one in-memory. The in-memory list is
then searched for the largest module and failing that we simply
deserialize the first serialized module and link into that. This
refactoring avoids juggling three lists, two of which are serialized
modules and one of which is half serialized and half in-memory.

Closes #63349
2019-08-27 13:51:14 -07:00
Alex Crichton d05c4d5459 Deduplicate rustc_demangle in librustc_codegen_llvm
This commit removes the crates.io dependency of `rustc-demangle` from
`rustc_codegen_llvm`. This crate is actually already pulled in to part
of the `librustc_driver` build and with the upcoming pipelining
implementation in Cargo it causes build issues if `rustc-demangle` is
left to its own devices.

This is not currently required, but once pipelining is enabled for
rustc's own build it will be required to build correctly.
2019-07-31 15:04:25 -07:00
Vadim Petrochenkov 676d282dd3 Deny `unused_lifetimes` through rustbuild 2019-07-28 18:47:02 +03:00
Vadim Petrochenkov 434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Vadim Petrochenkov a93fdfedf3 Merge `rustc_allocator` into `libsyntax_ext` 2019-07-24 12:27:58 +03:00
Alex Crichton 345ba505ec rustc: Remove `dylib` crate type from most rustc crates
Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!
2019-07-07 03:23:00 +02:00
Mazdak Farrokhzad 485a084b45
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Implement another internal lints

cc #49509

This adds ~~two~~ one internal lint~~s~~:
1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669
2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~

~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~

TODO (not directly relevant for review):
- [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) 🤔 cc @eddyb)
- [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870
- [x] Check explicitly for the `{declare,impl}_lint_pass!` macros

r? @oli-obk
2019-07-05 20:26:51 +02:00
Mazdak Farrokhzad 88c007cd04
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
Jeremy Stucki ec711767a7
Remove needless lifetimes 2019-07-03 10:01:02 +02:00
Chris Gregory b0c199a969 Enable mem_take feature in relevant crates 2019-07-01 20:21:53 -07:00
flip1995 084c829fb8
Enable internal lints in bootstrap 2019-06-24 10:45:20 +02:00
Matthew Jasper d0311e7154 Deny explicit_outlives_requirements in the compiler 2019-06-22 17:13:19 +01:00
Eduard-Mihai Burtescu 356a37d8d1 rustc: remove unused lifetimes. 2019-06-18 18:10:26 +03:00
Eduard-Mihai Burtescu b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Eduard-Mihai Burtescu afc39bbf24 Run `rustfmt --file-lines ...` for changes from previous commits. 2019-06-14 18:58:32 +03:00
Eduard-Mihai Burtescu f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu 4c98cb6f75 rustc_codegen_llvm: `deny(internal)`. 2019-06-12 16:06:35 +03:00
Eduard-Mihai Burtescu 87b6b86468 rustc_codegen_llvm: `deny(unused_lifetimes)`. 2019-06-12 16:02:03 +03:00
Eduard-Mihai Burtescu fff08cb043 Run `rustfmt --file-lines ...` for changes from previous commits. 2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu 17cdd356da rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu 37799a5552 rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`. 2019-06-12 13:38:27 +03:00
Vadim Petrochenkov 8049e6199b Remove unused `#![feature(custom_attribute)]`s 2019-06-08 23:55:24 +03:00
Mark Mansi c747f31ffc remove unneeded deps 2019-06-02 22:56:37 -05:00
Mark Mansi e21d002bd2 move codegenunitext to rustc::mir::mono 2019-06-02 22:55:29 -05:00
Eduard-Mihai Burtescu 25d6834493 rustc_codegen_llvm: replace `fn noname()` with `const UNNAMED`. 2019-06-01 21:13:08 +03:00
Eduard-Mihai Burtescu 29b7c0687e rustc_codegen_llvm: remove LLVM instruction count stats. 2019-05-29 01:43:57 +03:00
Nicholas Nethercote faf5eac854 Move metadata encoding earlier.
This commit separates metadata encoding (`tcx.encode_metadata`) from the
creation of the metadata module (which is now handled by
`write_compressed_metadata`, formerly `write_metadata`).

The metadata encoding now occurs slightly earlier in the pipeline, at
the very start of code generation within `start_codegen`.

Metadata *writing* still occurs near the end of compilation; that will
be moved forward in subsequent commits.
2019-04-30 14:55:10 +10:00
Nicholas Nethercote 7bcb0cffb6 In JSON output, emit a directive after metadata is generated.
To implement pipelining, Cargo needs to know when metadata generation is
finished. This commit adds code to do that. Unfortunately, metadata file
writing currently occurs very late during compilation, so pipelining
won't produce a speed-up. Moving metadata file writing earlier will be a
follow-up.

The change involves splitting the existing `Emitter::emit` method in
two: `Emitter::emit_diagnostic` and `Emitter::emit_directive`.

The JSON directives look like this:
```
{"directive":"metadata file written: liba.rmeta"}
```
The functionality is behind the `-Z emit-directives` option, and also
requires `--error-format=json`.
2019-04-30 08:51:57 +10:00
bjorn3 dd4566f511 Remove cg_llvm/back/link.rs 2019-04-20 13:21:40 +02:00
bjorn3 93a3b414e3 Move almost all of cg_llvm/back/link.rs to cg_ssa 2019-04-20 13:21:40 +02:00
Yuki OKUSHI 9ad56e3b94 Rename modules 2019-04-17 18:21:34 +09:00
Wesley Wiser 56e434d84d Use measureme in self-profiler
Related to #58372
Related to #58967
2019-04-12 20:27:29 -04:00
bjorn3 35705dee7e Use ExactSizeIterator + TrustedLen instead of num_cases arg for switch 2019-03-29 17:23:52 +01:00
Simonas Kazlauskas 8d4afbe413 Use informational target machine for metadata
Since there is nothing to optimise there...
2019-03-27 04:03:42 +02:00
kennytm 6241fb55ba
Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapin
Stabilize Range*::contains.

Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
2019-03-16 22:40:23 +08:00
Steven Malis 266ca31f74 Stabilize Range*::contains. 2019-03-12 21:00:37 -07:00
Wesley Wiser 4c8cc14186 Replace TimeLine with SelfProfiler 2019-03-10 11:10:55 -04:00
John Kåre Alsaker 51938c61f6 Make the rustc driver and interface demand driven 2019-03-10 04:49:45 +01:00
Gabriela Alexandra Moldovan cd9a0cf537 Make the lifetime parameters of tcx consistent. 2019-03-04 23:49:04 +00:00
Mazdak Farrokhzad 9661a81968 librustc_codegen_llvm: deny(elided_lifetimes_in_paths) 2019-02-25 08:40:18 +01:00
Gabriela Alexandra Moldovan 36f18f2d3a Allow Self::Module to be mutated.
`codegen_allocator` and `write_metadata` mutate the underlying LLVM module. As
such, it makes sense for these two functions to receive a mutable reference to
the module (as opposed to an immutable one).
2019-02-20 21:35:34 +00:00
Taiki Endo 1b7ca961d9 librustc_codegen_llvm => 2018 2019-02-18 03:58:58 +09:00
kennytm f05e6bf708
Rollup merge of #58074 - scottmcm:stabilize-sort_by_cached_key, r=SimonSapin
Stabilize slice_sort_by_cached_key

I was going to ask on the tracking issue (https://github.com/rust-lang/rust/issues/34447), but decided to just send this and hope for an FCP here.  The method was added last March by https://github.com/rust-lang/rust/pull/48639.

Signature: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key
```rust
impl [T] {
    pub fn sort_by_cached_key<K, F>(&mut self, f: F)
        where F: FnMut(&T) -> K, K: Ord;
}
```

That's an identical signature to the existing `sort_by_key`, so I think the questions are just naming, implementation, and the usual "do we want this?".

The implementation seems to have proven its use in rustc at least, which many uses: https://github.com/rust-lang/rust/search?l=Rust&q=sort_by_cached_key

(I'm asking because it's exactly what I just needed the other day:
```rust
    all_positions.sort_by_cached_key(|&n|
        data::CITIES.iter()
            .map(|x| *metric_closure.get_edge(n, x.pos).unwrap())
            .sum::<usize>()
    );
```
since caching that key is a pretty obviously good idea.)

Closes #34447
2019-02-16 14:11:28 +08:00
Scott McMurray 3777b86f9b Stabilize slice_sort_by_cached_key 2019-02-12 22:26:44 -08:00
Alex Crichton e983b4f64e rustc: Implement incremental "fat" LTO
Currently the compiler will produce an error if both incremental
compilation and full fat LTO is requested. With recent changes and the
advent of incremental ThinLTO, however, all the hard work is already
done for us and it's actually not too bad to remove this error!

This commit updates the codegen backend to allow incremental full fat
LTO. The semantics are that the input modules to LTO are all produce
incrementally, but the final LTO step is always done unconditionally
regardless of whether the inputs changed or not. The only real
incremental win we could have here is if zero of the input modules
changed, but that's so rare it's unlikely to be worthwhile to implement
such a code path.

cc #57968
cc rust-lang/cargo#6643
2019-02-12 04:58:31 -08:00