Commit graph

176 commits

Author SHA1 Message Date
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
bjorn3 2f6662da85 Use strip_prefix 2021-07-29 11:54:39 +02:00
bjorn3 cd6c0e4e3b Fix typo in rustc_driver::version
This caused rustc -Zcodegen-backend=foo.so -vV to look for oo.so instead of
foo.so
2021-07-28 16:36:01 +02:00
Smitty e8165e7f1b Support -Z unpretty=thir-tree again 2021-07-24 17:18:15 -04:00
bors 1aa6c7cbc6 Auto merge of #80182 - in42:stack_trace, r=tmandry
Implement printing of stack traces on LLVM segfaults and aborts

Implement #79153

Based on discussion, try to extend the rust_backtrace=1 feature to handle segfault or aborts in the llvm backend
2021-07-02 05:40:51 +00:00
Tyler Mandry 162ed4d7da Use signal handler only on supported platforms 2021-07-02 01:23:25 +00:00
bors 1034282bca Auto merge of #86617 - joshtriplett:prune-dependencies, r=Mark-Simulacrum
Remove unused dependencies from compiler crates

Various compiler crates have dependencies that they don't appear to use. I used some scripting to detect such dependencies, filtered them based on some manual review, and removed those that do indeed appear to be entirely unused.
2021-07-01 03:49:47 +00:00
bors 866335b337 Auto merge of #86757 - JohnTitor:rollup-acevhz7, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #85504 (the foundation owns rust trademarks)
 - #85520 (Fix typo and improve documentation for E0632)
 - #86680 (Improve error for missing -Z with debugging option)
 - #86728 (Check node kind to avoid ICE in `check_expr_return()`)
 - #86740 (copy rust-lld as ld in dist)
 - #86746 (Fix rustdoc query type filter)
 - #86750 (Test cross-crate usage of `feature(const_trait_impl)`)
 - #86755 (alloc: `RawVec<T, A>::shrink` can be in `no_global_oom_handling`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-01 01:08:46 +00:00
Yuki Okushi 56ddef8ab8
Rollup merge of #86680 - camsteffen:dbg-opt-error, r=petrochenkov
Improve error for missing -Z with debugging option

Before:
```text
❯ rustc --unpretty=hir
error: Unrecognized option: 'unpretty'
```
After:
```text
❯ rustc --unpretty=hir
error: Unrecognized option: 'unpretty'. Did you mean `-Z unpretty`?
```
2021-07-01 05:20:57 +09:00
Camille GILLOT aa1bc5874e Fix AST pretty. 2021-06-30 20:53:10 +02:00
Camille GILLOT 2f28737ebe Move AST crate. 2021-06-30 20:53:10 +02:00
Cameron Steffen 2a60f090b9 Add suggestion for missing compile flag group 2021-06-30 13:28:15 -05:00
Fabian Wolff a8b57723d4 Use Option::map() instead of if let 2021-06-26 22:26:26 +02:00
Fabian Wolff 7682e87c6d Fix ICE with -Zunpretty=hir,typed when an expression occurs in a function signature 2021-06-26 16:05:53 +02:00
Josh Triplett 8f7839f722 rustc_driver: Remove unused dependencies rustc_mir_build and rustc_typeck
Unused since commit dc3eabd487
("Store THIR in `IndexVec`s instead of an `Arena`").
2021-06-25 01:12:59 -07:00
bors 50a9081216 Auto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726
Allow changing the bug report url for the ice hook

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/1174
2021-06-25 04:06:32 +00:00
Aris Merchant 0bb6bc40ce Teach rustc to accept lowercase error codes 2021-06-22 22:56:38 -07:00
Tyler Mandry ec6a85a536 Small fixes 2021-06-16 01:44:18 +00:00
Vikram Pal 2325966003 Implement printing of stack traces on LLVM segfaults and aborts 2021-06-16 01:43:20 +00:00
bjorn3 7d5c79497c Rustfmt 2021-06-04 13:20:05 +02:00
bjorn3 c1b66379dd Support --version and -Cpasses=list for other codegen backends 2021-06-04 13:20:04 +02:00
bjorn3 1870f9b05f Allow printing the version of the default codegen backend if it isn't llvm 2021-06-04 13:20:04 +02:00
bjorn3 a702729aac Turn a regular comment on Compilation into a doc comment 2021-06-04 13:20:04 +02:00
bjorn3 048fe539e4 Don't invoke the default panic hook from report_ice 2021-05-24 18:47:16 +02:00
bors f94942d842 Auto merge of #83842 - LeSeulArtichaut:thir-vec, r=nikomatsakis
Store THIR in `IndexVec`s instead of an `Arena`

This is a necessary step to store the THIR in a query: #85273. See [relevant discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/278509-project-thir-unsafeck/topic/THIR-dependent.20queries.20design).

r? `@ghost` cc `@cjgillot` `@nikomatsakis`
2021-05-19 18:41:23 +00:00
LeSeulArtichaut dc3eabd487 Store THIR in IndexVecs instead of an Arena 2021-05-19 16:03:35 +02:00
Camille GILLOT 1fb9cad50a Use () for analysis. 2021-05-12 14:01:16 +02:00
bors ac923d94f8 Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot
rustc_driver cleanup

Best reviewed one commit at a time.
2021-05-12 08:38:03 +00:00
bjorn3 163b4801e7 Run save_analysis even when analysis returned an error 2021-05-03 13:44:13 +02:00
bjorn3 b71cd56e48 Move queries.crate_name() 2021-05-02 18:12:48 +02:00
bjorn3 b25292473a Simplify make_input 2021-05-02 18:12:48 +02:00
bjorn3 673c1b6e49 Remove unnecessary argument 2021-05-02 18:00:20 +02:00
bjorn3 c752ee53ae Tiny cleanup 2021-05-02 18:00:20 +02:00
bjorn3 2acdc87700 Inline process_rlink into try_process_rlink 2021-05-02 18:00:20 +02:00
bjorn3 2fa7175293 Document a few things 2021-05-02 18:00:20 +02:00
bjorn3 b5e049de08 Remove dummy_config 2021-05-02 17:59:48 +02:00
Dylan DPC e00893b715
Rollup merge of #83895 - eggyal:issue-83883, r=jyn514
Add listing of lints (eg via `-W help`) to rustdoc

Fixes #83883

r? `@jyn514`
2021-04-06 17:42:31 +02:00
Alan Egerton 4d23c8e9a1
Add listing of lints (eg via -W help) to rustdoc 2021-04-06 09:54:56 +01:00
bors 354cc751b7 Auto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco
Find codegen backends in more locations

* Search in the sysroot passed using `--sysroot` in addition to the default sysroot.
* Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`.

This combined would allow putting `librustc_codegen_cranelift.so` in the right location of a sysroot passed using `--sysroot`.
2021-04-06 07:16:19 +00:00
bjorn3 cab940e848 Merge two consecutive tcx.analysis() calls 2021-03-30 09:19:46 +02:00
Joshua Nelson de0fda9558 Address review comments
- Add back `HirIdVec`, with a comment that it will soon be used.
- Add back `*_region` functions, with a comment they may soon be used.
- Remove `-Z borrowck_stats` completely. It didn't do anything.
- Remove `make_nop` completely.
- Add back `current_loc`, which is used by an out-of-tree tool.
- Fix style nits
- Remove `AtomicCell` with `cfg(parallel_compiler)` for consistency.
2021-03-27 22:16:34 -04:00
Joshua Nelson 441dc3640a Remove (lots of) dead code
Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.
2021-03-27 22:16:33 -04:00
bors 2e012ce681 Auto merge of #83050 - osa1:issue83048, r=matthewjasper
Run analyses before thir-tree dumps

Fixes #83048
2021-03-24 12:02:13 +00:00
Eric Huss 45583e56c0 Change -W help to display edition level. 2021-03-22 12:57:52 -07:00
hyd-dev d7ab3c77b3
Add rustc_interface::interface::Config::parse_sess_created 2021-03-15 18:24:58 +08:00
Ömer Sinan Ağacan b24902ea18 Run analyses before thir-tree dumps
Fixes #83048
2021-03-12 10:08:44 +03:00
LeSeulArtichaut 6bf4147646 Add -Z unpretty flag for the THIR 2021-03-11 19:42:40 +01:00
Oli Scherer 62f2d72330 Bump tracing-tree dependency 2021-03-09 16:44:51 +00:00
bors 7f32f62aa5 Auto merge of #82304 - LeSeulArtichaut:unpretty-ast, r=spastorino
Add `-Z unpretty` flags for the AST

Implements rust-lang/compiler-team#408.
Builds on #82269, but if that PR is rejected or stalls out, I can implement this without #82269.
cc rust-lang/rustc-dev-guide#1062
2021-03-04 05:46:43 +00:00
LeSeulArtichaut 61114453ae Add -Z unpretty flags for the AST 2021-03-03 15:11:26 +01:00
Tomasz Miąsko 2abe7c8f9c Update tracing to 0.1.25 2021-02-28 11:24:24 +01:00
Aaron Hill 8c0119da77
Rollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorino
Cleanup `PpMode` and friends

This PR:
 - Separates `PpSourceMode` and `PpHirMode` to remove invalid states
 - Renames the variant to remove the redundant `Ppm` prefix
 - Adds basic documentation for the different pretty-print modes
 - Cleanups some code to make it more idiomatic

Not sure if this is actually useful, but it looks cleaner to me.
2021-02-25 16:06:16 -05:00
bors d2b38d6b3c Auto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #80595 (`impl PartialEq<Punct> for char`; symmetry for #78636)
 - #81991 (Fix panic in 'remove semicolon' when types are not local)
 - #82176 (fix MIR fn-ptr pretty-printing)
 - #82244 (Keep consistency in example for Stdin StdinLock)
 - #82260 (rustc: Show ``@path`` usage in stable)
 - #82316 (Fix minor mistake in LTO docs.)
 - #82332 (Don't generate src link on dummy spans)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-20 21:38:53 +00:00
Guillaume Gomez 8c095619cb
Rollup merge of #82260 - ojeda:rustc-argfile, r=jyn514
rustc: Show `@path` usage in stable

The feature was stabilized in #66172, but the usage string was not updated to be shown.
2021-02-20 20:37:02 +01:00
LeSeulArtichaut dd3772e4f0 A few more code cleanups 2021-02-19 19:19:50 +01:00
Camille GILLOT 4dbf83a209 Move try_print_query_stack to rustc_interface. 2021-02-19 17:51:55 +01:00
LeSeulArtichaut 3ed189e8af Cleanup PpMode and friends 2021-02-19 17:50:23 +01:00
Dylan DPC d9bc16cf36
Rollup merge of #82261 - ojeda:rustdoc-argfile, r=jyn514
rustdoc: Support argument files

Factors out the `rustc_driver` logic that handles argument files so that rustdoc supports them as well, e.g.:

    rustdoc `@argfile`

This is needed to be able to generate docs for projects that already use argument files when compiling them, e.g. projects that pass a huge number of `--cfg` arguments.

The feature was stabilized for `rustc` in #66172.
2021-02-19 02:49:12 +01:00
Miguel Ojeda 755b3fc722 rustdoc: Support argument files
Factors out the `rustc_driver` logic that handles argument files
so that rustdoc supports them as well, e.g.:

    rustdoc @argfile

This is needed to be able to generate docs for projects that
already use argument files when compiling them, e.g. projects
that pass a huge number of `--cfg` arguments.

The feature was stabilized for `rustc` in #66172.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-19 02:32:45 +01:00
Miguel Ojeda 9b9c5eaa5c rustc: Show @path usage in stable
The feature was stabilized in #66172, but the usage string was not
updated to be shown.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-18 16:10:28 +01:00
Guillaume Gomez d382771d3a
Rollup merge of #82174 - est31:master, r=oli-obk
Replace File::create and write_all with fs::write

Also don't convert to u8 buffers and back
when we are only creating strings.
2021-02-17 20:38:01 +01:00
est31 e527def9c7 Replace File::create and write_all with fs::write
Also don't convert to u8 buffers and back
when we are only creating strings.
2021-02-16 14:19:32 +01:00
Camille GILLOT cebbba081e Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
bjorn3 7f19a2d2de Find codegen backends in more locations
* Search in the sysroot passed using `--sysroot` in addition to the
  default sysroot.
* Search for `librustc_codegen_$name.so` in addition to
  `librustc_codegen_$name-$release.so`.
2021-02-01 19:29:31 +01:00
Tyson Nottingham 849dc1a20c Indicate both start and end of pass RSS in time-passes output
Previously, only the end of pass RSS was indicated. This could easily
lead one to believe that the change in RSS from one pass to the next was
attributable to the second pass, when in fact it occurred between the
end of the first pass and the start of the second.

Also, improve alignment of columns.
2021-01-29 12:46:29 -08:00
Yuki Okushi a584d87417
Rollup merge of #80944 - LingMan:map_or, r=nagisa
Use Option::map_or instead of `.map(..).unwrap_or(..)`

``@rustbot`` modify labels +C-cleanup +T-compiler
2021-01-15 18:26:14 +09:00
LingMan a56bffb4f9 Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
Mara Bos ce3bc76a86
Rollup merge of #80981 - bjorn3:bjorn3-patch-1, r=jonas-schievink
Fix -Cpasses=list and llvm version print with -vV

cc https://github.com/rust-lang/rust/pull/77975#issuecomment-759362933
2021-01-14 18:00:25 +00:00
bjorn3 64c1b0d614
Fix -Cpasses=list and llvm version print with -vV 2021-01-13 12:15:42 +01:00
Dylan DPC 7ce8246a23
Rollup merge of #80859 - jsgf:fix-pretty-remap, r=davidtwco
Fix --pretty=expanded with --remap-path-prefix

Per https://github.com/rust-lang/rust/issues/80832, using
--pretty=expanded and --remap-path-prefix results in an ICE.

This is becasue the session source files table is stored in remapped
form, whereas --pretty-expanded looks up unremapped files. This remaps
the path prefixes before lookup.

~~There don't appear to be any existing tests for --pretty=expanded; I'll look into
adding some.~~ Never mind, found the pretty tests.

Fixes #80832
2021-01-13 03:20:21 +01:00
Camelid 8c43160744 driver: Use atty instead of rolling our own
Rationale:

- `atty` is widely used in the Rust ecosystem
- We already use it (in `rustc_errors` and other places)
- We shouldn't be rolling our own TTY detector when there's a
  widely-used, well-tested package that we can use
2021-01-11 19:59:25 -08:00
Camelid 7af29abbc1 log-color: Detect TTY based on stderr, not stdout
Logging goes to stderr, not stdout, so we should base our automated
detection on stderr instead of stdout.

Thanks to Ralf Jung for noticing and reporting the bug!
2021-01-10 13:22:15 -08:00
Jeremy Fitzhardinge 67978d56c1 Fix --pretty=expanded with --remap-path-prefix
Per https://github.com/rust-lang/rust/issues/80832, using
--pretty=expanded and --remap-path-prefix results in an ICE.

This is becasue the session source files table is stored in remapped
form, whereas --pretty-expanded looks up unremapped files. This remaps
the path prefixes before lookup.
2021-01-09 18:55:50 -08:00
Matthias Krüger bdc9291ed9 where possible, pass slices instead of &Vec or &String (clippy::ptr_arg) 2020-12-30 13:11:52 +01:00
Joshua Nelson 878cfb5a4a Fix unknown-crate when using self-profile with rustdoc
... by removing a duplicate `crate_name` field in `interface::Config`,
making it clear that rustdoc should be passing it to `config::Options`
instead.
2020-12-01 12:54:03 -05:00
bors 72da5a9d85 Auto merge of #77671 - flip1995:lint_list_always_plugins, r=oli-obk,Manishearth
Always print lints from plugins, if they're available

Currently you can get a list of lints and lint groups by running `rustc
-Whelp`. This prints an additional line at the end:
```
Compiler plugins can provide additional lints and lint groups. To see a listing of these, re-run `rustc -W help` with a crate filename.
```

Clippy is such a "compiler plugin", that provides additional lints.
Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the
rustc lints with the above message at the end. But when running
`clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it
also prints Clippy lints. I don't think this is a good approach from a
UX perspective: Why is a random file necessary to print a help message?

This PR changes this behavior: Whenever a compiler callback
registers lints, it is assumed that these lints come from a plugin and
are printed without having to specify a Rust source file.

Fixes rust-lang/rust-clippy#6122

cc `@Manishearth` `@ebroto` for the Clippy changes.
2020-11-26 18:51:45 +00:00
flip1995 e54c0600b4
Reword message at the end of the output if not run with a lint tool 2020-11-25 13:16:36 +01:00
bors 1c389ffeff Auto merge of #78548 - camelid:driver-tty, r=oli-obk
driver: Only output ANSI logging if connected to a terminal

Fixes #78435.

See #78435 for more.

Cc `@RalfJung` `@oli-obk`
2020-11-24 20:58:20 +00:00
flip1995 13db749c4b
Cleanup message at the end of the lint list output 2020-11-24 10:37:15 +01:00
flip1995 4daa263e0b
Always print lints from plugins, if they're available
Currently you can get a list of lints and lint groups by running `rustc
-Whelp`. This prints an additional line at the end:
```
Compiler plugins can provide additional lints and lint groups. To see a
listing of these, re-run `rustc -W help` with a crate filename.
```

Clippy is such a "compiler plugin", that provides additional lints.
Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the
rustc lints with the above message at the end. But when running
`clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it
also prints Clippy lints. I don't think this is a good approach from a
UX perspective: Why is a random file necessary to print a help message?

This commit changes this behavior: Whenever a compiler callback
registers lints, it is assumed that these lints come from a plugin and
are printed without having to specify a Rust source file.
2020-11-24 10:37:15 +01:00
Camelid 173a7dbace Use early_error 2020-11-23 17:39:18 -08:00
Eduard-Mihai Burtescu 5ed2d42334 Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout. 2020-11-20 19:34:44 +02:00
Jonas Schievink f32191f78f
Rollup merge of #79005 - petrochenkov:noinjected, r=davidtwco
cleanup: Remove `ParseSess::injected_crate_name`

Its only remaining use is in pretty-printing where the necessary information can be easily re-computed.
2020-11-15 13:39:46 +01:00
Jonas Schievink 8825942e86
Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis
Allow making `RUSTC_BOOTSTRAP` conditional on the crate name

Motivation: This came up in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Require.20users.20to.20confirm.20they.20know.20RUSTC_.E2.80.A6.20compiler-team.23350/near/208403962) for https://github.com/rust-lang/compiler-team/issues/350.
See also https://github.com/rust-lang/cargo/pull/6608#issuecomment-458546258; this implements https://github.com/rust-lang/cargo/issues/6627.
The goal is for this to eventually allow prohibiting setting `RUSTC_BOOTSTRAP` in build.rs (https://github.com/rust-lang/cargo/issues/7088).

## User-facing changes

- `RUSTC_BOOTSTRAP=1` still works; there is no current plan to remove this.
- Things like `RUSTC_BOOTSTRAP=0` no longer activate nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway.
- `RUSTC_BOOTSTRAP=x` will enable nightly features only for crate `x`.
- `RUSTC_BOOTSTRAP=x,y` will enable nightly features only for crates `x` and `y`.

## Implementation changes

The main change is that `UnstableOptions::from_environment` now requires
an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how.

Other major changes:

- Added `Session::is_nightly_build()`, which uses the `crate_name` of
the session
- Added `nightly_options::match_is_nightly_build`, a convenience method
for looking up `--crate-name` from CLI arguments.
`Session::is_nightly_build()`should be preferred where possible, since
it will take into account `#![crate_name]` (I think).
- Added `unstable_features` to `rustdoc::RenderOptions`

I'm not sure whether this counts as T-compiler or T-lang; _technically_ RUSTC_BOOTSTRAP is an implementation detail, but it's been used so much it seems like this counts as a language change too.

r? `@joshtriplett`
cc `@Mark-Simulacrum` `@hsivonen`
2020-11-15 13:39:43 +01:00
Dylan DPC 96515ccc7a
Rollup merge of #79013 - jryans:cleanup-use-once-pretty-comment, r=Mark-Simulacrum
Clean up outdated `use_once_payload` pretty printer comment

While reading some parts of the pretty printer code, I noticed this old comment
which seemed out of place. The `use_once_payload` this outdated comment mentions
was removed in 2017 in 40f03a1e0d, so this
completes the work by removing the comment.
2020-11-15 03:03:01 +01:00
J. Ryan Stinnett bd0fba207b Clean up outdated use_once_payload pretty printer comment
While reading some parts of the pretty printer code, I noticed this old comment
which seemed out of place. The `use_once_payload` this outdated comment mentions
was removed in 2017 in 40f03a1e0d, so this
completes the work by removing the comment.
2020-11-13 05:34:03 +00:00
Vadim Petrochenkov 8766c0452c cleanup: Remove ParseSess::injected_crate_name 2020-11-13 00:59:57 +03:00
Joshua Nelson 6e9ed8b486 Enable thread names in debug logging only for parallel_compiler 2020-11-11 13:28:30 -05:00
Joshua Nelson 9cf8a49f5d Don't print thread ids and names in tracing logs
Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: #437
2:rustcRegion interner: #355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: #437
Region interner: #355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```
2020-11-10 17:32:29 -05:00
Joshua Nelson 622c48e4f1 Allow making RUSTC_BOOTSTRAP conditional on the crate name
The main change is that `UnstableOptions::from_environment` now requires
an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how.

Other major changes:

- Added `Session::is_nightly_build()`, which uses the `crate_name` of
the session
- Added `nightly_options::match_is_nightly_build`, a convenience method
for looking up `--crate-name` from CLI arguments.
`Session::is_nightly_build()`should be preferred where possible, since
it will take into account `#![crate_name]` (I think).
- Added `unstable_features` to `rustdoc::RenderOptions`

  There is a user-facing change here: things like `RUSTC_BOOTSTRAP=0` no
  longer active nightly features. In practice this shouldn't be a big
  deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone
  uses `RUSTC_BOOTSTRAP=1` anyway.

- Add tests

  Check against `Cheat`, not whether nightly features are allowed.
  Nightly features are always allowed on the nightly channel.

- Only call `is_nightly_build()` once within a function

- Use booleans consistently for rustc_incremental

  Sessions can't be passed through threads, so `read_file` couldn't take a
  session. To be consistent, also take a boolean in `write_file_header`.
2020-11-07 13:45:11 -05:00
Camelid 8ad1a1cf39 driver: Add env var to control log colors
The log color variable is whatever the log variable is (`RUSTC_LOG`,
`RUSTDOC_LOG`, `MIRI_LOG`, etc.) + `_COLOR`. So `RUSTC_LOG_COLOR`,
`RUSTDOC_LOG_COLOR`, `MIRI_LOG_COLOR`, etc.

Thanks to @RalfJung for suggesting this! It was much easier to implement
than adding a new unstable argument, which is what I tried before.
2020-10-30 14:11:46 -07:00
Joshua Nelson 57c6ed0c07 Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
Camelid d282aca273 driver: Only output ANSI if connected to a terminal
See #78435 for more.
2020-10-29 16:54:59 -07:00
bors 35debd4c11 Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
Add cg_clif as optional codegen backend

Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases.

This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`.

MCP: https://github.com/rust-lang/compiler-team/issues/270

r? `@Mark-Simulacrum`
2020-10-26 16:31:38 +00:00
bjorn3 cf798c1ec6 Add support for using cg_clif to bootstrap rustc 2020-10-26 09:52:59 +01:00
Dylan DPC 0e4d19603b
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk
ICEs should always print the top of the query stack

see #76920
2020-10-16 02:10:09 +02:00
est31 4fa5578774 Replace target.target with target and target.ptr_width with target.pointer_width
Preparation for a subsequent change that replaces
rustc_target::config::Config with its wrapped Target.

On its own, this commit breaks the build. I don't like making
build-breaking commits, but in this instance I believe that it
makes review easier, as the "real" changes of this PR can be
seen much more easily.

Result of running:

find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \;
find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \;
find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \;
./x.py fmt
2020-10-15 12:02:24 +02:00
Dylan DPC 17ee28b71f
Rollup merge of #77795 - bjorn3:codegen_backend_interface_refactor, r=oli-obk
Codegen backend interface refactor

This moves several things away from the codegen backend to rustc_interface. There are a few behavioral changes where previously the incremental cache (incorrectly) wouldn't get finalized, but now it does. See the individual commit messages.
2020-10-14 02:30:38 +02:00
bors 25d2d09da7 Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
Replace run_compiler with RunCompiler builder pattern

Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.
2020-10-11 01:26:06 +00:00
bjorn3 69f26b7761 Use fixed type for CodegenResults
This also moves the -Zno-link implementation to rustc_interface
2020-10-10 16:18:36 +02:00