Commit Graph

365 Commits

Author SHA1 Message Date
Nicholas Nethercote
a733082be9 Avoid need for {D,Subd}iagnosticMessage imports.
The `fluent_messages!` macro produces uses of
`crate::{D,Subd}iagnosticMessage`, which means that every crate using
the macro must have this import:
```
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
```

This commit changes the macro to instead use
`rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the
imports.
2023-11-26 08:38:00 +11:00
bors
e2e978f713 Auto merge of #118203 - nnethercote:rustc_mir_dataflow, r=cjgillot
Minor `rustc_mir_dataflow` cleanups

r? `@cjgillot`
2023-11-25 07:10:46 +00:00
Nicholas Nethercote
912eb1f7c1 Remove ResultsCursor::get_with_analysis.
We can just call `ResultsCursor::state` and `ResultsCursor::analysis`
separately.
2023-11-24 13:13:09 +11:00
Nicholas Nethercote
406c0b8ae4 Remove unnecessary mut.
`mut_results` immediately below is the `&mut self` version, this one
should be `&self`.
2023-11-24 13:12:08 +11:00
Nicholas Nethercote
0f12da17c0 Remove unused arguments from on_all_children_bits.
`on_all_children_bits` has two arguments that are unused: `tcx` and
`body`. This was not detected by the compiler because it's a recursive
function.

This commit removes them, and removes lots of other arguments and fields
that are no longer necessary.
2023-11-24 06:36:27 +11:00
Nicholas Nethercote
118308ee03 Remove unused EverInitializedPlaces::tcx field. 2023-11-24 06:15:32 +11:00
Nicholas Nethercote
dc365e8c37 Remove unneeded derives from MaybeLiveLocals. 2023-11-24 06:13:00 +11:00
Nicholas Nethercote
f450bf49c0 Use 'mir lifetime name more.
Some types have a `body: &'mir Body<'tcx>` and some have `body: &'a
Body<'tcx>`. The former is more readable, so this commit converts some
fo the latter to the former.
2023-11-23 18:49:58 +11:00
Nicholas Nethercote
a65e68a43b Remove unnecessary things from State and Map. 2023-11-23 18:49:58 +11:00
Nicholas Nethercote
62ffb14c3d Remove unnecessary and misleading .. in a pattern.
All the fields are named.
2023-11-23 15:29:26 +11:00
Nicholas Nethercote
b8d340db14 Remove unnecessary ValueAnalysisWrapper::Direction.
`Forward` is the default.
2023-11-23 15:29:26 +11:00
Nicholas Nethercote
64a8c4ddda Reduce pub usage. 2023-11-23 15:29:24 +11:00
Nicholas Nethercote
c16d3f32a4 Avoid unnecessary exports. 2023-11-23 14:06:57 +11:00
Nicholas Nethercote
ca741945f4 Remove indexes module.
It's not useful, and only obfuscates things.
2023-11-23 14:06:46 +11:00
Nicholas Nethercote
e7781c75f8 Move has_rustc_mir_with.
`lib.rs` is a strange place for it, and it's only used within
`rustc_peek.rs`, so it doesn't need to be `pub`.
2023-11-23 14:06:32 +11:00
Nicholas Nethercote
36b25f5386 Reorder some use items.
The current order is a mess.
2023-11-23 14:06:25 +11:00
Nicholas Nethercote
2052d2b17c Remove unused feature. 2023-11-23 08:15:11 +11:00
Nicholas Nethercote
7060fc8327 Replace no_ord_impl with orderable.
Similar to the previous commit, this replaces `newtype_index`'s opt-out
`no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22 18:38:17 +11:00
Nicholas Nethercote
3ef9d4d0ed Replace custom_encodable with encodable.
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-22 18:37:14 +11:00
Nilstrieb
21a870515b Fix clippy::needless_borrow in the compiler
`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-21 20:13:40 +01:00
lcnr
992d93f687 rename BorrowKind::Shallow to Fake
also adds some comments
2023-11-08 22:55:28 +01:00
lcnr
a42eca42df generator layout: ignore fake borrows 2023-11-08 22:55:28 +01:00
Nicholas Nethercote
8ff624a9f2 Clean up rustc_*/Cargo.toml.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
bors
cd674d6179 Auto merge of #116300 - cjgillot:split-move, r=petrochenkov
Separate move path tracking between borrowck and drop elaboration.

The primary goal of this PR is to skip creating a `MovePathIndex` for path that do not need dropping in drop elaboration.

The 2 first commits are cleanups.

The next 2 commits displace `move` errors from move-path builder to borrowck. Move-path builder keeps the same logic, but does not carry error information any more.

The remaining commits allow to filter `MovePathIndex` creation according to types. This is used in drop elaboration, to avoid computing dataflow for paths that do not need dropping.
2023-10-24 00:25:32 +00:00
bors
41aa06ecf9 Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkov
report `unused_import` for empty reexports even it is pub

Fixes #116032

An easy fix. r? `@petrochenkov`

(Discovered this issue while reviewing #115993.)
2023-10-23 20:24:09 +00:00
bohan
482275b194 use visibility to check unused imports and delete some stmts 2023-10-22 21:27:46 +08:00
Camille GILLOT
7ae1851803 Use terse form for Fn bound. 2023-10-21 12:09:02 +00:00
Camille GILLOT
547af00019 Remove on_all_drop_children_bits.
As drop elaboration only tracks places that need dropping, is has become
equivalent to `on_all_children_bits`.
2023-10-21 10:33:37 +00:00
Camille GILLOT
252c64722f Parametrize gather_moves by filter. 2023-10-21 10:31:39 +00:00
Camille GILLOT
4bedd7de6e Stop computing error info in move path builder. 2023-10-21 10:30:58 +00:00
Camille GILLOT
90e6d29955 Avoid using a magic value for untracked locals. 2023-10-21 10:30:16 +00:00
Camille GILLOT
8d535070a2 Do not report errors from move path builder. 2023-10-21 10:29:40 +00:00
Camille GILLOT
a8e56d0b0b Remove is_terminal_path.
That information is redundant. Is the path is terminal, `first_child` will
already be `None`.
2023-10-21 10:26:28 +00:00
Camille GILLOT
4abea83663 Improve naming and comments. 2023-10-21 07:01:25 +00:00
Camille GILLOT
751a079413 Implement JumpThreading pass. 2023-10-21 06:58:38 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Michael Goulet
b2d2184ede Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
Camille GILLOT
27d6a57e58 Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
ouz-a
5d753abb30 have better explanation for relate_types 2023-10-02 23:39:45 +03:00
ouz-a
cd7f471931 Add docs, remove code, change subtyper code 2023-10-02 23:39:44 +03:00
ouz-a
3148e6a993 subtyping_projections 2023-10-02 23:37:49 +03:00
Oli Scherer
ec6f554536 Some tracing cleanups 2023-09-28 16:13:37 +00:00
bors
551c7183f8 Auto merge of #115794 - cjgillot:aggregate-no-box, r=davidtwco
Do not create a DerefLen place for `Box<[T]>`.

Fixes https://github.com/rust-lang/rust/issues/115789
2023-09-24 06:13:17 +00:00
Camille GILLOT
44ac8dcc71 Remove GeneratorWitness and rename GeneratorWitnessMIR. 2023-09-23 13:47:30 +00:00
Matthias Krüger
d4d0c840b3
Rollup merge of #115770 - ouz-a:match_elem_builder, r=lcnr
Match on elem first while building move paths

While working on https://github.com/rust-lang/rust/pull/115025 `@lcnr` and I observed "move_paths_for" function matched on the `Ty` instead of `Projection` which seems flawed as it's the `Projection`s that cause the problem not the type.

r? `@lcnr`
2023-09-22 23:12:34 +02:00
ouz-a
63df126f59 match array for constantindex and subslice 2023-09-22 16:28:45 +03:00
ouz-a
442c87a0b0 better bug message 2023-09-22 11:31:45 +03:00
ouz-a
d6efedcaf5 remove inner match 2023-09-22 11:21:55 +03:00
Ralf Jung
c94410c145 rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00