about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-09-30Auto merge of #116195 - fmease:rustdoc-investigate-perf-regression, ↵bors-27/+16
r=GuillaumeGomez rustdoc: speed up processing of cross-crate fns to fix a perf regression * The first commit doesn't affect perf but get's rid of a `.clone()` and a bunch of lines of code. I can drop it if you'd like me to * The second commit, *“reduce the amount of `asyncness` query executions”*, addresses the perf regression introduced in #116084 r? `@ghost`
2023-09-30Auto merge of #116280 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 4 commits in e6aabe8b3fcf639be3a5bf68e77853bd7b3fa27d..59596f0f31a94fde48b5aa7e945cd0b7ceca9620 2023-09-26 16:31:53 +0000 to 2023-09-29 19:29:17 +0000 - refactor: Switch from termcolor to anstream (rust-lang/cargo#12751) - Add missing `strip` entries in `dev` and `release` profiles. (rust-lang/cargo#12748) - Add better suggestion for the unsupported silent flag (rust-lang/cargo#12723) - docs(ref): Establish publish best practices (rust-lang/cargo#12745) r? ghost
2023-09-30Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubileebors-46/+313
Prototype using const generic for simd_shuffle IDX array cc https://github.com/rust-lang/rust/issues/85229 r? `@workingjubilee` on the design TLDR: there is now a `fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;` intrinsic that allows replacing ```rust simd_shuffle(a, b, const { stuff }) ``` with ```rust simd_shuffle_generic::<_, _, {&stuff}>(a, b) ``` which makes the compiler implementations much simpler, if we manage to at some point eliminate `simd_shuffle`. There are some issues with this today though (can't do math without bubbling it up in the generic arguments). With this change, we can start porting the simple cases and get better data on the others.
2023-09-30Auto merge of #115546 - SUPERCILEX:patch-2, r=Amanieubors-4/+4
Weaken needlessly restrictive orderings on Arc::*_count Follow up to https://github.com/rust-lang/rust/pull/95183 from this zulip: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Why.20does.20Arc.3A.3Astrong_count.20use.20Acquire.20instead.20of.20Relaxed.3F/near/386213850 I'd like to use the strong_count for a lockless algorithm I'm writing, but I don't need acquire semantics so that's pointlessly restrictive on arm/risc-v.
2023-09-30Update cargoWeihang Lo-0/+0
2023-09-30Auto merge of #115368 - loongarch-rs:none-tier2, r=pietroalbinibors-3/+7
Promote loongarch64-unknown-none* to Tier 2 MCP: https://github.com/rust-lang/compiler-team/issues/664
2023-09-30rustdoc: reduce the amount of `asyncness` query executionsLeón Orell Valerian Liehr-1/+7
2023-09-29rustdoc: simplify sugared_async_return_typeLeón Orell Valerian Liehr-26/+9
2023-09-29Auto merge of #116275 - matthiaskrgr:rollup-prx5fto, r=matthiaskrgrbors-80/+450
Rollup of 6 pull requests Successful merges: - #112123 (fix(suggestion): insert projection to associated types) - #116024 (Implement Region for smir) - #116030 (run abi/compatibility test against a whole bunch of targets) - #116216 (ci: upgrade to crosstool-ng 1.26.0) - #116241 (Add Exclusive forwarding impls (FnOnce, FnMut, Generator)) - #116263 (More fixes for running the test suite on a bare metal target) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-29Rollup merge of #116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obkMatthias Krüger-4/+17
More fixes for running the test suite on a bare metal target This PR adds more fixes needed to run the test suite on bare metal targets (in this case, without unwinding and with static relocations). There is no CI job exercising tests without unwinds, but I can confirm this worked in Ferrocene's CI.
2023-09-29Rollup merge of #116241 - dtolnay:exclusivefwd, r=AmanieuMatthias Krüger-1/+45
Add Exclusive forwarding impls (FnOnce, FnMut, Generator) This is adapted from #104057.
2023-09-29Rollup merge of #116216 - heiher:crosstool, r=KobzolMatthias Krüger-23/+5
ci: upgrade to crosstool-ng 1.26.0 This PR upgrades our builders from crosstool-ng 1.25.0 to 1.26.0. Except for LoongArch64 and RISC-V 64, which have minor version upgrades, other architectures have not changed.
2023-09-29Rollup merge of #116030 - RalfJung:abi-compat-test, r=wesleywiserMatthias Krüger-10/+173
run abi/compatibility test against a whole bunch of targets
2023-09-29Rollup merge of #116024 - ouz-a:smir_region, r=oli-obkMatthias Krüger-13/+121
Implement Region for smir Adds Region and it's relevant types to smir and covers them with stable implementation r? `@oli-obk`
2023-09-29Rollup merge of #112123 - bvanjoi:fix-98562, r=compiler-errorsMatthias Krüger-29/+89
fix(suggestion): insert projection to associated types Fixes #98562 This PR has fixed some help suggestions for unsupported syntax, such as `fn f<T>(_:T) where T: IntoIterator, std::iter::IntoIterator::Item = () {}` to `fn f<T: IntoIterator<Item = ()>>(_T) {}`.
2023-09-29Auto merge of #113301 - Be-ing:stabilize_bundle_whole-archive, r=petrochenkovbors-48/+5
stabilize combining +bundle and +whole-archive link modifiers Per discussion on https://github.com/rust-lang/rust/issues/108081 combining +bundle and +whole-archive already works and can be stabilized independently of other aspects of the packed_bundled_libs feature. There is no risk of regression because this was not previously allowed. r? `@petrochenkov`
2023-09-29Auto merge of #113797 - RalfJung:offset_from_docs, r=workingjubileebors-6/+40
offset_from: docs improvements This is the part of https://github.com/rust-lang/rust/pull/112837 that doesn't add a new function, just tweaks the existing docs.
2023-09-29mark relevant tests as requiring unwindingPietro Albini-2/+5
2023-09-29Auto merge of #115759 - oli-obk:open_drop_from_non-ADT, r=lcnrbors-83/+177
Reveal opaque types before drop elaboration fixes https://github.com/rust-lang/rust/issues/113594 r? `@cjgillot` cc `@JakobDegen` This pass was introduced in https://github.com/rust-lang/rust/pull/110714 I moved it before drop elaboration (which only cares about the hidden types of things, not the opaque TAIT or RPIT type) and set it to run unconditionally (instead of depending on the optimization level and whether the inliner is active)
2023-09-29add needs-relocation-model-pic to compiletestPietro Albini-2/+12
2023-09-29fix(suggestion): insert projection to associated typesbohan-29/+89
2023-09-29Auto merge of #116260 - matthiaskrgr:rollup-q3sge0i, r=matthiaskrgrbors-263/+615
Rollup of 7 pull requests Successful merges: - #116133 (ref(bootstrap.py): add `eprint` function) - #116201 (Fix `noop_method_call` detection) - #116231 (Remove `rustc_lint_defs::lint_array`) - #116234 (Miri subtree update) - #116239 (Only visit reachable nodes in SsaLocals.) - #116245 (Clippy backport: Move needless_raw_string_hashes to pedantic) - #116253 (Make `adt_const_params` feature suggestion consistent with other features and improve when it is emitted) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-29Rollup merge of #116253 - asquared31415:adt_const_params_feature, ↵Matthias Krüger-84/+254
r=compiler-errors Make `adt_const_params` feature suggestion consistent with other features and improve when it is emitted Makes the suggestion to add `adt_const_params` formatted like every other feature gate (notably this makes it such that the playground recognizes it). Additionally improves the situations in which that help is emitted so that it's only emitted when the type would be valid or the type *could* be valid (using a slightly incorrect heuristic that favors suggesting the feature over not) instead of, for example, implying that adding the feature would allow the use of `String`. Also adds the "the only supported types are integers, `bool` and `char`" note to the errors on fn and raw pointers. r? `@compiler-errors`
2023-09-29Rollup merge of #116245 - flip1995:clippy-backport, r=ManishearthMatthias Krüger-1/+1
Clippy backport: Move needless_raw_string_hashes to pedantic Really small backport this time. Context: https://github.com/rust-lang/rust-clippy/pull/11415#issuecomment-1739880932 I'd rather get this in 1.74 than waiting another release cycle. r? `@Manishearth` cc `@Mark-Simulacrum` This should be merged before beta is branched tomorrow.
2023-09-29Rollup merge of #116239 - cjgillot:issue-116212, r=WaffleLapkinMatthias Krüger-8/+18
Only visit reachable nodes in SsaLocals. Fixes https://github.com/rust-lang/rust/issues/116212
2023-09-29Rollup merge of #116234 - RalfJung:miri, r=RalfJungMatthias Krüger-78/+239
Miri subtree update r? `@ghost`
2023-09-29Rollup merge of #116231 - DaniPopes:simpler-lint-array, r=NilstriebMatthias Krüger-36/+23
Remove `rustc_lint_defs::lint_array`
2023-09-29Rollup merge of #116201 - Jarcho:noop_fix, r=fee1-deadMatthias Krüger-7/+39
Fix `noop_method_call` detection This needs to be merged before #116198 can compile. The error occurs before the compiler is built so this needs to be a separate PR.
2023-09-29Rollup merge of #116133 - pouriya:refactor-bootstrap.py, r=albertlarsan68Matthias Krüger-49/+41
ref(bootstrap.py): add `eprint` function Implemented a 3-line function called `eprint` which is just like `print` but for `stderr`. So each `print(..., file=sys.stderr)` becomes `eprint(...)`. <br/> Testing `eprint` function: ```sh $ cat eprint.py ``` ```python import sys def eprint(*args, **kwargs): kwargs['file'] = sys.stderr print(*args, **kwargs) eval('eprint({})'.format(sys.argv[1])) ``` ```sh $ python3 eprint.py '"hello"' hello $ ``` ```sh $ python3 eprint.py '"hello"' 2>/dev/null $ ``` ```sh $ python3 eprint.py '"hello", "world", flush=True, file=sys.stdout' hello world $ ``` ```sh $ python3 eprint.py '"hello", "world", flush=True, file=sys.stdout' 2>/dev/null $ ```
2023-09-29Auto merge of #116176 - FedericoStra:isqrt, r=dtolnaybors-0/+165
Add "integer square root" method to integer primitive types For every suffix `N` among `8`, `16`, `32`, `64`, `128` and `size`, this PR adds the methods ```rust const fn uN::isqrt() -> uN; const fn iN::isqrt() -> iN; const fn iN::checked_isqrt() -> Option<iN>; ``` to compute the [integer square root](https://en.wikipedia.org/wiki/Integer_square_root), addressing issue #89273. The implementation is based on the [base 2 digit-by-digit algorithm](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_(base_2)) on Wikipedia, which after some benchmarking has proved to be faster than both binary search and Heron's/Newton's method. I haven't had the time to understand and port [this code](http://atoms.alife.co.uk/sqrt/SquareRoot.java) based on lookup tables instead, but I'm not sure whether it's worth complicating such a function this much for relatively little benefit.
2023-09-29Auto merge of #116089 - estebank:issue-115992-2, r=compiler-errorsbors-75/+306
When suggesting `self.x` for `S { x }`, use `S { x: self.x }` Fix #115992. r? `@compiler-errors` Follow up to #116086.
2023-09-29Auto merge of #115986 - onur-ozkan:fix-cross-compilation-lto-problem, ↵bors-3/+18
r=wesleywiser allow LTO on `proc-macro` crates with `-Zdylib-lto` ref https://github.com/rust-lang/rust/pull/115986#issuecomment-1732316361 Fixes #110296
2023-09-29Auto merge of #115843 - lcnr:bb-provisional-cache, r=compiler-errorsbors-188/+142
new solver: remove provisional cache The provisional cache is a performance optimization if there are large, interleaving cycles. Such cycles generally do not exist. It is incredibly complex and unsound in all trait solvers which have one: the old solver, chalk, and the new solver ([link](https://github.com/rust-lang/rust/blob/master/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs)). Given the assumption that it is not perf-critical and also incredibly complex, remove it from the new solver, only checking whether a goal is on the stack. While writing this, I uncovered two additional soundness bugs, see the inline comments for them. r? `@compiler-errors`
2023-09-29Auto merge of #115821 - obeis:hir-analysis-migrate-diagnostics-5, ↵bors-125/+236
r=compiler-errors Migrate `rustc_hir_analysis` to session diagnostic [Part 5] Finishing `coherence/builtin.rs` file
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-84/+254
only suggest it when the type can probably work
2023-09-28Auto merge of #115659 - compiler-errors:itp, r=cjgillotbors-226/+50
Stabilize `impl_trait_projections` Closes #115659 ## TL;DR: This allows us to mention `Self` and `T::Assoc` in async fn and return-position `impl Trait`, as you would expect you'd be able to. Some examples: ```rust #![feature(return_position_impl_trait_in_trait, async_fn_in_trait)] // (just needed for final tests below) // ---------------------------------------- // struct Wrapper<'a, T>(&'a T); impl Wrapper<'_, ()> { async fn async_fn() -> Self { //^ Previously rejected because it returns `-> Self`, not `-> Wrapper<'_, ()>`. Wrapper(&()) } fn impl_trait() -> impl Iterator<Item = Self> { //^ Previously rejected because it mentions `Self`, not `Wrapper<'_, ()>`. std::iter::once(Wrapper(&())) } } // ---------------------------------------- // trait Trait<'a> { type Assoc; fn new() -> Self::Assoc; } impl Trait<'_> for () { type Assoc = (); fn new() {} } impl<'a, T: Trait<'a>> Wrapper<'a, T> { async fn mk_assoc() -> T::Assoc { //^ Previously rejected because `T::Assoc` doesn't mention `'a` in the HIR, // but ends up resolving to `<T as Trait<'a>>::Assoc`, which does rely on `'a`. // That's the important part -- the elided trait. T::new() } fn a_few_assocs() -> impl Iterator<Item = T::Assoc> { //^ Previously rejected for the same reason [T::new(), T::new(), T::new()].into_iter() } } // ---------------------------------------- // trait InTrait { async fn async_fn() -> Self; fn impl_trait() -> impl Iterator<Item = Self>; } impl InTrait for &() { async fn async_fn() -> Self { &() } //^ Previously rejected just like inherent impls fn impl_trait() -> impl Iterator<Item = Self> { //^ Previously rejected just like inherent impls [&()].into_iter() } } ``` ## Technical: Lifetimes in return-position `impl Trait` (and `async fn`) are duplicated as early-bound generics local to the opaque in order to make sure we are able to substitute any late-bound lifetimes from the function in the opaque's hidden type. (The [dev guide](https://rustc-dev-guide.rust-lang.org/return-position-impl-trait-in-trait.html#aside-opaque-lifetime-duplication) has a small section about why this is necessary -- this was written for RPITITs, but it applies to all RPITs) Prior to #103491, all of the early-bound lifetimes not local to the opaque were replaced with `'static` to avoid issues where relating opaques caused their *non-captured* lifetimes to be related. This `'static` replacement led to strange and possibly unsound behaviors (https://github.com/rust-lang/rust/issues/61949#issuecomment-508836314) (https://github.com/rust-lang/rust/issues/53613) when referencing the `Self` type alias in an impl or indirectly referencing a lifetime parameter via a projection type (via a `T::Assoc` projection without an explicit trait), since lifetime resolution is performed on the HIR, when neither `T::Assoc`-style projections or `Self` in impls are expanded. Therefore an error was implemented in #62849 to deny this subtle behavior as a known limitation of the compiler. It was attempted by `@cjgillot` to fix this in #91403, which was subsequently unlanded. Then it was re-attempted to much success (🎉) in #103491, which is where we currently are in the compiler. The PR above (#103491) fixed this issue technically by *not* replacing the opaque's parent lifetimes with `'static`, but instead using variance to properly track which lifetimes are captured and are not. The PR gated any of the "side-effects" of the PR behind a feature gate (`impl_trait_projections`) presumably to avoid having to involve T-lang or T-types in the PR as well. `@cjgillot` can clarify this if I'm misunderstanding what their intention was with the feature gate. Since we're not replacing (possibly *invariant*!) lifetimes with `'static` anymore, there are no more soundness concerns here. Therefore, this PR removes the feature gate. Tests: * `tests/ui/async-await/feature-self-return-type.rs` * `tests/ui/impl-trait/feature-self-return-type.rs` * `tests/ui/async-await/issues/issue-78600.rs` * `tests/ui/impl-trait/capture-lifetime-not-in-hir.rs` --- r? cjgillot on the impl (not much, just removing the feature gate) I'm gonna mark this as FCP for T-lang and T-types.
2023-09-28Remove `rustc_lint_defs::lint_array`DaniPopes-36/+23
2023-09-28Auto merge of #116199 - Urgau:simplify-invalid_ref_casting, r=cjgillotbors-134/+182
Simplify some of the logic in the `invalid_reference_casting` lint This PR simplifies 2 areas of the logic for the `invalid_reference_casting` lint: - The init detection: we now use the newly added `expr_or_init` function instead of a manual detection - The ref-to-mut-ptr casting detection logic: I simplified this logic by caring less hardly about the order of the casting operations Those two simplifications permits us to detect more cases, as can be seen in the test output changes.
2023-09-28Move needless_raw_string_hashes to pedanticAlex Macleod-1/+1
2023-09-28Add Exclusive forwarding impls (FnOnce, FnMut, Generator)David Tolnay-1/+45
2023-09-28Auto merge of #116227 - nikic:update-llvm-14, r=cuviperbors-0/+0
Update LLVM submodule Update LLVM submodule to pull in additional 17.x backports. Fixes https://github.com/rust-lang/rust/issues/115970. Fixes miscompile from https://github.com/rust-lang/rust/pull/115554. Fixes miscompile from https://github.com/rust-lang/rust/pull/102099. Fixes inlining regressions mentioned at https://github.com/rust-lang/llvm-project/pull/153.
2023-09-28Only visit reachable nodes in SsaLocals.Camille GILLOT-8/+4
2023-09-28Add test for 116212.Camille GILLOT-0/+14
2023-09-28remove unimplementedouz-a-1/+1
2023-09-28simplify visitouz-a-28/+2
2023-09-28visit and fold ty::refouz-a-2/+8
2023-09-28simplify foldouz-a-34/+3
2023-09-28change visit to fold for ty and regouz-a-5/+5
2023-09-28Add a mir validation check to prevent OpaqueCast after analysis passes finishOli Scherer-0/+9
2023-09-28Skip reinterning if nothing changedOli Scherer-9/+7