Commit Graph

217692 Commits

Author SHA1 Message Date
Maybe Waffle
dce666b797 Copy ty::AssocItem even in rustdoc 2023-02-15 20:22:45 +00:00
Maybe Waffle
a32d392741 Copy ty::AssocItem all other the place 2023-02-15 20:22:41 +00:00
Maybe Waffle
236ddf36b3 Remove arena_cache modifier from queries which return Copy types 2023-02-15 20:13:59 +00:00
Kornel
4c2d48ee80 Suggest simpler fs helper methods in File::{open,create} 2023-02-15 18:58:38 +00:00
Kornel
15adc7b5e4 Demonstrate I/O in File examples 2023-02-15 18:47:50 +00:00
Martin Gammelsæter
e159c1e0ec Skip method calls with arity mismatch 2023-02-15 18:52:23 +01:00
Martin Gammelsæter
08cc628e73 Add point-at-inference ui test for wrong arity case 2023-02-15 18:44:03 +01:00
Callum Leslie
29621ba288
clarify correctness of black_box 2023-02-15 16:22:08 +00:00
bors
2d14db321b Auto merge of #108006 - cjgillot:def-impl, r=oli-obk
Avoid accessing HIR when it can be avoided

Experiment to see if it helps some incremental cases.

Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged.

r? `@ghost`
2023-02-15 16:14:10 +00:00
Alex Crichton
d90f7df674 wasm: Register the relaxed-simd target feature
This WebAssembly proposal is likely to reach stage 4 soon so this starts
the support in Rust for the proposal by adding a target feature that can
be enabled via attributes for the stdarch project to bind the
intrinsics.
2023-02-15 08:13:32 -08:00
onestacked
a14a4fc3d0 Constify RangeBounds, RangeX::contains and RangeX::is_empty. 2023-02-15 15:50:54 +01:00
Ben Kimock
de01ea26c9 Fix unintentional UB in ui tests 2023-02-15 09:05:05 -05:00
clubby789
f4de121951 Don't suggest #[doc(hidden)] methods 2023-02-15 12:31:38 +00:00
Guillaume Gomez
86fd5a1b44 Use more let chain 2023-02-15 12:00:03 +01:00
Oli Scherer
38b7cdf393 Use target instead of machine for mir interpreter integer handling.
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15 08:56:18 +00:00
bors
999ac5f777 Auto merge of #108070 - Dylan-DPC:rollup-v6xw7vk, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #105300 (rework min_choice algorithm of member constraints)
 - #107163 (Remove some superfluous type parameters from layout.rs.)
 - #107173 (Suggest the correct array length on mismatch)
 - #107411 (Handle discriminant in DataflowConstProp)
 - #107968 (Enable `#[thread_local]` on armv6k-nintendo-3ds)
 - #108032 (Un📦ing the Resolver)
 - #108060 (Revert to using `RtlGenRandom` as a fallback)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-15 08:48:44 +00:00
Zephaniah Ong
54cfc10fa5 make x look for x.py if shell script does not exist
bump up x version

Refactor code
2023-02-15 15:19:49 +08:00
Dylan DPC
ef6de70c77
Rollup merge of #108060 - ChrisDenton:rtlgenrandom, r=thomcc
Revert to using `RtlGenRandom` as a fallback

This is required due to `BCryptGenRandom` failing to load a dll it depends on.

Fixes #108059
2023-02-15 12:24:56 +05:30
Dylan DPC
504225c0a7
Rollup merge of #108032 - oli-obk:un📦ing_resolver, r=petrochenkov
Un📦ing the Resolver

r? `@petrochenkov`

pulled out of https://github.com/rust-lang/rust/pull/105462
2023-02-15 12:24:56 +05:30
Dylan DPC
587e3dfa80
Rollup merge of #107968 - ian-h-chamberlain:feature/3ds-enable-thread-local, r=Nilstrieb
Enable `#[thread_local]` on armv6k-nintendo-3ds

Since [libctru 2.1.2](https://github.com/devkitPro/libctru/releases/tag/v2.1.2)  was released we should now be able to use real `#[thread_local]` without corruption issues on the 3DS target.

CC `@Meziu` `@AzureMarker` `@Techie-Pi`
https://github.com/rust3ds/ctru-rs/issues/91#issuecomment-1426821450
2023-02-15 12:24:55 +05:30
Dylan DPC
c78e3c735a
Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obk
Handle discriminant in DataflowConstProp

cc ``@jachris``
r? ``@JakobDegen``

This PR attempts to extend the DataflowConstProp pass to handle propagation of discriminants. We handle this by adding 2 new variants to `TrackElem`: `TrackElem::Variant` for enum variants and `TrackElem::Discriminant` for the enum discriminant pseudo-place.

The difficulty is that the enum discriminant and enum variants may alias each another. This is the issue of the `Option<NonZeroUsize>` test, which is the equivalent of https://github.com/rust-lang/unsafe-code-guidelines/issues/84 with a direct write.

To handle that, we generalize the flood process to flood all the potentially aliasing places. In particular:
- any write to `(PLACE as Variant)`, either direct or through a projection, floods `(PLACE as OtherVariant)` for all other variants and `discriminant(PLACE)`;
- `SetDiscriminant(PLACE)` floods `(PLACE as Variant)` for each variant.

This implies that flooding is not hierarchical any more, and that an assignment to a non-tracked place may need to flood a tracked place. This is handled by `for_each_aliasing_place` which generalizes `preorder_invoke`.

As we deaggregate enums by putting `SetDiscriminant` last, this allows to propagate the value of the discriminant.

This refactor will allow to make https://github.com/rust-lang/rust/pull/107009 able to handle discriminants too.
2023-02-15 12:24:55 +05:30
Dylan DPC
a110cf5d16
Rollup merge of #107173 - clubby789:suggest-array-length, r=compiler-errors
Suggest the correct array length on mismatch

Fixes #107156

I wasn't able to find a way to get the `Span` for the actual array size unfortunately, so this suggestion can't be applied automatically.

``@rustbot`` label +A-diagnostics
2023-02-15 12:24:54 +05:30
Dylan DPC
9800dbe883
Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8Ki
Remove some superfluous type parameters from layout.rs.

Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-02-15 12:24:54 +05:30
Dylan DPC
83f10ea5b7
Rollup merge of #105300 - aliemjay:member-lower, r=oli-obk
rework min_choice algorithm of member constraints

See [this comment](https://github.com/rust-lang/rust/pull/105300#issuecomment-1384312743) for the description of the new algorithm.

Fixes #63033
Fixes #104639

This uses a more general algorithm than #89056 that doesn't treat `'static` as a special case. It thus accepts more code. For example:
```rust
async fn test2<'s>(_: &'s u8, _: &'_ &'s u8, _: &'_ &'s u8) {}
```
I claim it's more correct as well because it fixes #104639.

cc ``@nikomatsakis`` ``@lqd`` ``@tmandry`` ``@eholk`` ``@chenyukang`` ``@oli-obk``

r? types
2023-02-15 12:24:53 +05:30
bors
068161ea48 Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, r=compiler-errors
use semantic equality for const param type equality assertion

Fixes #107898

See added test for what caused this ICE

---

The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics:
- it will ICE when there are infer vars in a projection in a const param ty
- it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq`
- i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic.

This impl feels pretty Not Great to me  although i am not sure what a better idea would be.

- We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing)
- `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments.

We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better.

We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it.

r? `@compiler-errors`
2023-02-15 05:17:58 +00:00
Wesley Norris
19714385e0 Add kernel-address sanitizer support for freestanding targets 2023-02-14 20:54:25 -05:00
Ben Kimock
37a875cbdb Try to fix codegen tests for ??? LLVM 14 ??? 2023-02-14 19:49:49 -05:00
Ben Kimock
a82adf0125 Fix codegen tests 2023-02-14 19:21:58 -05:00
Michael Goulet
3f80017f03 Better label for illegal impl trait types 2023-02-14 23:12:27 +00:00
Guillaume Gomez
374f798ad2 Correctly handle reexports of #[doc(hidden)] is reexport does not use #[doc(inline)] 2023-02-15 00:00:51 +01:00
Michael Goulet
b096f0e0f0 Make permit_uninit/zero_init fallible 2023-02-14 22:37:30 +00:00
Guillaume Gomez
1ec1d94812 Add test for reexports attr merge 2023-02-14 23:23:59 +01:00
Guillaume Gomez
02a845a826 Correctly handle reexport traversal by fixing multiple bugs, especially for items with a path of 1 element 2023-02-14 23:23:59 +01:00
Nicholas Nethercote
9a53cee868 Replace an unnecessary mk_ty call with mk_array. 2023-02-15 09:04:21 +11:00
Nicholas Nethercote
a4d3c9a1a4 Pre-intern some ReVars and ReLateBounds. 2023-02-15 09:02:44 +11:00
Nicholas Nethercote
cef9004f5a Add specialized variants of mk_region.
Much like there are specialized variants of `mk_ty`. This will enable
some optimization in the next commit.

Also rename the existing `re_error*` functions as `mk_re_error*`, for
consistency.
2023-02-15 09:02:44 +11:00
Nicholas Nethercote
7439028374 Remove reuse_or_mk_region.
It's not used on any hot paths, and so has little perf benefit, and it
interferes with the optimizations in the following commits.
2023-02-15 09:02:44 +11:00
bors
0416b1a6f6 Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #107573 (Update the minimum external LLVM to 14)
 - #107626 (Fix `x fix` on the standard library itself)
 - #107673 (update ICU4X to 1.1.0)
 - #107733 (Store metrics from `metrics.json` to CI PGO timer)
 - #108007 (Use `is_str` instead of string kind comparison)
 - #108033 (add an unstable `#[rustc_coinductive]` attribute)
 - #108039 (Refactor refcounted structural_impls via functors)
 - #108040 (Use derive attributes for uninteresting traversals)
 - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-14 21:07:04 +00:00
Camille GILLOT
065f0b222d Move query out of path. 2023-02-14 20:27:38 +00:00
Camille GILLOT
40cb4d1bc7 Even less HIR. 2023-02-14 20:27:38 +00:00
Camille GILLOT
68fb752035 Do not fetch HIR to check target features. 2023-02-14 20:27:38 +00:00
Camille GILLOT
e49e7f6a2e Do not fetch HIR to compute symbols. 2023-02-14 20:27:36 +00:00
Camille GILLOT
0d39f9d94d Do not fetch HIR to monomorphize impls. 2023-02-14 20:26:04 +00:00
Camille GILLOT
facecf6e1b Fetch less HIR in signature check. 2023-02-14 20:26:03 +00:00
Camille GILLOT
e9e12266ce Do not fetch HIR for reachable. 2023-02-14 20:26:01 +00:00
Esteban Küber
dff10d0668 Re-add replacement logic and add comment explaining it 2023-02-14 20:22:10 +00:00
Esteban Küber
755252bf51 Show the effects of weird code commented out 2023-02-14 20:22:10 +00:00
Esteban Küber
bd176ee591 Make removal suggestion not verbose 2023-02-14 20:22:10 +00:00
Esteban Küber
5d63e10318 rebase and review comments 2023-02-14 20:22:10 +00:00
Esteban Küber
287cd5974c Avoid trailing commas 2023-02-14 20:22:10 +00:00