about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/middle
AgeCommit message (Collapse)AuthorLines
2024-01-30Remove `ffi_returns_twice` featureclubby789-13/+10
2024-01-26ScopeTree: remove destruction_scopes as unusedklensy-8/+0
last usages removed by https://github.com/rust-lang/rust/pull/116170
2024-01-23Rename `TyCtxt::struct_span_lint_hir` as `TyCtxt::node_span_lint`.Nicholas Nethercote-2/+2
2024-01-13Add check for ui_testing via promoting parameters from `ParseSess` to `Session`George-lewis-2/+1
2024-01-12Revert "Auto merge of #118568 - DianQK:no-builtins-symbols, r=pnkfelix"DianQK-5/+0
This reverts commit 503e129328080e924c0ddfca6abf4c2812580102, reversing changes made to 0e7f91b75e7484a713e2f644212cfc1aa7478a28.
2024-01-04Make iteration order of region_scope_tree query stableMichael Woerister-25/+4
2024-01-04Make iteration order of named_variable_map, late_bound_vars_map, and ↵Michael Woerister-3/+3
resolve_bound_vars queries stable
2024-01-04Make iteration order of stability_index query stableMichael Woerister-6/+5
2024-01-04Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives.Michael Woerister-8/+10
2023-12-30Update to bitflags 2 in the compilerNilstrieb-2/+4
This involves lots of breaking changes. There are two big changes that force changes. The first is that the bitflag types now don't automatically implement normal derive traits, so we need to derive them manually. Additionally, bitflags now have a hidden inner type by default, which breaks our custom derives. The bitflags docs recommend using the impl form in these cases, which I did.
2023-12-26Auto merge of #119258 - compiler-errors:closure-kind, r=eholkbors-14/+0
Make closures carry their own ClosureKind Right now, we use the "`movability`" field of `hir::Closure` to distinguish a closure and a coroutine. This is paired together with the `CoroutineKind`, which is located not in the `hir::Closure`, but the `hir::Body`. This is strange and redundant. This PR introduces `ClosureKind` with two variants -- `Closure` and `Coroutine`, which is put into `hir::Closure`. The `CoroutineKind` is thus removed from `hir::Body`, and `Option<Movability>` no longer needs to be a stand-in for "is this a closure or a coroutine". r? eholk
2023-12-25Remove unnecessary body_expr_countMichael Goulet-14/+0
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-3/+3
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-2/+1
2023-12-15Rollup merge of #118888 - compiler-errors:uplift-more-things, r=jackh726Matthias Krüger-0/+11
Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir` Uplifts `TypeAndMut` and `ClosureKind` I know I said I was just going to get rid of `TypeAndMut` (https://github.com/rust-lang/types-team/issues/124) but I think this is much simpler, lol r? `@jackh726` or `@lcnr`
2023-12-14Move special methods from ClosureKind back into rustcMichael Goulet-0/+11
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-2/+2
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-10remove redundant importssurechen-1/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Auto merge of #116170 - matthewjasper:remove-thir-destruction-scopes, r=cjgillotbors-4/+0
Don't include destruction scopes in THIR They are not used by anyone, and add memory/performance overhead.
2023-12-04Don't include destruction scopes in THIRMatthew Jasper-4/+0
They are not used by anyone, and add memory/performance overhead.
2023-12-04Avoid adding compiler-used functions to `symbols.o`DianQK-0/+5
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-1/+1
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-0/+1
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-20Store feature stability un-splitMichael Goulet-10/+4
2023-11-20Unify defined_lib_features and lib_features queriesMichael Goulet-4/+11
2023-11-14finish `RegionKind` renamelcnr-1/+1
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-10-30Add method for checking if deprecation is a rustc versionDavid Tolnay-1/+1
2023-10-30Descriptive variant name deprecation versions outside the standard libraryDavid Tolnay-1/+3
2023-10-30Represent absence of 'since' attribute as a variant of DeprecatedSinceDavid Tolnay-5/+5
2023-10-30Add a DeprecatedSince::Err variant for versions that fail to parseDavid Tolnay-9/+10
2023-10-30Move deprecation_in_effect to inherent method on DeprecationDavid Tolnay-16/+3
2023-10-29Store version of `deprecated` attribute in structured formDavid Tolnay-34/+12
2023-10-26Parse rustc version at compile timeDavid Tolnay-15/+12
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-8/+0
2023-10-13Format all the let chains in compilerMichael Goulet-2/+6
2023-10-05Rename `Features::active_features`.Nicholas Nethercote-3/+3
The word "active" is currently used in two different and confusing ways: - `ACTIVE_FEATURES` actually means "available unstable features" - `Features::active_features` actually means "features declared in the crate's code", which can include feature within `ACTIVE_FEATURES` but also others. (This is also distinct from "enabled" features which includes declared features but also some edition-specific features automatically enabled depending on the edition in use.) This commit changes the `Features::active_features` to `Features::declared_features` which actually matches its meaning. Likewise, `Features::active` becomes `Features::declared`.
2023-09-08Rework no_coverage to coverage(off)Andy Caldwell-1/+1
2023-08-09rustc: Move `stable_crate_id` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes a piece of mutable state. Follow up to #114578.
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-7/+7
2023-07-28privacy: no nominal visibility for assoc fnsDavid Wood-2/+7
When `staged_api` is enabled, effective visibilities are computed earlier and this can trigger an ICE in some cases. In particular, if a impl of a trait method has a visibility then an error will be reported for that, but when privacy invariants are being checked, the effective visibility will still be greater than the nominal visbility and that will trigger a `span_bug!`. However, this invariant - that effective visibilites are limited to nominal visibility - doesn't make sense for associated functions. Signed-off-by: David Wood <david@davidtw.co>
2023-07-18Add the `no-builtins` attribute to functions when `no_builtins` is applied ↵DianQK-0/+2
at the crate level. When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-5/+5
2023-07-14Enable potential_query_instability lint in rustc_hir_typeck.Michael Woerister-2/+2
Fix linting errors by using FxIndex(Map|Set) and Unord(Map|Set) as appropriate.
2023-06-15privacy: Rename some variables for clarityVadim Petrochenkov-3/+3
2023-06-15privacy: Do not mark items reachable farther than their nominal visibilityVadim Petrochenkov-13/+16
This commit reverts a change made in #111425. It was believed that this change was necessary for implementing type privacy lints, but #111801 showed that it was not necessary. Quite opposite, the revert fixes some issues.
2023-05-31Remove const eval limit and implement an exponential backoff lint insteadOli Scherer-9/+2
2023-05-29Use `Cow` in `{D,Subd}iagnosticMessage`.Nicholas Nethercote-6/+6
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.