about summary refs log tree commit diff
path: root/compiler/rustc_passes
AgeCommit message (Collapse)AuthorLines
2022-09-08Introduce `DotDotPos`.Nicholas Nethercote-7/+4
This shrinks `hir::Pat` from 88 to 72 bytes.
2022-09-08Arena-allocate `hir::Lifetime`.Nicholas Nethercote-0/+5
This shrinks `hir::Ty` from 72 to 48 bytes. `visit_lifetime` is added to the HIR stats collector because these types are now stored in memory on their own, instead of being within other types.
2022-09-07Rollup merge of #101503 - spastorino:add-debug-calls, r=compiler-errorsMatthias Krüger-1/+1
Add debug calls `@oli-obk` requested this and other changes as a way of simplifying https://github.com/rust-lang/rust/pull/101345. This is just going to make the diff of https://github.com/rust-lang/rust/pull/101345 smaller. r? `@oli-obk` `@cjgillot`
2022-09-07Format hir_id_validator error using pretty printSantiago Pastorino-1/+1
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-0/+23
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-07Rollup merge of #101486 - asquared31415:invalid_repr_list, r=estebankYuki Okushi-0/+1
Add list of recognized repr attributes to the unrecognized repr error
2022-09-06add list of recognized repr attributes to the unrecognized repr errorasquared31415-0/+1
2022-09-06Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillotbors-1/+1
`BindingAnnotation` refactor * `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`) * `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)` * Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}` One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`. I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-05Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, ↵bors-2/+3
r=cjgillot Separate the receiver from arguments in HIR Related to #100232 cc `@cjgillot`
2022-09-05use `propagate_through_exprs` instead of `propagate_through_expr`Takayuki Maeda-4/+1
fix `ExprKind` static_assert_size fix hir-stats
2022-09-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-1/+1
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05refactor: remove unnecessary variablesTakayuki Maeda-3/+4
2022-09-05separate the receiver from arguments in HIRTakayuki Maeda-2/+5
2022-09-05Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwcoDylan DPC-66/+215
Improve HIR stats #100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection. r? `@davidtwco`
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-1/+1
2022-09-03Do not call object_lifetime_default on lifetime params.Camille GILLOT-21/+14
2022-09-02Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplettbors-14/+43
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE` When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program ```rust fn main() { loop { println!("hello world"); } } ``` will print an error if used with a short-lived pipe, e.g. % ./main | head -n 1 hello world thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace by enabling `#[unix_sigpipe = "sig_dfl"]` like this ```rust #![feature(unix_sigpipe)] #[unix_sigpipe = "sig_dfl"] fn main() { loop { println!("hello world"); } } ``` there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately: % ./main | head -n 1 hello world The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`. With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`. See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-1/+1
2022-09-02Rollup merge of #101215 - est31:rustdoc_version_placeholder, r=Mark-SimulacrumMatthias Krüger-1/+1
Also replace the version placeholder in rustc_attr Replace the version placeholder with the current version in the rustc_attr crate too so that users won't see the placeholder but instead the explicit version. This especially fixes the bug for rustdoc not showing it but instead the placeholder. Originally reported [here](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder/near/296057188). cc #100591 ![Screenshot_20220830_233727](https://user-images.githubusercontent.com/8872119/187548079-6207776b-4481-4351-afff-607f5b3fe03a.png)
2022-09-02Also replace the version placeholder in rustc_attrest31-1/+1
This fixes rustdoc not showing the current version as stabilization version for recently stabilized lang features.
2022-09-01Directly use the `instrument` macro instead of its full pathOli Scherer-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Rollup merge of #100941 - lyming2007:issue-100584, r=oli-obkDylan DPC-11/+71
Point at the string inside literal and mention if we need string inte… …rpolation modified: compiler/rustc_passes/src/liveness.rs
2022-08-30Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrumbors-0/+1
Revert let_chains stabilization This is the revert against master, the beta revert was already done in #100538. Bumps the stage0 compiler which already has it reverted.
2022-08-29Point at the string inside literal and mention if we need string interpolationYiming Lei-11/+71
modified: compiler/rustc_passes/src/liveness.rs new file: src/test/ui/type/issue-100584.rs new file: src/test/ui/type/issue-100584.stderr
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-29Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errorsDylan DPC-0/+28
Remove separate indexing of early-bound regions ~Based on https://github.com/rust-lang/rust/pull/99728.~ This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-29Rollup merge of #100959 - ↵Matthias Krüger-8/+8
LuisCardosoOliveira:translation-rename-attr-warning, r=davidtwco translations: rename warn_ to warning ## Description This MR renames the the macro `warn_` to `warning`. To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by ```````@davidtwco``````` in the Zulip channel, `warn_` was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also taken. However, it is no longer the case and we can rename `warn_` to `warning`.
2022-08-29Improve HIR stats collector.Nicholas Nethercote-50/+194
Adds and removes some `visit_*` methods accordingly, improving coverage, and avoiding some double counting. Brings it in line with the AST stats collector.
2022-08-29Move a comment to the right place.Nicholas Nethercote-4/+4
This comment on the HIR `visit_path_segment` is supposed be on the AST `visit_path_segment`.
2022-08-29Add prefix to every line of `-Zhir-stats` output.Nicholas Nethercote-12/+17
This is based on `-Zprint-type-sizes` which does the same thing. It makes the output provenance clearer, and helps with post-processing. E.g. if you have `-Zhir-stats` output from numerous compiler invocations you can now easily extract the pre-expansion stats separately from the post-expansion stats.
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-14/+43
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-27Expand the version placeholder to the current version in stability attribute ↵est31-0/+8
parsing That way, the current version is shown in rustdoc etc.
2022-08-24translations: rename warn_ to warningLuis Cardoso-8/+8
The macro warn_ was named like that because it the keyword warn is a built-in attribute and at the time this macro was created the word 'warning' was also taken. However it is no longer the case and we can rename warn_ to warning.
2022-08-23Use par_body_owners for livenessSeo Sanghyeon-55/+46
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-85/+85
2022-08-21Disallow #[primary_span] on LintDiagnosticsXiretza-1/+0
2022-08-15Rollup merge of #100031 - GoldsteinE:try-removing-the-field, r=michaelwoeristerMatthias Krüger-2/+32
improve "try ignoring the field" diagnostic Closes #95795
2022-08-15Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillotbors-1/+13
Visit attributes in more places. This adds 3 loosely related changes (I can split PRs if desired): - Attribute checking on pattern struct fields. - Attribute checking on struct expression fields. - Lint level visiting on pattern struct fields, struct expression fields, and generic parameters. There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
2022-08-13Rollup merge of #100431 - compiler-errors:enum-ctor-variant-stab, r=estebankMichael Goulet-1/+4
Enum variant ctor inherits the stability of the enum variant Fixes #100399 Fixes #100420 Context #71481 for why enum variants don't need stability
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-12Check ctor for missing stabilityMichael Goulet-0/+3
2022-08-12enum variant ctor inherits stability of variantMichael Goulet-1/+1
2022-08-12Auto merge of #100328 - davidtwco:perf-implications, r=nnethercotebors-36/+91
passes: load `defined_lib_features` query less Hopefully addresses the perf regressions from #99212 (see #99905). Re-structure the stability checks for library features to avoid calling `defined_lib_features` for any more crates than necessary for each of the implications or local feature attributes that need validation. r? `@ghost` (just checking perf at first)
2022-08-12improve "try ignoring the field" diagnosticGoldstein-2/+32
Closes #95795
2022-08-11Add visitors for PatField and ExprField.Eric Huss-12/+8
This helps simplify the code. It also fixes it to use the correct parent when lowering. One consequence is the `non_snake_case` lint needed to change the way it looked for parent nodes in a struct pattern. This also includes a small fix to use the correct `Target` for expression field attribute validation.
2022-08-11Check attributes on struct expression fields.Eric Huss-1/+7
Attributes on struct expression fields were not being checked for validity. This adds the fields as HIR nodes so that `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Check attributes on pattern fields.Eric Huss-1/+11
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillotMatthias Krüger-27/+10
Simplify visitors By removing some unused arguments. r? `@cjgillot`
2022-08-11Rollup merge of #100398 - nnethercote:improve-Zhir-stats, r=michaelwoeristerDylan DPC-52/+253
Improve `-Zhir-stats` Add testing, improve coverage, avoid some double counting, and add more detail. r? `@michaelwoerister`