| Age | Commit message (Collapse) | Author | Lines |
|
Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.
Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.
Some notes:
* This code attempts to present the breakdown of each variant for
every enum in the MIR. This is meant to guide decisions about how to
revise representations e.g. when to box payloads for rare variants
to shrink the size of the enum overall.
* I left out the "Total:" line that hir-stats presents, because this
implementation uses the MIR Visitor infrastructure, and the memory
usage of structures directly embedded in other structures (e.g. the
`func: Operand` in a `TerminatorKind:Call`) is not distinguished
from similar structures allocated in a `Vec` (e.g. the `args:
Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
summation of all the accumulated sizes is misleading, because it
will double-count the contribution of the `Operand` of the `func` as
well as the size of the whole `TerminatorKind`.
* I did consider abandoning the MIR Visitor and instead hand-coding
a traversal that distinguished embedded storage from indirect
storage. But such code would be fragile; better to just require
people to take care when interpreting the presented results.
* This traverses the `mir.promoted` rvalues to capture stats for MIR
stored there, even though the MIR visitor super_mir method does not
do so. (I did not observe any promoted mir being newly traversed when
compiling the rustc crate, however.)
* It might be nice to try to unify this code with hir-stats. Then
again, the reporting portion is the only common code (I think), and
it is small compared to the visitors in hir-stats and mir-stats.
|
|
add a `-Z incremental-dump-hash` flag
This causes us to dump a bunch of has information to stdout that can be
useful in tracking down incremental compilation invalidations,
particularly across crates.
|
|
print option to dump target spec as JSON
This lets the user dump out the target spec that the compiler is using. This is useful to people defining their own target.json to compare it against existing targets or understand how different targets change internal settings. It is also potentially useful for Cargo to determine if something has changed with a target and it needs to rebuild things.
|
|
This option provides the user the ability to dump the configuration that
is in use by rustc for the target they are building for.
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
|
|
|
|
To allow manipulation of the options that appear in --print, convert it
to a vector.
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
|
|
This adds the new insta-stable `#![type_size_limit]` crate attribute to control
the limit, and is obviously a [breaking-change] fixable by that.
|
|
This causes us to dump a bunch of has information to stdout that can be
useful in tracking down incremental compilation invalidations,
particularly across crates.
|
|
Some notes:
* This code attempts to present the breakdown of each variant for
every enum in the MIR. This is meant to guide decisions about how to
revise representations e.g. when to box payloads for rare variants
to shrink the size of the enum overall.
* I left out the "Total:" line that hir-stats presents, because this
implementation uses the MIR Visitor infrastructure, and the memory
usage of structures directly embedded in other structures (e.g. the
`func: Operand` in a `TerminatorKind:Call`) is not distinguished
from similar structures allocated in a `Vec` (e.g. the `args:
Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
summation of all the accumulated sizes is misleading, because it
will double-count the contribution of the `Operand` of the `func` as
well as the size of the whole `TerminatorKind`.
* I did consider abandoning the MIR Visitor and instead hand-coding
a traversal that distinguished embedded storage from indirect
storage. But such code would be fragile; better to just require
people to take care when interpreting the presented results.
* This traverses the `mir.promoted` rvalues to capture stats for MIR
stored there, even though the MIR visitor super_mir method does not
do so. (I did not observe any new mir being traversed when compiling
the rustc crate, however.)
* It might be nice to try to unify this code with hir-stats. Then
again, the reporting portion is the only common code (I think), and
it is small compared to the visitors in hir-stats and mir-stats.
|
|
Biggest change: Revised print-type-sizes output to include breakdown
of layout.
Includes info about field sizes (and alignment + padding when padding
is injected; the injected padding is derived from the offsets computed
by layout module).
Output format is illustrated in commit that has the ui tests.
Note: there exists (at least) one case of variant w/o name: empty
enums. Namely, empty enums use anonymous univariant repr. So for such
cases, print the number of the variant instead of the name.
----
Also, eddyb suggested of reading from `layout_cache` post-trans.
(For casual readers: the compiler source often uses the word "cache"
for tables that are in fact not periodically purged, and thus are
useful as the basis for data like this.)
Some types that were previously not printed are now included in the
output. (See e.g. the tests `print_type_sizes/generics.rs` and
`print_type_sizes/variants.rs`)
----
Other review feedback:
switch to an exhaustive match when filtering in just structural types.
switch to hashset for layout info and move sort into print method.
----
Driveby change: Factored session::code_stats into its own module
----
incorporate njn feedback re output formatting.
|
|
|
|
add --crate-type metadata
r? @alexcrichton
|
|
|
|
|
|
places.
|
|
|
|
With the same semantics as -Zno-trans
|
|
|
|
|
|
Group unused import warnings per import list
Given a file
``` rust
use std::collections::{BinaryHeap, BTreeMap, BTreeSet};
fn main() {}
```
Show a single warning, instead of three for each unused import:
``` nocode
warning: unused imports, #[warn(unused_imports)] on by default
--> file2.rs:1:24
|
1 | use std::collections::{BinaryHeap, BTreeMap, BTreeSet};
| ^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^
```
Include support for lints pointing at `MultilineSpan`s, instead of just
`Span`s.
Fixes #16132.
|
|
Marking the 'no-stack-check' codegen option as deprecated (Issue #34915)
Attempts to finish resolving issue #34915. Based on pull request #35156, which was closed due to inactivity.
|
|
Given a file
```rust
use std::collections::{BinaryHeap, BTreeMap, BTreeSet};
fn main() {}
```
Show a single warning, instead of three for each unused import:
```nocode
warning: unused imports, #[warn(unused_imports)] on by default
--> foo.rs:1:24
|
1 | use std::collections::{BinaryHeap, BTreeMap, BTreeSet};
| ^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^
```
Include support for lints pointing at `MultilineSpan`s, instead of just
`Span`s.
|
|
|
|
|
|
This speeds up compilation by 3--6% across most of rustc-benchmarks.
|
|
Add `-Z hir-stats` for collecting statistics on HIR and AST
The data collected will be printed to the commandline and looks like the following:
```
// stats for libcore
PRE EXPANSION AST STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
TypeBinding 2_280 57 40
Mod 3_560 89 40
PathListItem 6_516 181 36
Variant 7_872 82 96
LifetimeDef 21_280 380 56
StructField 22_880 260 88
Lifetime 23_800 1_190 20
Local 30_192 629 48
ForeignItem 31_504 179 176
Arm 42_880 670 64
Mac 46_960 587 80
FnDecl 57_792 1_204 48
TraitItem 69_504 362 192
TyParamBound 98_280 945 104
Block 108_384 2_258 48
Stmt 144_720 3_618 40
ImplItem 230_272 1_028 224
Item 467_456 1_826 256
Pat 517_776 4_623 112
Attribute 745_680 15_535 48
Ty 1_114_848 9_954 112
PathSegment 1_218_528 16_924 72
Expr 3_082_408 20_279 152
----------------------------------------------------------------
Total 8_095_372
POST EXPANSION AST STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
MacroDef 1_056 12 88
Mod 3_400 85 40
TypeBinding 4_280 107 40
PathListItem 6_516 181 36
Variant 7_872 82 96
StructField 24_904 283 88
ForeignItem 31_504 179 176
TraitItem 69_504 362 192
Local 85_008 1_771 48
Arm 100_288 1_567 64
Lifetime 123_980 6_199 20
LifetimeDef 126_728 2_263 56
TyParamBound 297_128 2_857 104
FnDecl 305_856 6_372 48
Block 481_104 10_023 48
Stmt 535_120 13_378 40
Item 1_469_952 5_742 256
Attribute 1_629_840 33_955 48
ImplItem 1_732_864 7_736 224
Pat 2_360_176 21_073 112
PathSegment 5_888_448 81_784 72
Ty 6_237_168 55_689 112
Expr 12_013_320 79_035 152
----------------------------------------------------------------
Total 33_536_016
HIR STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
MacroDef 864 12 72
Mod 2_720 85 32
TypeBinding 3_424 107 32
PathListItem 5_068 181 28
Variant 6_560 82 80
StructField 20_376 283 72
ForeignItem 27_208 179 152
WherePredicate 43_776 684 64
TraitItem 52_128 362 144
Decl 68_992 2_156 32
Local 89_184 1_858 48
Arm 94_368 1_966 48
LifetimeDef 108_624 2_263 48
Lifetime 123_980 6_199 20
Stmt 168_000 4_200 40
TyParamBound 251_416 2_857 88
FnDecl 254_880 6_372 40
Block 583_968 12_166 48
Item 1_240_272 5_742 216
ImplItem 1_361_536 7_736 176
Attribute 1_620_480 33_760 48
Pat 2_073_120 21_595 96
Path 2_385_856 74_558 32
Ty 4_455_040 55_688 80
PathSegment 5_587_904 87_311 64
Expr 7_588_992 79_052 96
----------------------------------------------------------------
Total 28_218_736
```
|
|
|
|
|
|
|
|
For now, this type just replaces a tuple, but it will eventually grow
the ability to carry more structured information.
|
|
Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.
There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.
|
|
r=nikomatsakis
introing one-time diagnostics: only emit "lint level defined here" once
This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part).
---
We introduce a new `one_time_diagnostics` field on
`rustc::session::Session` to hold a hashset of diagnostic messages we've
set once but don't want to see again (as uniquified by span and message
text), "lint level defined here" being the motivating example dealt with
here.
This is in the matter of #24690.
---
r? @nikomatsakis
|
|
|
|
Some lint-level attributes (like `bad-style`, or, more dramatically,
`warnings`) can affect more than one lint; it seems fairer to point out
the attribute once for each distinct lint affected. Also, a UI test is
added. This remains in the matter of #24690.
|
|
Jonathan D. Turner pointed out that we don't want to dedup in JSON
mode. Since the compile-test runner uses JSON output, we regrettably
need to revert the edits to existing tests; one imagines that testing
for one-time diagnosticity for humans will have to be added as a UI
test.
This remains in the matter of #24690.
|
|
Thanks to Niko Matsakis's review for the suggestion.
|
|
'src/librustc/session/filesearch.rs' refactoring and cleanup.
|
|
We introduce a new `one_time_diagnostics` field on
`rustc::session::Session` to hold a hashset of diagnostic messages we've
set once but don't want to see again (as uniquified by span and message
text), "lint level defined here" being the motivating example dealt with
here.
This is in the matter of #24690.
|
|
incr.comp.: Minor refactoring and update to struct ICH test case
r? @nikomatsakis
|
|
|
|
|
|
|
|
|
|
rustc: Rename rustc_macro to proc_macro
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
which reflects the general consensus of #35900. A follow up PR to Cargo will be
required to purge the `rustc-macro` name as well.
|
|
|
|
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
which reflects the general consensus of #35900. A follow up PR to Cargo will be
required to purge the `rustc-macro` name as well.
|
|
add Thumbs to the compiler
this commit adds 4 new target definitions to the compiler for easier
cross compilation to ARM Cortex-M devices.
- `thumbv6m-none-eabi`
- For the Cortex-M0, Cortex-M0+ and Cortex-M1
- This architecture doesn't have hardware support (instructions) for
atomics. Hence, the `Atomic*` structs are not available for this
target.
- `thumbv7m-none-eabi`
- For the Cortex-M3
- `thumbv7em-none-eabi`
- For the FPU-less variants of the Cortex-M4 and Cortex-M7
- On this target, all the floating point operations will be lowered
software routines (intrinsics)
- `thumbv7em-none-eabihf`
- For the variants of the Cortex-M4 and Cortex-M7 that do have a FPU.
- On this target, all the floating point operations will be lowered
to hardware instructions
No binary releases of standard crates, like `core`, are planned for
these targets because Cargo, in the future, will compile e.g. the `core`
crate on the fly as part of the `cargo build` process. In the meantime,
you'll have to compile the `core` crate yourself. [Xargo] is the easiest
way to do that as in handles the compilation of `core` automatically and
can be used just like Cargo: `xargo build --target thumbv6m-none-eabi`
is all that's needed.
[Xargo]: https://crates.io/crates/xargo
---
cc @brson @alexcrichton
|
|
to better express the idea that omitting this field defaults this value
to target_pointer_width
|
|
std: Stabilize and deprecate APIs for 1.13
This commit is intended to be backported to the 1.13 branch, and works with the
following APIs:
Stabilized
* `i32::checked_abs`
* `i32::wrapping_abs`
* `i32::overflowing_abs`
* `RefCell::try_borrow`
* `RefCell::try_borrow_mut`
Deprecated
* `BinaryHeap::push_pop`
* `BinaryHeap::replace`
* `SipHash13`
* `SipHash24`
* `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map`
module
Closes #28147
Closes #34767
Closes #35057
Closes #35070
|
|
This commit is intended to be backported to the 1.13 branch, and works with the
following APIs:
Stabilized
* `i32::checked_abs`
* `i32::wrapping_abs`
* `i32::overflowing_abs`
* `RefCell::try_borrow`
* `RefCell::try_borrow_mut`
* `DefaultHasher`
* `DefaultHasher::new`
* `DefaultHasher::default`
Deprecated
* `BinaryHeap::push_pop`
* `BinaryHeap::replace`
* `SipHash13`
* `SipHash24`
* `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map`
module
Closes #28147
Closes #34767
Closes #35057
Closes #35070
|