Commit graph

122 commits

Author SHA1 Message Date
Jonas Schievink
48c1ca15bb
Rollup merge of #77673 - heckad:patch-2, r=lcnr
Remove unnecessary lamda on emitter map.
2020-10-08 23:23:13 +02:00
Darshan Kathiriya
e8dca789a1 Replace run_compiler with RunCompiler builder pattern.
RunCompiler::new takes non-optional params, and optional
params can be set using set_*field_name* method.
finally `run` will forward all fields to `run_compiler`.
2020-10-08 16:11:45 -03:00
Kazantcev Andrey
dd60ab3e2d
Commit suggestion
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-08 13:58:51 +03:00
Joshua Nelson
8b22d079bf Upgrade to tracing 0.2.13
The primary motivation is to get the changes from
https://github.com/tokio-rs/tracing/pull/990. Example output:

```
$ RUSTDOC_LOG=debug rustdoc +rustc2
warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 = note: the static max level is `info`
 = help: to enable DEBUG logging, remove the `max_level_info` feature
```

- Remove useless test

  This was testing for an ICE when passing `RUST_LOG=rustc_middle`.  I
  noticed it because it started giving the tracing warning (because tests
  are not run with debug-logging enabled). Since this bug seems unlikely
  to re-occur, I just removed it altogether.
2020-10-07 19:27:10 -04:00
Kazantcev Andrey
141544a903
Remove unnecessary lamda on emitter map. 2020-10-08 00:29:20 +03:00
Vadim Petrochenkov
1444ad7ba1 rustc_target: Further simplify loading of built-in targets
using the fact that it is infallible.

JSON roundtrip check on every rustc run is also removed, it's already performed by unit tests.
2020-10-05 19:35:26 +03:00
Yuki Okushi
6e25418474
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung
Use `tracing` spans to trace the entire MIR interp stack

r? @RalfJung

While being very verbose, this allows really good tracking of what's going on. While I considered schemes like the previous indenter that we had (which we could get by using the `tracing-tree` crate), this will break down horribly with things like multithreaded rustc. Instead, we can now use `RUSTC_LOG` to restrict the things being traced. You could specify a filter in a way that only shows the logging of a specific frame.

![screenshot of command line output of the new formatting](https://user-images.githubusercontent.com/332036/89291343-aa40de00-d65a-11ea-9f6c-ea06c1806327.png)

If we lower the span's level to `debug`, then in `info` level logging we'd not see the frames, but in `debug` level we would see them. The filtering rules in `tracing` are super powerful, but  I'm not sure if we can specify a filter so we do see `debug` level events, but *not* the `frame` spans. The documentation at https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/struct.EnvFilter.html makes me think that we can only turn on things, not turn off things at a more precise level.

cc @hawkw
2020-10-04 11:44:49 +09:00
Oliver Scherer
43c181bac4 Use tracing spans to trace the entire MIR interp stack 2020-09-28 20:07:57 +02:00
Ralf Jung
6a8cdbd285
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
Add option to pass a custom codegen backend from a driver

This allows the driver to pass information to the codegen backend. For example the headcrab debugger may in the future want to use cg_clif to JIT code to be injected in the debuggee. This would PR make it possible to tell cg_clif which symbol can be found at which address and to tell it to inject the JITed code into the right process.

This PR may also help with https://github.com/rust-lang/miri/pull/1540 by allowing miri to provide a codegen backend that only emits metadata and doesn't perform any codegen.

cc @nbaksalyar (headcrab)
cc @RalfJung (miri)
2020-09-28 18:39:40 +02:00
bjorn3
71bc62b9f6 Add option to pass a custom codegen backend from a driver 2020-09-27 14:16:42 +02:00
Erik Hofmayer
138a2e5eaa /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
Erik Hofmayer
dd66ea2d3d Updated html_root_url for compiler crates 2020-09-23 21:14:43 +02:00
Matthias Krüger
012974da7a use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip) 2020-09-17 10:13:16 +02:00
Gus Wynn
0be66d7f30 just max_level_info 2020-09-11 09:37:51 -07:00
Gus Wynn
56f5c7f95f comments + add max_level_info so false works with debug_assertions on 2020-09-11 09:01:31 -07:00
Gus Wynn
15aa6f31b9 add debug-logging to config.toml 2020-09-10 16:39:04 -07:00
bors
af3c6e733a Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkov
diagnostics: shorten paths of unique symbols

This is a step towards implementing a fix for #50310, and continuation of the discussion in [Pre-RFC: Nicer Types In Diagnostics - compiler - Rust Internals](https://internals.rust-lang.org/t/pre-rfc-nicer-types-in-diagnostics/11139). Impressed upon me from previous discussion in #21934 that an RFC for this is not needed, and I should just come up with code.

The recent improvements to `use` suggestions that I've contributed have given rise to this implementation. Contrary to previous suggestions, it's rather simple logic, and I believe it only reduces the amount of cognitive load that a developer would need when reading type errors.

-----

If a symbol name can only be imported from one place, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path to the last component.

This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable from anywhere.
2020-09-03 23:27:45 +00:00
Dan Aloni
c5a61319da rustc_driver: have TrimmedDefPaths::GoodPath only for rustc
`run_compiler` is used by clippy and other tools, which should not have
the trimmed paths feature enabled by default, until we see it works well
for them.

Would also be nice to rename `TimePassesCallbacks` however it's a
submodule change.
2020-09-03 09:41:43 +03:00
Dan Aloni
07e7823c01 pretty: trim paths of unique symbols
If a symbol name can only be imported from one place for a type, and
as long as it was not glob-imported anywhere in the current crate, we
can trim its printed path and print only the name.

This has wide implications on error messages with types, for example,
shortening `std::vec::Vec` to just `Vec`, as long as there is no other
`Vec` importable anywhere.

This adds a new '-Z trim-diagnostic-paths=false' option to control this
feature.

On the good path, with no diagnosis printed, we should try to avoid
issuing this query, so we need to prevent trimmed_def_paths query on
several cases.

This change also relies on a previous commit that differentiates
between `Debug` and `Display` on various rustc types, where the latter
is trimmed and presented to the user and the former is not.
2020-09-02 22:26:37 +03:00
marmeladema
99c96c5bfe driver: replace lazy_static by SyncLazy from std 2020-09-01 22:06:47 +01:00
marmeladema
68500ffacb datastructures: replace once_cell crate with an impl from std 2020-08-30 20:06:14 +01:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00