Commit Graph

166 Commits

Author SHA1 Message Date
Nicholas Nethercote
0d97669a17 Simplify static_assert_sizes.
We want to run them on all 64-bit platforms.
2024-04-18 15:36:25 +10:00
Zalathar
2d47cd77ac Check x86_64 size assertions on aarch64, too
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to
notice when these assertions have been violated.
2024-04-03 16:53:03 +11:00
orion GONZALEZ (contractor)
6600c972e6 doc: Add better explanation 2024-03-06 16:54:42 +01: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
bors
6351247048 Auto merge of #120024 - Mark-Simulacrum:fast-union-merge, r=cjgillot
Merge into larger interval set

This reduces the work done while merging rows. In at least one case (#50450), we have thousands of union([range], [20,000 ranges]), which previously inserted each of the 20,000 ranges one by one. Now we only insert one range into the right hand set after copying the set over.

This cuts the runtime of the test case in #50450 from ~26 seconds to ~6 seconds locally, though it doesn't change the memory usage peak (~9.5GB).
2024-01-27 22:26:37 +00:00
Matthias Krüger
b31bf24908
Rollup merge of #119800 - dev-ardi:tmp, r=wesleywiser
Document `rustc_index::vec::IndexVec`

Document a few of the methods.

Part of https://github.com/rust-lang/rust/issues/93792.
2024-01-26 23:15:50 +01:00
Ardi
00ada8e30c
Update compiler/rustc_index/src/vec.rs
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2024-01-26 08:37:37 +01:00
clubby789
fd29f74ff8 Remove unused features 2024-01-25 14:01:33 +00:00
Camille GILLOT
7e64de431e Remove uses of HybridBitSet. 2024-01-22 22:53:20 +00:00
Mark Rousskov
1696148a89 Merge into larger interval set
This reduces the work done while merging rows. In at least one case
(issue 50450), we have thousands of union([range], [20,000 ranges]),
which previously inserted each of the 20,000 ranges one by one. Now we
only insert one range into the right hand set after copying the set
over.
2024-01-16 10:21:55 -05:00
ardi
ee8510e4e1 Fix some mistakes + new doc 2024-01-10 18:28:42 +01:00
ardi
1bf3aee381 Oh well 2024-01-10 12:41:29 +01:00
ardi
281ceb2bd2 Document the struct and a few methods 2024-01-10 10:26:18 +01:00
bors
efb3f11087 Auto merge of #119499 - cjgillot:dtm-opt, r=nnethercote
Two small bitset optimisations
2024-01-06 11:54:15 +00:00
Camille GILLOT
0adfe207d7 Reuse bitwise in BitMatrix. 2024-01-02 21:20:04 +00:00
bjorn3
6ed37bdc42 Avoid specialization for the Span Encodable and Decodable impls 2023-12-31 20:42:17 +00:00
Nadrieril
f6af7478ba Mention the relevant tracking issue next to my bit_set hack 2023-12-23 00:04:20 +01:00
Nadrieril
f30c5956f5 Make rustc_index::bit_set available on stable 2023-12-15 16:58:38 +01: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
Michael Goulet
4506681e2f Begin nightly-ifying rustc_type_ir 2023-11-18 00:20:00 +00:00
Nicholas Nethercote
82e396a4ba Remove unnecessary annotation. 2023-11-13 17:09:26 +11:00
Nicholas Nethercote
2433542b41 Remove IndexSlice::convert_index_type. 2023-11-13 17:00:48 +11:00
Nicholas Nethercote
8b18c16ecb Remove impl FiniteBitSetTy for {u64,u128}.
Only the impl for `u32` is used. These can be reinstated easily if
needed in the future.
2023-11-13 16:44:20 +11:00
Nicholas Nethercote
b7cf697a6d Remove BitSet::to_hybrid. 2023-11-13 16:26:26 +11:00
Nicholas Nethercote
06faf589ac Remove BitSet::words. 2023-11-13 16:24:16 +11: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
Camille GILLOT
27d6a57e58 Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
bors
8a6b67f988 Auto merge of #115094 - Mark-Simulacrum:bootstrap-update, r=ozkanonur
Update bootstrap compiler to 1.73.0 beta
2023-08-24 11:10:52 +00:00
Mark Rousskov
0a916062aa Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
Nilstrieb
d16e9c3369 Convert it into a warning
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-08-22 09:17:46 +00:00
Nilstrieb
1b9159e448 Add disclaimer on size assertion macro
Sometimes people are inspired by rustc to add size assertions to their
code and copy the macro. This is bad because it causes hard build
errors. rustc happens to be special where it makes this okay.
2023-08-22 06:59:09 +00:00
Nilstrieb
5830ca216d Add internal_features lint
It lints against features that are inteded to be internal to the
compiler and standard library. Implements MCP #596.

We allow `internal_features` in the standard library and compiler as those
use many features and this _is_ the standard library from the "internal to the compiler and
standard library" after all.

Marking some features as internal wasn't exactly the most scientific approach, I just marked some
mostly obvious features. While there is a categorization in the macro,
it's not very well upheld (should probably be fixed in another PR).

We always pass `-Ainternal_features` in the testsuite
About 400 UI tests and several other tests use internal features.
Instead of throwing the attribute on each one, just always allow them.
There's nothing wrong with testing internal features^^
2023-08-03 14:50:50 +02:00
Mark Rousskov
cc907f80b9 Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
bors
7664dfe433 Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth
Rollup of 5 pull requests

Successful merges:

 - #111741 (Use `ObligationCtxt` in custom type ops)
 - #111840 (Expose more information in `get_body_with_borrowck_facts`)
 - #111876 (Roll compiler_builtins to 0.1.92)
 - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler  )
 - #111915 (libtest: Improve error when missing `-Zunstable-options`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-25 00:33:43 +00:00
Maybe Waffle
fb0f74a8c9 Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
Camille GILLOT
340fc2d08a Leverage the interval property to precompute borrow kill points. 2023-05-19 11:58:31 +00:00
Maybe Waffle
5d809b1764 Decorative changes to IndexVec 2023-04-24 13:53:37 +00:00
Maybe Waffle
7d23b52376 const-ify some {IndexVec, IndexSlice} methods 2023-04-24 13:53:37 +00:00
Maybe Waffle
99ebfe2f15 move index code around 2023-04-24 13:53:37 +00:00
Maybe Waffle
e496fbec92 Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
Maybe Waffle
bd1dfcebe3 Don't allocate it IndexVec::remove 2023-04-18 12:55:54 +00:00
Maybe Waffle
e1cd99f6ff Make IndexVec::ensure_contains_elem return a reference to the element 2023-04-17 14:23:46 +00:00
Nilstrieb
81c320ea77 Fix some clippy::complexity 2023-04-09 23:22:14 +02:00
bors
2824db39f1 Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obk
Use `FieldIdx` in `FieldsShape`

Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
2023-04-06 07:38:58 +00:00
Scott McMurray
21bb8ef24e Use FieldIdx in FieldsShape
Finally got to the main motivating example from the MCP :)
2023-04-04 12:38:06 -07:00
Scott McMurray
5c3e5af2ed Doc-comment IndexVec::from_elem and use it in a few more places 2023-04-03 14:29:32 -07:00
Scott McMurray
a2ee7592d6 Use &IndexSlice instead of &IndexVec where possible
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-02 17:35:37 -07:00
Scott McMurray
b5b6def021 Use FieldIdx in various things related to aggregates
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-04-01 20:32:50 -07:00
Scott McMurray
408e2ac3bb Add IndexSlice to go with IndexVec
Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working.
2023-03-30 11:19:53 -07:00
Scott McMurray
843c5e361e Rename IndexVec::lastlast_index
As I've been trying to replace a `Vec` with an `IndexVec`, having `last` exist on both but returning very different types makes the transition a bit awkward -- the errors are later, where you get things like "there's no `ty` method on `mir::Field`" rather than a more localized error like "hey, there's no `last` on `IndexVec`".

So I propose renaming `last` to `last_index` to help distinguish `Vec::last`, which returns an element, and `IndexVec::last_index`, which returns an index.

(Similarly, `Iterator::last` also returns an element, not an index.)
2023-03-29 00:27:24 -07:00