about summary refs log tree commit diff
path: root/compiler/rustc_passes
AgeCommit message (Collapse)AuthorLines
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-15/+16
2023-05-04Auto merge of #111014 - klensy:no-rc, r=WaffleLapkinbors-3/+2
try to downgrade Arc -> Lrc -> Rc -> no-Rc in few places Expecting this be not slower on non-parallel compiler and probably faster on parallel (checked that this PR builds on it).
2023-05-04Rollup merge of #111062 - clubby789:invalid-repr-unchecked, r=petrochenkovDylan DPC-7/+1
Don't bail out early when checking invalid `repr` attr Fixes #111051 An invalid repr delays a bug. If there are other invalid attributes on the item, we emit a warning and exit without re-checking the repr here, so no error is emitted and the delayed bug ICEs
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-3/+3
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-01Don't bail out early when checking invalid `repr` attrclubby789-7/+1
2023-04-30Arc -> Lrcklensy-3/+2
2023-04-26Migrate `rustc_passes` to translatable diagnosticsclubby789-175/+308
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-24Auto merge of #109590 - Nilstrieb:copy-hir, r=oli-obkbors-1/+1
Impl `Copy` for most HIR types This simplifies the invocation of the `arena_types` macro and probably makes working with HIR nicer in general. Based on #109588
2023-04-23Auto merge of #108118 - oli-obk:lazy_typeck, r=cjgillotbors-13/+14
Run various queries from other queries instead of explicitly in phases These are just legacy leftovers from when rustc didn't have a query system. While there are more cleanups of this sort that can be done here, I want to land them in smaller steps. This phased order of query invocations was already a lie, as any query that looks at types (e.g. the wf checks run before) can invoke e.g. const eval which invokes borrowck, which invokes typeck, ...
2023-04-22Impl `Copy` for almost all HIR typesNilstrieb-1/+1
This simplifies the invocation of the `arena_types` macro and probably makes working with HIR nicer in general.
2023-04-21Run `check_match` and `check_liveness` when MIR is built instead of having ↵Oli Scherer-2/+8
an explicit phase for them
2023-04-21Make `check_match` and `check_liveness` take a `LocalDefId`Oli Scherer-11/+6
2023-04-21fmtDrMeepster-6/+3
2023-04-21fix incorrect param env in dead code lintDrMeepster-4/+5
2023-04-21offset_ofDrMeepster-3/+44
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+2
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-16Allow all associated functions and add testDeadbeef-11/+7
2023-04-14allow `repr(align = x)` on inherent methodsDeadbeef-5/+15
2023-04-13impl reviewer feedbackEzra Shaw-11/+10
- remove unused (pun intentional) `continue` - improve wording with assoc items in general
2023-04-13dead-code-lint: de-dup multiple unused assoc fnsEzra Shaw-17/+37
2023-04-13refactor: emit "unused assoc fn" in lexical orderEzra Shaw-4/+7
with repect to other dead code lints
2023-04-12Rollup merge of #110203 - compiler-errors:rtn-dots, r=eholkMatthias Krüger-1/+1
Remove `..` from return type notation `@nikomatsakis` and I decided that using `..` in the return-type notation syntax is probably overkill. r? `@eholk` since you reviewed the last one Since this is piggybacking now totally off of a pre-existing syntax (parenthesized generics), let me know if you need any explanation of the logic here, since it's a bit more complicated now.
2023-04-12Auto merge of #109935 - michaelwoerister:fix-feed-in-eval-always, r=cjgillotbors-2/+0
incr.comp.: Make sure dependencies are recorded when feeding queries during eval-always queries. This PR makes sure we don't drop dependency edges when feeding queries during an eval-always query. Background: During eval-always queries, no dependencies are recorded because the system knows to unconditionally re-evaluate them regardless of any actual dependencies. This works fine for these queries themselves but leads to a problem when feeding other queries: When queries are fed, we set up their dependency edges by copying the current set of dependencies of the feeding query. But because this set is empty for eval-always queries, we record no edges at all -- which has the effect that the fed query instances always look "green" to the system, although they should always be "red". The fix is to explicitly add a dependency on the artificial "always red" dep-node when feeding during eval-always queries. Fixes https://github.com/rust-lang/rust/issues/108481 Maybe also fixes issue https://github.com/rust-lang/rust/issues/88488. cc `@jyn514` r? `@cjgillot` or `@oli-obk`
2023-04-10Remove `..` from return type notationMichael Goulet-1/+1
2023-04-09Migrate `sess.opts.tests` uses to `sess.is_test_crate()`blyxyas-1/+1
2023-04-05incr.comp.: Don't ignore dep-tracking during HirId validation.Michael Woerister-22/+20
2023-04-04incr.comp.: Make sure dependencies are recorded when feeding queries during ↵Michael Woerister-22/+22
eval-always queries.
2023-04-04Replace a lock with an atomicOli Scherer-1/+1
2023-04-01slighty simplify a few boolean expressions (clippy::nonminimal_bool)Matthias Krüger-1/+1
2023-03-31Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomezbors-18/+0
Rollup of 7 pull requests Successful merges: - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2) - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`) - #109680 (Fix subslice capture in closure) - #109798 (fluent_messages macro: don't emit the OS error in a note) - #109805 (Source map cleanups) - #109818 (rustdoc: Add GUI test for jump to collapsed item) - #109820 (rustdoc-search: update docs for comma in `?` help popover) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddleGuillaume Gomez-18/+0
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes` Fixes #88070. It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem. r? `@jyn514`
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-1/+1
Initial support for return type notation (RTN) See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/ 1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter. * I'd add this in a follow-up. 3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~ * I don't think we actually want this. 5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`. * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it. 7. ~I'm not in love with the feature gate name 😺~ * I renamed it to `return_type_notation` :heavy_check_mark: Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later. r? `@ghost`
2023-03-30Rename doc(primitive) into rustc_doc_primitiveGuillaume Gomez-18/+0
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-1/+2
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-28Add `(..)` syntax for RTNMichael Goulet-1/+1
2023-03-23Separate find_*_stability.Camille GILLOT-3/+5
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-5/+6
2023-03-21LocalCrate keyMichael Goulet-3/+4
2023-03-21Use local key in providersMichael Goulet-26/+14
2023-03-17Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errorsMatthias Krüger-7/+3
Remove box expressions from HIR After #108516, `#[rustc_box]` is used at HIR->THIR lowering and this is no longer emitted, so it can be removed. This is based on top of #108471 to help with conflicts, so 43490488ccacd1a822e9c621f5ed6fca99959a0b is the only relevant commit (sorry for all the duplicated pings!) ````@rustbot```` label +S-blocked
2023-03-14Tighter spansMichael Goulet-2/+35
2023-03-14Simplify proc macro signature validity checkMichael Goulet-151/+62
2023-03-14Remove box expressions from HIRclubby789-7/+3
2023-03-14Auto merge of #109057 - compiler-errors:rpitit-info-again, r=spastorinobors-1/+1
Don't `opt_rpitit_info` as a separate query ... another attempt to undo regressions r? `@ghost`
2023-03-13Don't opt_rpitit_info as a separate queryMichael Goulet-1/+1
2023-03-13Better names?Michael Goulet-1/+1
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-1/+1
2023-03-12Auto merge of #108682 - est31:simplify_dirs, r=davidtwcobors-1/+1
Simplify message paths This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes. The commit was the result of automated changes: ``` for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done ``` r? `@davidtwco`
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-0/+6
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.