about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-09-07suggest adding array lengths to references to arraysTakayuki Maeda-29/+120
2022-09-05Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, ↵bors-720/+815
r=cjgillot Separate the receiver from arguments in HIR Related to #100232 cc `@cjgillot`
2022-09-05use `propagate_through_exprs` instead of `propagate_through_expr`Takayuki Maeda-35/+26
fix `ExprKind` static_assert_size fix hir-stats
2022-09-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-194/+172
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05refactor: remove unnecessary variablesTakayuki Maeda-108/+93
2022-09-05separate the receiver from arguments in HIR under /clippyTakayuki Maeda-563/+663
2022-09-05separate the receiver from arguments in HIRTakayuki Maeda-96/+115
2022-09-05Auto merge of #101439 - Dylan-DPC:rollup-2wf1mtj, r=Dylan-DPCbors-287/+726
Rollup of 6 pull requests Successful merges: - #101142 (Improve HIR stats) - #101367 (Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch) - #101391 (more clippy::perf fixes) - #101409 (Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates) - #101420 (Fix `hir::Local` doc to match with the variable name used: `init`) - #101429 (Don't suggest reborrow if usage is inside a closure) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-05Rollup merge of #101429 - compiler-errors:issue-101119, r=lcnrDylan DPC-1/+33
Don't suggest reborrow if usage is inside a closure I can't think of why we would ever be able to *successfully* suggest a mutable reborrow `&mut *` due to a move happening due to a closure, so just suppress it. Fixes #101119
2022-09-05Rollup merge of #101420 - kraktus:doc_hir_local, r=cjgillotDylan DPC-1/+1
Fix `hir::Local` doc to match with the variable name used: `init`
2022-09-05Rollup merge of #101409 - ↵Dylan DPC-2/+21
WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates, r=TaKO8Ki Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates Fixes #101284
2022-09-05Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obkDylan DPC-19/+11
more clippy::perf fixes
2022-09-05Rollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnrDylan DPC-0/+194
Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch Fixes #100699, but in the opposite direction (instead of suggesting to fix the signature, it fixes the body)
2022-09-05Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwcoDylan DPC-264/+466
Improve HIR stats #100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection. r? `@davidtwco`
2022-09-05Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddybbors-4/+56
proc_macro/bridge: use the cross-thread executor for nested proc-macros While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with `@eddyb,` we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? `@eddyb`
2022-09-05Don't suggest reborrow if usage is inside a closureMichael Goulet-1/+33
2022-09-05Address review comments.Nicholas Nethercote-10/+9
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-97/+103
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-76/+65
2022-09-05Remove dead code from `print_generic_args`.Nicholas Nethercote-27/+7
2022-09-05Add some blank lines to the definition of `Res`.Nicholas Nethercote-1/+5
To make the spacing consistent. Also shorten an overly long comment line.
2022-09-05Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomezbors-21/+213
Rustdoc-Json: Add enum discriminant Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as 1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output) 2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60) JSON doesn't have either of these limitations. r? `@GuillaumeGomez`
2022-09-05Auto merge of #100759 - fee1-dead-contrib:const_eval_select_real_intrinsic, ↵bors-285/+438
r=oli-obk,RalfJung Make `const_eval_select` a real intrinsic This fixes issues where `track_caller` functions do not have nice panic messages anymore when there is a call to the function, and uses the MIR system to replace the call instead of dispatching via lang items. Fixes #100696.
2022-09-04Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrumbors-165/+39
Make `ReentrantMutex` movable and `const` As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-04Auto merge of #93455 - asquared31415:vec-zero-opts, r=thomccbors-0/+17
Implement internal `IsZero` for Wrapping and Saturating for `Vec` optimizations This implements the `IsZero` trait for the `Wrapping` and `Saturating` types so that users of these types can get the improved performance from the specialization of creating a `Vec` from a single element repeated when it has a zero bit pattern (example `vec![0_i32; 500]`, or after this PR `vec![Wrapping(0_i32); 500]`) CC #60978
2022-09-04Fix `hir::Local` doc to match with the variable name used: `init`kraktus-1/+1
2022-09-04Auto merge of #101411 - matthiaskrgr:rollup-uj24yb5, r=matthiaskrgrbors-60/+130
Rollup of 7 pull requests Successful merges: - #101322 (Fix internal doc link) - #101385 (updated description of File struct in std::fs) - #101388 (Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`) - #101394 (Forbid mixing `System` with direct sytem allocator calls) - #101397 (rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`) - #101401 (Make `char::is_lowercase` and `char::is_uppercase` const) - #101407 (Remove duplicated test (superseeded by search-form-elements.goml)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-04proc_macro/bridge: use the cross-thread executor for nested proc-macrosNika Layzell-4/+56
While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with @eddyb, we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? @eddyb
2022-09-04Rollup merge of #101407 - GuillaumeGomez:rm-duplicated-gui-test, r=Dylan-DPCMatthias Krüger-22/+0
Remove duplicated test (superseeded by search-form-elements.goml) I realized it when I worked on https://github.com/rust-lang/rust/pull/101348. The checks are more complete in `search-form-elements.goml` (for example [here](https://github.com/rust-lang/rust/blob/master/src/test/rustdoc-gui/search-form-elements.goml#L12-L29)). r? `@Dylan-DPC`
2022-09-04Rollup merge of #101401 - mx00s:expand-const, r=fee1-deadMatthias Krüger-27/+63
Make `char::is_lowercase` and `char::is_uppercase` const Implements #101400.
2022-09-04Rollup merge of #101397 - notriddle:notriddle/source-nav-not-sidebar-sub, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub` It's redundant because there's already a selector `.source nav.sub` with exactly the same margin-left at [line 796]. [line 796]: https://github.com/rust-lang/rust/blob/84f0c3f79a85329dd79a54694ff8a7f427c842e9/src/librustdoc/html/static/css/rustdoc.css#L796 This selector was added in 1e98fb10274ea0245f865ddb1e295e454382000b, along with an identical desktop selector, but that desktop selector was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c as part of a larger simplification.
2022-09-04Rollup merge of #101394 - CAD97:patch-3, r=Mark-SimulacrumMatthias Krüger-1/+4
Forbid mixing `System` with direct sytem allocator calls e.g. [on windows](https://github.com/rust-lang/rust/blob/dec689432fac6720b2f18101ac28a21add98b1b8/library/std/src/sys/windows/alloc.rs#L129-L178), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.
2022-09-04Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-deadMatthias Krüger-3/+57
Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop` Fixes #101376
2022-09-04Rollup merge of #101385 - BartMassey-upstream:file-doc, r=thomccMatthias Krüger-1/+1
updated description of File struct in std::fs I've seen several folks confused by the description of `std::fs::File` as "A reference to an open file on the filesystem." Apparently the word `reference` is sometimes taken to mean a Rust `&` reference, leading to confusion. Here's a recent representative [Reddit thread](https://www.reddit.com/r/rust/comments/x4k0lv/comment/imxu7v2/?utm_source=share&utm_medium=web2x&context=3), but I've seen this before as well. This patch changes the description to "An object providing access to an open file on the filesystem." Hopefully this is clearer.
2022-09-04Rollup merge of #101322 - ChrisDenton:internal-doc, r=Mark-SimulacrumMatthias Krüger-2/+5
Fix internal doc link The doc link from `DedupSortedIter` to `BTreeMap::bulk_build_from_sorted_iter` was broken when building internal documentation, This prevented me from building internal documentation locally: ``` R:\Rust\rust> $env:RUSTDOCFLAGS="--document-private-items" R:\Rust\rust> x doc library/std --open --stage 0 Building rustbuild Compiling bootstrap v0.0.0 (R:\Rust\rust\src\bootstrap) Finished dev [unoptimized] target(s) in 3.15s Documenting stage0 std (x86_64-pc-windows-msvc) Documenting core v0.0.0 (R:\Rust\rust\library\core) Finished release [optimized] target(s) in 36.42s Checking core v0.0.0 (R:\Rust\rust\library\core) Checking rustc-std-workspace-core v1.99.0 (R:\Rust\rust\library\rustc-std-workspace-core) Checking compiler_builtins v0.1.79 Documenting alloc v0.0.0 (R:\Rust\rust\library\alloc) error: unresolved link to `BTreeMap::bulk_build_from_sorted_iter` --> library\alloc\src\collections\btree\dedup_sorted_iter.rs:6:15 | 6 | /// Used by [`BTreeMap::bulk_build_from_sorted_iter`]. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `BTreeMap` in scope | = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings` error: could not document `alloc` ```
2022-09-04Don't fire `rust_2021_incompatible_closure_captures` in edition = 2021Maybe Waffle-2/+21
2022-09-04Test internal documentationChris Denton-1/+2
2022-09-04Address feedback from PR #101401Sage Mitchell-12/+20
2022-09-04Make `char::is_lowercase` and `char::is_uppercase` constSage Mitchell-27/+55
Implements #101400.
2022-09-04Remove duplicated test (superseeded by search-form-elements.goml)Guillaume Gomez-22/+0
2022-09-04Auto merge of #101296 - compiler-errors:head-span-for-enclosing-scope, r=oli-obkbors-288/+287
Use head span for `rustc_on_unimplemented`'s `enclosing_scope` attr This may make #101281 slightly easier to understand
2022-09-04Add `inline(always)` to rt functionsDeadbeef-0/+4
2022-09-04remap mir before running optimization passesDeadbeef-4/+7
2022-09-04Add `inline(always)` to function generated by macroDeadbeef-0/+1
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-285/+430
2022-09-04rustdoc: Compute enum discriminant on demandNixon Enraght-Moony-24/+28
2022-09-04Auto merge of #101250 - klensy:bump-deps-08-22, r=Dylan-DPCbors-131/+33
bump deps Update few crates to drop old/duplicated versions. updates pest* crates (no separate changelog, sadly: https://github.com/pest-parser/pest/releases), thiserror, handlebars(https://github.com/sunng87/handlebars-rust/blob/v4.3.3/CHANGELOG.md#433---2022-07-20) to drop old ones: ``` Removing block-buffer v0.7.3 Removing block-padding v0.1.5 Removing byte-tools v0.3.1 Removing byteorder v1.3.4 Removing digest v0.8.1 Removing fake-simd v0.1.2 Removing generic-array v0.12.4 Updating handlebars v4.1.0 -> v4.3.3 Removing opaque-debug v0.2.3 Updating pest v2.1.3 -> v2.3.0 Updating pest_derive v2.1.0 -> v2.3.0 Updating pest_generator v2.1.3 -> v2.3.0 Updating pest_meta v2.1.3 -> v2.3.0 Removing quick-error v2.0.0 Removing sha-1 v0.8.2 Updating thiserror v1.0.30 -> v1.0.33 Updating thiserror-impl v1.0.30 -> v1.0.33 ``` combine v4.6.3 -> v4.6.6: drops `use_std` features, addressed this comment: https://github.com/rust-lang/rust/blob/4fd4de7ea358ad6fc28c5780533ea8ccc09e1006/src/tools/rustc-workspace-hack/Cargo.toml#L80-L82 im-rc v15.0.0 -> v15.1.0 to drop rand_xoshiro duplicated version ``` Updating im-rc v15.0.0 -> v15.1.0 Removing rand_xoshiro v0.4.0 ```
2022-09-04Auto merge of #100726 - jswrenn:transmute, r=oli-obkbors-734/+1319
safe transmute: use `Assume` struct to provide analysis options This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411). **Before:** ```rust pub unsafe trait BikeshedIntrinsicFrom< Src, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, > where Src: ?Sized, {} ``` **After:** ```rust pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }> where Src: ?Sized, {} ``` `Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change). r? `@oli-obk` --- Related: - https://github.com/rust-lang/compiler-team/issues/411 - https://github.com/rust-lang/rust/issues/99571
2022-09-04Also suggest dereferencing LHS when both &mut T and T are valid binop LHSMichael Goulet-0/+43
2022-09-04Auto merge of #101312 - nikic:update-llvm-7, r=cuviperbors-0/+0
Update LLVM submodule This updates to the current 15.x branch plus one cherry-pick. Fixes #100834. Fixes #101121.