Commit Graph

487 Commits

Author SHA1 Message Date
Camille GILLOT
7ac7f135e3 Propagate places through assignments. 2024-07-13 12:02:10 +00:00
Camille GILLOT
76f5bc6a9f Create mapped places upon seeing them in the body. 2024-07-13 11:54:25 +00:00
Maybe Waffle
484152d562 Support tail calls in mir via TerminatorKind::TailCall 2024-07-07 17:11:04 +02:00
bors
2b90614e94 Auto merge of #127036 - cjgillot:sparse-state, r=oli-obk
Make jump threading state sparse

Continuation of https://github.com/rust-lang/rust/pull/127024

Both dataflow const-prop and jump threading involve cloning the state vector a lot. This PR replaces the data structure by a sparse vector, considering:
- that jump threading state is typically very sparse (at most 1 or 2 set entries);
- that dataflow const-prop is disabled by default;
- that place/value map is very eager, and prone to creating an overly large state.

The first commit is shared with the previous PR to avoid needless conflicts.

r? `@oli-obk`
2024-07-03 18:52:04 +00:00
Camille GILLOT
76244d4dbc Make jump threading state sparse. 2024-07-01 15:41:21 +00:00
Camille GILLOT
1834f5a272 Swap encapsulation of DCP state. 2024-07-01 15:39:59 +00:00
bors
7b21c18fe4 Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercote
Automatically taint InferCtxt when errors are emitted

r? `@nnethercote`

Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly.

That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places.

The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore.

fixes #126485 (cc `@olafes)`

There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
2024-07-01 06:35:58 +00:00
Camille GILLOT
61ede075bf Stop ICEing on impossible predicates. 2024-06-29 10:42:31 +00:00
Oli Scherer
81695a147a Split lifetimes on mir borrowck dataflow 2024-06-26 16:01:44 +00:00
Scott McMurray
b28efb11af Save 2 pointers in TerminatorKind (96 → 80 bytes)
These things don't need to be `Vec`s; boxed slices are enough.

The frequent one here is call arguments, but MIR building knows the number of arguments from the THIR, so the collect is always getting the allocation right in the first place, and thus this shouldn't ever add the shrink-in-place overhead.
2024-06-21 18:02:05 -07:00
Michael Goulet
93ff86ed7c Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
Nicholas Nethercote
75b164d836 Use tidy to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.

For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
  `allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
  sometimes the order is alphabetical, and sometimes there is no
  particular order.
- Sometimes the attributes of a particular kind aren't even grouped
  all together, e.g. there might be a `feature`, then an `allow`, then
  another `feature`.

This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.

Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
  because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
  ignored in `rustfmt.toml`).
2024-06-12 15:49:10 +10:00
Nicholas Nethercote
9287aede31 Remove #[macro_use] extern crate tracing from rustc_mir_dataflow. 2024-05-23 18:02:40 +10:00
Scott McMurray
95c0e5c6a8 Remove Rvalue::CheckedBinaryOp 2024-05-17 20:33:02 -07:00
Waffle Lapkin
698d7a031e Inline & delete Ty::new_unit, since it's just a field access 2024-05-02 17:49:23 +02:00
Matthias Krüger
784316eadc
Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-dead
Remove many `#[macro_use] extern crate foo` items

This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined.

r? `@fee1-dead`
2024-04-30 15:04:08 +02:00
Matthias Krüger
6ce9708ce5
Rollup merge of #124185 - beepster4096:move_data_base_local_infallible, r=pnkfelix
Remove optionality from MoveData::base_local

This is an artifact from when Places could be based on statics and not just locals. Now, all move paths either are locals or have parents, so this doesn't need to return Option anymore.
2024-04-29 22:37:50 +02:00
Nicholas Nethercote
99e036bd21 Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00
Nadrieril
50531806ee Add a non-shallow fake borrow 2024-04-20 16:01:35 +02:00
beepster4096
17073464ad remove optionality from MoveData::base_local 2024-04-19 16:50:46 -07:00
Oli Scherer
84acfe86de Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
Vadim Petrochenkov
b40ea03f8a rustc_index: Add a ZERO constant to index types
It is commonly used.
2024-04-03 19:06:22 +03:00
Ralf Jung
6177530420 refactor check_{lang,library}_ub: use a single intrinsic, put policy into library 2024-03-23 18:45:05 +01:00
Michael Goulet
ff0c31e6b9 Programmatically convert some of the pat ctors 2024-03-22 11:13:29 -04:00
Michael Goulet
81e7e80990 Eagerly convert some ctors to use their specialized ctors 2024-03-22 11:12:01 -04:00
Mark Rousskov
02f1930595 step cfgs 2024-03-20 08:49:13 -04:00
Ben Kimock
5a93a59fd5 Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
Matthias Krüger
d774fbea7c
Rollup merge of #119365 - nbdd0121:asm-goto, r=Amanieu
Add asm goto support to `asm!`

Tracking issue: #119364

This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto).

Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary.

r? ``@Amanieu``
cc ``@ojeda``
2024-03-08 08:19:17 +01:00
Oli Scherer
f2612daf58 Return a struct from query intrinsic to be able to add another field in the next commit 2024-03-04 16:13:50 +00:00
Gary Guo
3b1dd1bfa9 Implement asm goto in MIR and MIR lowering 2024-02-24 18:50:09 +00:00
Gary Guo
b044aaa905 Change InlineAsm to allow multiple targets instead 2024-02-24 18:50:09 +00:00
bors
dfa88b328f Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin
Implement intrinsics with fallback bodies

fixes #93145 (though we can port many more intrinsics)
cc #63585

The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for

* codegen_ssa (so llvm and gcc)
* codegen_cranelift

other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body).

cc `@scottmcm` `@WaffleLapkin`

### todo

* [ ] miri support
* [x] default intrinsic name to name of function instead of requiring it to be specified in attribute
* [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16 09:53:01 +00:00
Matthias Krüger
30057f0266
Rollup merge of #120802 - oli-obk:drop_elab_ice, r=compiler-errors
Bail out of drop elaboration when encountering error types

fixes  #120788
2024-02-13 06:27:38 +01:00
Oli Scherer
0eee945680 Make is_intrinsic query return the intrinsic name 2024-02-12 09:33:52 +00:00
Zalathar
a2479a4ae7 Remove unnecessary min_specialization after bootstrap
These crates all needed specialization for `newtype_index!`, which will no
longer be necessary when the current nightly eventually becomes the next
bootstrap compiler.
2024-02-10 18:15:11 +11:00
bors
e28fae52d9 Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113671 (Make privacy visitor use types more (instead of HIR))
 - #120308 (core/time: avoid divisions in Duration::new)
 - #120693 (Invert diagnostic lints.)
 - #120704 (A drive-by rewrite of `give_region_a_name()`)
 - #120809 (Use `transmute_unchecked` in `NonZero::new`.)
 - #120817 (Fix more `ty::Error` ICEs in MIR passes)
 - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.)
 - #120831 (Startup objects disappearing from sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-09 15:34:48 +00:00
Matthias Krüger
46a0448405
Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwco
Invert diagnostic lints.

That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.

r? ````@davidtwco````
2024-02-09 14:41:50 +01:00
Oli Scherer
2d73597b93 Bail out of drop elaboration when encountering error types 2024-02-08 17:51:32 +00:00
Ben Kimock
8836ac5758 Add a new debug_assertions instrinsic (compiler)
And in clippy
2024-02-08 11:49:08 -05:00
Michael Goulet
c98d6994a3 More comments, final tweaks 2024-02-06 02:22:58 +00:00
Michael Goulet
a82bae2172 Teach typeck/borrowck/solvers how to deal with async closures 2024-02-06 02:22:58 +00:00
Michael Goulet
c567eddec2 Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
Nicholas Nethercote
0ac1195ee0 Invert diagnostic lints.
That is, change `diagnostic_outside_of_impl` and
`untranslatable_diagnostic` from `allow` to `deny`, because more than
half of the compiler has be converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow`
attributes, which proves that this change is warranted.
2024-02-06 13:12:33 +11:00
clubby789
fd29f74ff8 Remove unused features 2024-01-25 14:01:33 +00:00
Camille GILLOT
e07ffe97b8 Use a plain bitset for liveness analyses. 2024-01-22 23:18:45 +00:00
Georgiy Komarov
7842043b99
Add a warning comment 2024-01-20 16:52:18 -03:00
Georgiy Komarov
270f1510be
rustc_mir_dataflow: Add exports for external tools
Added back previously available exports:

* Forward/Backward: used when implementing `AnalysisDomain`
* Engine: used in user's code to solve the dataflow problem
* SwitchIntEdgeEffects: used when implementing functions of the `Analysis` trait
* graphviz: potentially useful for debugging purposes

These exports are used when implementing external tools based on MIR
dataflow framework.

Closes #120130
2024-01-20 14:42:27 -03:00
Matthias Krüger
3ae7ab698f
Rollup merge of #115291 - cjgillot:dest-prop-save, r=JakobDegen
Save liveness results for DestinationPropagation

`DestinationPropagation` needs to verify that merge candidates do not conflict with each other. This is done by verifying that a local is not live when its counterpart is written to.

To get the liveness information, the pass runs `MaybeLiveLocals` dataflow analysis repeatedly, once for each propagation round. This is quite costly, and the main driver for the perf impact on `ucd` and `diesel`. (See https://github.com/rust-lang/rust/pull/115105#issuecomment-1689205908)

In order to mitigate this cost, this PR proposes to save the result of the analysis into a `SparseIntervalMatrix`, and mirror merges of locals into that matrix: `liveness(destination) := liveness(destination) union liveness(source)`.

<details>
<summary>Proof</summary>

We denote by `'` all the quantities of the transformed program. Let $\varphi$ be a mapping of locals, which maps `source` to `destination`, and is identity otherwise. The exact liveness set after a statement is $out'(statement)$, and the proposed liveness set is $\varphi(out(statement))$.

Consider a statement. Suppose that the output state verifies $out' \subset phi(out)$. We want to prove that $in' \subset \varphi(in)$ where $in = (out - kill) \cup gen$, and conclude by induction.

We have 2 cases: either that statement is kept with locals renumbered by $\varphi$, or it is a tautological assignment and it removed.

1. If the statement is kept: the gen-set and the kill-set of $statement' = \varphi(statement)$ are $gen' = \varphi(gen)$ and $kill' = \varphi(kill)$ exactly.
From soundness requirement 3, $\varphi(in)$ is disjoint from $\varphi(kill)$.
This implies that $\varphi(out - kill)$ is disjoint from $\varphi(kill)$, and so $\varphi(out - kill) = \varphi(out) - \varphi(kill)$. Then $\varphi(in) = (\varphi(out) - \varphi(kill)) \cup \varphi(gen) = (\varphi(out) - kill') \cup gen'$.
We can conclude that $out' \subset \varphi(out) \implies in' \subset \varphi(in)$.

2. If the statement is removed. As $\varphi(statement)$ is a tautological assignment, we know that $\varphi(gen) = \varphi(kill) = \\{ destination \\}$, while $gen' = kill' = \emptyset$. So $\varphi(in) = \varphi(out) \cup \\{ destination \\}$. Then $in' = out' \subset out \subset \varphi(in)$.

By recursion, we can conclude by that $in' \subset \varphi(in)$ everywhere.
</details>

This approximate liveness results is only suboptimal if there are locals that fully disappear from the CFG due to an assignment cycle. These cases are quite unlikely, so we do not bother with them.

This change allows to reduce the perf impact of DestinationPropagation by half on diesel and ucd (https://github.com/rust-lang/rust/pull/115105#issuecomment-1694701904).

cc ````@JakobDegen````
2024-01-17 20:21:19 +01:00
Martin Nordholts
16ba56c242 compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-15 19:07:11 +01:00
Camille GILLOT
1d6723a77a Use for_each instead of fold. 2024-01-07 20:09:26 +00:00
Camille GILLOT
3082028be3 Fix comment. 2024-01-07 20:07:36 +00:00
Camille GILLOT
da235ce92d Do not recompute liveness for DestinationPropagation. 2024-01-07 20:07:35 +00:00
Camille GILLOT
c4b1054525 Move PointIndex to mir_dataflow. 2024-01-07 20:07:35 +00:00
Michael Goulet
fcb42b42d6 Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
Nicholas Nethercote
99472c7049 Remove Session methods that duplicate DiagCtxt methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Tomasz Miąsko
b4877753c3 Don't require owned data in MaybeStorageDead 2023-12-21 12:58:39 +01:00
Matthias Krüger
8479945c08 NFC don't convert types to identical types 2023-12-15 23:56:24 +01:00
surechen
40ae34194c remove redundant imports
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-10 10:56:22 +08:00
Nicholas Nethercote
4b364b6f0f Tweak GenKillAnalysis.
`GenKillAnalysis` has five methods that take a transfer function arg:
- `statement_effect`
- `before_statement_effect`
- `terminator_effect`
- `before_terminator_effect`
- `call_return_effect`

All the transfer function args have type `&mut impl GenKill<Self::Idx>`,
except for `terminator_effect`, which takes the simpler `Self::Domain`.

But only the first two need to be `impl GenKill`. The other
three can all be `Self::Domain`, just like `Analysis`. So this commit
changes the last two to take `Self::Domain`, making `GenKillAnalysis`
and `Analysis` more similar.

(Another idea would be to make all these methods `impl GenKill`. But
that doesn't work: `MaybeInitializedPlaces::terminator_effect` requires
the arg be `Self::Domain` so that `self_is_unwind_dead(place, state)`
can be called on it.)
2023-12-08 09:49:11 +11:00
Nicholas Nethercote
60e7c6898b Remove impl_visitable!.
It is used just once. With it removed, the relevant code is a little
boilerplate-y but much easier to read, and is the same length. Overall I
think it's an improvement.
2023-12-08 07:55:17 +11:00
Nicholas Nethercote
f312775e4f Remove unused arguments from ResultsVisitor::visit_block_{start,end}. 2023-12-08 07:55:17 +11:00
Nicholas Nethercote
e966c89417 Deparameterize Results and ResultsCursor.
They both now only ever contain a `Results<'tcx, A>`.

This means `AnalysisResults` can be removed, as can many
`borrow`/`borrow_mut` calls. Also `Results` no longer needs a
`PhantomData` because `'tcx` is now named by `entry_sets`.
2023-11-27 10:35:43 +11:00
Nicholas Nethercote
34aa36b266 Remove ResultsCloned and ResultsClonedCursor.
They're now unused.
2023-11-27 10:35:43 +11:00
Nicholas Nethercote
500e55ba8c Remove uses of ResultsClonedCursor.
By just cloning the entire `Results` in the one place where
`ResultsClonedCursor` was used. This is extra allocations but the
performance effect is negligible.
2023-11-27 10:35:43 +11:00
Nicholas Nethercote
5f5263bfc8 Remove ResultsRefCursor.
It's no longer used.
2023-11-27 10:35:43 +11:00
Nicholas Nethercote
cf82b410f9 Remove another use of as_results_cursor.
The new code is a little clunky, but I couldn't see how to make it
better.
2023-11-27 10:35:43 +11:00
Nicholas Nethercote
d957c47183 Remove CloneAnalysis.
It's only implemented for analyses that implement `Copy`, which means
it's basically a complicated synonym for `Copy`. So this commit removes
it and uses `Copy` directly. (That direct use will be removed in a later
commit.)
2023-11-27 10:35:42 +11:00
Nicholas Nethercote
389e2cc69a Remove some unused code relating to ResultsCloned. 2023-11-27 10:35:42 +11:00
Nicholas Nethercote
b85cba87e4 Use typedefs to clarify some impls.
And insert some whitespace.
2023-11-27 10:35:42 +11:00
Michael Goulet
8dd8db5073
Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnay
Use `is_{some,ok}_and` more in the compiler

slightly more fluent-reading code
2023-11-25 17:23:34 -05:00
Nicholas Nethercote
57cd5e6551 Use rustc_fluent_macro::fluent_messages! directly.
Currently we always do this:
```
use rustc_fluent_macro::fluent_messages;
...
fluent_messages! { "./example.ftl" }
```
But there is no need, we can just do this everywhere:
```
rustc_fluent_macro::fluent_messages! { "./example.ftl" }
```
which is shorter.
2023-11-26 08:38:40 +11:00
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
Michael Goulet
079a2e865f is_{some,ok}_and 2023-11-25 18:47:16 +00: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