Commit Graph

3494 Commits

Author SHA1 Message Date
Matthias Krüger
32317b5a5b Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compiler-errors
Unify validity checks into a single query

Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern.

I am planning on adding a further initness to check in #100423, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.

I am not entirely happy with the naming and key type and open for improvements.

r? oli-obk
2023-02-27 06:11:52 +01:00
bjorn3
9e7c646319 Merge branch 'staging' 2023-02-26 17:57:03 +00:00
bjorn3
b88e129915 Avoid a duplicate "[TEST] rust-random/rand" 2023-02-26 17:37:29 +00:00
bjorn3
c615e9248a Run tests for all crates in the regex workspace 2023-02-26 17:35:53 +00:00
bjorn3
b193419ec7 Allow multiple threads and panicking tests when testing regex
I guess this was a leftover from very early in the development of
cg_clif. Allowing multiple threads significantly improves performance,
while panicking tests can run now thanks to -Zpanic-abort-tests.
2023-02-26 16:50:08 +00:00
bjorn3
19ed2139a3 Remove no longer necessary code removing "[codegen mono items]" from test output 2023-02-26 14:34:36 +00:00
bjorn3
5e6cde150e Remove --cap-lint warn from regex test 2023-02-26 14:34:36 +00:00
bjorn3
7a864c8ef5 Update test repo versions 2023-02-26 14:34:28 +00:00
bjorn3
aea3bd6641 Re-enable DataflowConstProp for standard library builds 2023-02-26 13:01:47 +00:00
bjorn3
91979e01cf Rustup to rustc 1.69.0-nightly (34e6673a0 2023-02-25) 2023-02-26 13:36:16 +01:00
bjorn3
83222f18f4 Sync from rust 34e6673a04 2023-02-26 13:26:37 +01:00
bjorn3
a45a81a6a2 Patch coretests separately from the standard library source 2023-02-26 12:15:25 +00:00
bjorn3
f79601fbb0 Reduce verbosity of rand testing 2023-02-25 18:01:42 +00:00
bjorn3
be19c03e69 Silence almost all warnings when compiling coretests 2023-02-25 17:54:01 +00:00
bjorn3
26d0d255ce Reduce verbosity of libcore testing 2023-02-25 17:48:45 +00:00
bjorn3
fdfa277158 Rustup to rustc 1.69.0-nightly (c5c7d2b37 2023-02-24) 2023-02-25 18:17:06 +01:00
bjorn3
d53964130f Sync from rust c5c7d2b377 2023-02-25 18:10:33 +01:00
Nicholas Nethercote
eb84167837 Rename many interner functions.
(This is a large commit. The changes to
`compiler/rustc_middle/src/ty/context.rs` are the most important ones.)

The current naming scheme is a mess, with a mix of `_intern_`, `intern_`
and `mk_` prefixes, with little consistency. In particular, in many
cases it's easy to use an iterator interner when a (preferable) slice
interner is available.

The guiding principles of the new naming system:
- No `_intern_` prefixes.
- The `intern_` prefix is for internal operations.
- The `mk_` prefix is for external operations.
- For cases where there is a slice interner and an iterator interner,
  the former is `mk_foo` and the latter is `mk_foo_from_iter`.

Also, `slice_interners!` and `direct_interners!` can now be `pub` or
non-`pub`, which helps enforce the internal/external operations
division.

It's not perfect, but I think it's a clear improvement.

The following lists show everything that was renamed.

slice_interners
- const_list
  - mk_const_list -> mk_const_list_from_iter
  - intern_const_list -> mk_const_list
- substs
  - mk_substs -> mk_substs_from_iter
  - intern_substs -> mk_substs
  - check_substs -> check_and_mk_substs (this is a weird one)
- canonical_var_infos
  - intern_canonical_var_infos -> mk_canonical_var_infos
- poly_existential_predicates
  - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter
  - intern_poly_existential_predicates -> mk_poly_existential_predicates
  - _intern_poly_existential_predicates -> intern_poly_existential_predicates
- predicates
  - mk_predicates -> mk_predicates_from_iter
  - intern_predicates -> mk_predicates
  - _intern_predicates -> intern_predicates
- projs
  - intern_projs -> mk_projs
- place_elems
  - mk_place_elems -> mk_place_elems_from_iter
  - intern_place_elems -> mk_place_elems
- bound_variable_kinds
  - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter
  - intern_bound_variable_kinds -> mk_bound_variable_kinds

direct_interners
- region
  - intern_region (unchanged)
- const
  - mk_const_internal -> intern_const
- const_allocation
  - intern_const_alloc -> mk_const_alloc
- layout
  - intern_layout -> mk_layout
- adt_def
  - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid)
  - alloc_adt_def(!) -> mk_adt_def
- external_constraints
  - intern_external_constraints -> mk_external_constraints

Other
- type_list
  - mk_type_list -> mk_type_list_from_iter
  - intern_type_list -> mk_type_list
- tup
  - mk_tup -> mk_tup_from_iter
  - intern_tup -> mk_tup
2023-02-24 07:32:24 +11:00
Nilstrieb
4036a5722a Unify validity checks into a single query
Previously, there were two queries to check whether a type allows the
0x01 or zeroed bitpattern.

I am planning on adding a further initness to check, truly uninit for
MaybeUninit, which would make this three queries. This seems overkill
for such a small feature, so this PR unifies them into one.
2023-02-23 18:42:36 +00:00
bors
f31fc31dd4 Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obk
Remove type-traversal trait aliases

#107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate.  As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value.

Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream).

This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope.  These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c62.

Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit.  Let me know if you'd like it broken up.

r? `@oli-obk`
2023-02-22 18:26:51 +00:00
Alan Egerton
d9751e46c7 Remove type-traversal trait aliases 2023-02-22 17:04:58 +00:00
David Wood
93fdcfa554 various: translation resources from cg backend
Extend `CodegenBackend` trait with a function returning the translation
resources from the codegen backend, which can be added to the complete
list of resources provided to the emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:54 +00:00
bjorn3
a563e11918 Update Cranelift to 0.93.0
Closes #1352
2023-02-20 17:18:13 +00:00
bjorn3
10c3c7207b Rustup to rustc 1.69.0-nightly (7aa413d59 2023-02-19) 2023-02-20 12:33:39 +01:00
bjorn3
92657711f7 Sync from rust 7aa413d592 2023-02-20 12:24:00 +01:00
bjorn3
5220e60ac6 Rename build job to test 2023-02-19 18:23:49 +00:00
bjorn3
c6f48ebb1d Fix warning 2023-02-19 18:22:15 +00:00
bjorn3
90298f1301 Only allow a single abi-cafe run at a time per branch 2023-02-19 18:08:54 +00:00
bjorn3
f935dc82bc Move abi-cafe runs to a separate workflow 2023-02-19 18:02:18 +00:00
bjorn3
37c269e16a Fix typo 2023-02-19 17:56:34 +00:00
bjorn3
1af867cdf7 Add test for #1318 2023-02-19 17:55:35 +00:00
bjorn3
916a6c17df Update portable-simd 2023-02-19 17:46:51 +00:00
bjorn3
ef6df7e814 Handle wrappers around dyn* in receiver types
Fixes #1324
2023-02-19 17:41:08 +00:00
bjorn3
9e6dfba383 Allow codegen to unsize dyn* to dyn
cg_clif counterpart to rust-lang/rust#106532
2023-02-19 17:22:03 +00:00
bjorn3
b08762493c Fix warnings 2023-02-19 17:11:28 +00:00
bjorn3
c794dc7255 Enable inline stack probes on riscv64
Fixes #1358
2023-02-19 17:08:52 +00:00
bjorn3
98ddd69aae Add wrappers to dist/bin/ too in addition to dist/
Rust's build system since recently expects rustc to be in a bin/
directory if it is specified using the rustc option in config.toml.
2023-02-19 15:28:01 +00:00
bjorn3
746008e791 Rustup to rustc 1.69.0-nightly (4507fdaaa 2023-02-18) 2023-02-19 10:41:09 +01:00
bjorn3
0134916c6e Sync from rust 4507fdaaa2 2023-02-19 10:31:16 +01:00
Camille GILLOT
8996171e88 Stop implementing _with_overflow intrinsics in codegen backends. 2023-02-18 22:06:29 +00:00
Camille GILLOT
39068eb1cc Adapt cg_clif. 2023-02-18 21:35:02 +00:00
bjorn3
cb12ad7397
Merge pull request #1359 from bjorn3/fix_llvm14-builtins-abi
Fix compiler-builtins 0.1.87 on Windows
2023-02-18 19:17:43 +01:00
bjorn3
bb933d26dc Fix abi for checked multiplication 2023-02-18 18:45:27 +01:00
bjorn3
4991d08bc6 Remove incorrect check in lib_call 2023-02-18 16:40:21 +01:00
bjorn3
90a7ee6c70 Check output of checked_div in std_example 2023-02-18 16:40:06 +01:00
bjorn3
a7c0cfc113 Fix return address type 2023-02-18 15:56:26 +01:00
bjorn3
dd5ffc2e18 Split out lib_call_unadjusted function 2023-02-18 15:56:07 +01:00
bjorn3
54648091dd Update to compiler-builtins 0.1.87 2023-02-17 18:46:32 +00:00
bjorn3
29ad465127 Fix float to int compiler builtin call abi 2023-02-17 18:40:22 +00:00
bjorn3
c6a0d3716b Move windows i128 indirect return handling to lib_call 2023-02-17 18:20:34 +00:00