| Age | Commit message (Collapse) | Author | Lines |
|
- 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.
|
|
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.
|
|
Run analyses before thir-tree dumps
Fixes #83048
|
|
|
|
|
|
Fixes #83048
|
|
|
|
|
|
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.
|
|
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
|
|
rustc: Show `@path` usage in stable
The feature was stabilized in #66172, but the usage string was not updated to be shown.
|
|
|
|
|
|
|
|
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.
|
|
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>
|
|
The feature was stabilized in #66172, but the usage string was not
updated to be shown.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
Replace File::create and write_all with fs::write
Also don't convert to u8 buffers and back
when we are only creating strings.
|
|
Also don't convert to u8 buffers and back
when we are only creating strings.
|
|
Items are guaranteed to be HIR owner.
|
|
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.
|
|
Use Option::map_or instead of `.map(..).unwrap_or(..)`
``@rustbot`` modify labels +C-cleanup +T-compiler
|
|
|
|
Fix -Cpasses=list and llvm version print with -vV
cc https://github.com/rust-lang/rust/pull/77975#issuecomment-759362933
|
|
|
|
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
|
|
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
|
|
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!
|
|
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.
|
|
|
|
... by removing a duplicate `crate_name` field in `interface::Config`,
making it clear that rustdoc should be passing it to `config::Options`
instead.
|
|
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.
|
|
|
|
driver: Only output ANSI logging if connected to a terminal
Fixes #78435.
See #78435 for more.
Cc `@RalfJung` `@oli-obk`
|
|
|
|
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.
|
|
|
|
|
|
cleanup: Remove `ParseSess::injected_crate_name`
Its only remaining use is in pretty-printing where the necessary information can be easily re-computed.
|
|
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`
|
|
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 40f03a1e0d6702add1922f82d716d5b2c23a59f0, so this
completes the work by removing the 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 40f03a1e0d6702add1922f82d716d5b2c23a59f0, so this
completes the work by removing the comment.
|
|
|
|
|
|
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
```
|
|
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`.
|
|
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.
|
|
|
|
See #78435 for more.
|
|
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`
|