about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-12-04Make `Borrow` and `BorrowMut` impls `const`woppopo-7/+14
2021-10-21Auto merge of #90126 - flip1995:clippyup, r=Manishearthbors-631/+4353
Update Clippy r? `@Manishearth` This adds a new dep to Clippy: [indoc](https://crates.io/crates/indoc) And transitively: [unindent](https://crates.io/crates/unindent)
2021-10-21Auto merge of #90130 - Mark-Simulacrum:revert-namebinding, r=oli-obkbors-145/+213
Revert "resolve: Use NameBinding for local variables and generic parameters" This reverts commit 6162529a01473bbb2427fa27354cbafc3c514eee, that is, PR #89100. Reverting per performance regression noted post-merge on that PR (https://github.com/rust-lang/rust/pull/89100#issuecomment-948065457).
2021-10-21Revert "Auto merge of #89100 - petrochenkov:localbind, r=cjgillot"Mark Rousskov-145/+213
This reverts commit 6162529a01473bbb2427fa27354cbafc3c514eee.
2021-10-21Update Cargo.lockflip1995-3/+19
2021-10-21Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyupflip1995-628/+4334
2021-10-21Auto merge of #7853 - flip1995:rustup, r=flip1995bors-625/+316
Rustup r? `@ghost` changelog: none
2021-10-21Bump nightly version -> 2021-10-21flip1995-1/+1
2021-10-21Bump Clippy Version -> 0.1.58flip1995-3/+3
2021-10-21Merge remote-tracking branch 'upstream/master' into rustupflip1995-642/+4358
2021-10-21Auto merge of #7852 - surechen:fix_typo, r=xFrednetbors-1/+2
Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items. Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items. changelog: none
2021-10-21Auto merge of #90119 - JohnTitor:rollup-e5t6khz, r=JohnTitorbors-342/+227
Rollup of 14 pull requests Successful merges: - #86984 (Reject octal zeros in IPv4 addresses) - #87440 (Remove unnecessary condition in Barrier::wait()) - #88644 (`AbstractConst` private fields) - #89292 (Stabilize CString::from_vec_with_nul[_unchecked]) - #90010 (Avoid overflow in `VecDeque::with_capacity_in()`.) - #90029 (Add test for debug logging during incremental compilation) - #90031 (config: add the option to enable LLVM tests) - #90048 (Add test for line-number setting) - #90071 (Remove hir::map::blocks and use FnKind instead) - #90074 (2229 migrations small cleanup) - #90077 (Make `From` impls of NonZero integer const.) - #90097 (Add test for duplicated sidebar entries for reexported macro) - #90098 (Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations) - #90099 (Fix MIRI UB in `Vec::swap_remove`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-21Fix typo for INVALID_NULL_PTR_USAGE and MISSING_INLINE_IN_PUBLIC_ITEMS.surechen-1/+2
2021-10-21Rollup merge of #90099 - SkiFire13:fix-vec-swap-remove, r=dtolnayYuki Okushi-3/+4
Fix MIRI UB in `Vec::swap_remove` Fixes #90055 I find it weird that `Vec::swap_remove` read the last element to the stack just to immediately put it back in the `Vec` in place of the one at index `index`. It seems much more natural to me to just read the element at position `index` and then move the last element in its place. I guess this might also slightly improve codegen.
2021-10-21Rollup merge of #90098 - ↵Yuki Okushi-1/+10
GuillaumeGomez:add-test-foreign-impl-missing-doc-code-examples, r=jyn514 Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations Fixes #76450. r? ````@jyn514````
2021-10-21Rollup merge of #90097 - ↵Yuki Okushi-6/+19
GuillaumeGomez:duplicated-sidebar-entry-reexported-macro, r=notriddle Add test for duplicated sidebar entries for reexported macro Fixes #90015. r? ````@notriddle````
2021-10-21Rollup merge of #90077 - woppopo:const_nonzero_from, r=oli-obkYuki Okushi-8/+13
Make `From` impls of NonZero integer const. I also changed the feature gate added to `From` impls of Atomic integer to `const_num_from_num` from `const_convert`. Tracking issue: #87852
2021-10-21Rollup merge of #90074 - klensy:upvar-all, r=wesleywiserYuki Okushi-4/+4
2229 migrations small cleanup This removes needless `format!`'ing of empty string and replaces `vec!` with const strings with const array.
2021-10-21Rollup merge of #90071 - cjgillot:no-blocks, r=oli-obkYuki Okushi-260/+47
Remove hir::map::blocks and use FnKind instead The principal tool is `FnLikeNode`, which is not often used and can be easily implemented using `rustc_hir::intravisit::FnKind`.
2021-10-21Rollup merge of #90048 - GuillaumeGomez:line-number-setting, r=jshaYuki Okushi-1/+24
Add test for line-number setting The first commit updates the version of the package to be able to have multi-line commands (which looks much nicer for this test). r? ````@jsha````
2021-10-21Rollup merge of #90031 - durin42:allow-llvm-tests, r=Mark-SimulacrumYuki Okushi-1/+13
config: add the option to enable LLVM tests I'm working on some LLVM patches in concert with a Rust patch, and it's helping me quite a bit to have this as an option. It doesn't seem that hard, so I figured I'd formalize it in x.py and send it upstream.
2021-10-21Rollup merge of #90029 - tgnottingham:incr-debug-logging-test, r=Mark-SimulacrumYuki Okushi-4/+25
Add test for debug logging during incremental compilation Debug logging during incremental compilation had been broken for some time, until #89343 fixed it (among other things). Add a test so this is less likely to break without being noticed. This test is nearly a copy of the `src/test/ui/rustc-rust-log.rs` test, but tests debug logging in the incremental compliation code paths.
2021-10-21Rollup merge of #90010 - rusticstuff:vecdeque_with_capacity_in_overflow, ↵Yuki Okushi-1/+1
r=m-ou-se Avoid overflow in `VecDeque::with_capacity_in()`. The overflow only happens if alloc is compiled with overflow checks enabled and the passed capacity is greater or equal 2^(usize::BITS-1). The overflow shadows the expected "capacity overflow" panic leading to a test failure if overflow checks are enabled for std in the CI. Unblocks [CI: Enable overflow checks for test (non-dist) builds #89776](https://github.com/rust-lang/rust/pull/89776). For some reason the overflow is only observable with optimization turned off, but that is a separate issue.
2021-10-21Rollup merge of #89292 - CleanCut:stabilize-cstring_from_vec_with_nul, ↵Yuki Okushi-13/+9
r=JohnTitor Stabilize CString::from_vec_with_nul[_unchecked] Closes the tracking issue #73179. I am keeping this in _draft_ mode until the FCP has ended. This is my first time stabilizing a feature, so I would appreciate any guidance on things I should do differently. Closes #73179
2021-10-21Rollup merge of #88644 - eopb:abstractconst_leaf_subst, r=lcnrYuki Okushi-29/+25
`AbstractConst` private fields Calls `subst` in `AbstractConst::root` when `Node` is `Leaf`. r? ``@lcnr``
2021-10-21Rollup merge of #87440 - twetzel59:fix-barrier-no-op, r=yaahcYuki Okushi-1/+1
Remove unnecessary condition in Barrier::wait() This is my first pull request for Rust, so feel free to call me out if anything is amiss. After some examination, I realized that the second condition of the "spurious-wakeup-handler" loop in ``std::sync::Barrier::wait()`` should always evaluate to ``true``, making it redundant in the ``&&`` expression. Here is the affected function before the fix: ```rust #[stable(feature = "rust1", since = "1.0.0")] pub fn wait(&self) -> BarrierWaitResult { let mut lock = self.lock.lock().unwrap(); let local_gen = lock.generation_id; lock.count += 1; if lock.count < self.num_threads { // We need a while loop to guard against spurious wakeups. // https://en.wikipedia.org/wiki/Spurious_wakeup while local_gen == lock.generation_id && lock.count < self.num_threads { // fixme lock = self.cvar.wait(lock).unwrap(); } BarrierWaitResult(false) } else { lock.count = 0; lock.generation_id = lock.generation_id.wrapping_add(1); self.cvar.notify_all(); BarrierWaitResult(true) } } ``` At first glance, it seems that the check that ``lock.count < self.num_threads`` would be necessary in order for a thread A to detect when another thread B has caused the barrier to reach its thread count, making thread B the "leader". However, the control flow implicitly results in an invariant that makes observing ``!(lock.count < self.num_threads)``, i.e. ``lock.count >= self.num_threads`` impossible from thread A. When thread B, which will be the leader, calls ``.wait()`` on this shared instance of the ``Barrier``, it locks the mutex in the first line and saves the ``MutexGuard`` in the ``lock`` variable. It then increments the value of ``lock.count``. However, it then proceeds to check if ``lock.count < self.num_threads``. Since it is the leader, it is the case that (after the increment of ``lock.count``), the lock count is *equal* to the number of threads. Thus, the second branch is immediately taken and ``lock.count`` is zeroed. Additionally, the generation ID is incremented (with wrap). Then, the condition variable is signalled. But, the other threads are waiting at the line ``lock = self.cvar.wait(lock).unwrap();``, so they cannot resume until thread B's call to ``Barrier::wait()`` returns, which drops the ``MutexGuard`` acquired in the first ``let`` statement and unlocks the mutex. The order of events is thus: 1. A thread A calls `.wait()` 2. `.wait()` acquires the mutex, increments `lock.count`, and takes the first branch 3. Thread A enters the ``while`` loop since the generation ID has not changed and the count is less than the number of threads for the ``Barrier`` 3. Spurious wakeups occur, but both conditions hold, so the thread A waits on the condition variable 4. This process repeats for N - 2 additional times for non-leader threads A' 5. *Meanwhile*, Thread B calls ``Barrier::wait()`` on the same barrier that threads A, A', A'', etc. are waiting on. The thread count reaches the number of threads for the ``Barrier``, so all threads should now proceed, with B being the leader. B acquires the mutex and increments the value ``lock.count`` only to find that it is not less than ``self.num_threads``. Thus, it immediately clamps ``self.num_threads`` back down to 0 and increments the generation. Then, it signals the condvar to tell the A (prime) threads that they may continue. 6. The A, A', A''... threads wake up and attempt to re-acquire the ``lock`` as per the internal operation of a condition variable. When each A has exclusive access to the mutex, it finds that ``lock.generation_id`` no longer matches ``local_generation`` **and the ``&&`` expression short-circuits -- and even if it were to evaluate it, ``self.count`` is definitely less than ``self.num_threads`` because it has been reset to ``0`` by thread B *before* B dropped its ``MutexGuard``**. Therefore, it my understanding that it would be impossible for the non-leader threads to ever see the second boolean expression evaluate to anything other than ``true``. This PR simply removes that condition. Any input would be appreciated. Sorry if this is terribly verbose. I'm new to the Rust community and concurrency can be hard to explain in words. Thanks!
2021-10-21Rollup merge of #86984 - Smittyvb:ipv4-octal-zero, r=m-ou-seYuki Okushi-10/+32
Reject octal zeros in IPv4 addresses This fixes #86964 by rejecting octal zeros in IP addresses, such that `192.168.00.00000000` is rejected with a parse error, since having leading zeros in front of another zero indicates it is a zero written in octal notation, which is not allowed in the strict mode specified by RFC 6943 3.1.1. Octal rejection was implemented in #83652, but due to the way it was implemented octal zeros were still allowed.
2021-10-21Auto merge of #90072 - ehuss:empty-rmeta-no-warn, r=Mark-Simulacrumbors-0/+9
Don't emit a warning for empty rmeta files. This avoids displaying a warning when attempting to load an empty rmeta file. Warnings were enabled via #89634 which can cause a lot of noise (for example, running `./x.py check`). rustc generates empty rmeta files for things like binaries, which can happen when checking libraries as unittests. Closes #89795
2021-10-21Auto merge of #89998 - camelid:box-default, r=jyn514bors-13/+17
rustdoc: Box some fields of `GenericParamDefKind` to reduce size This change shrinks `GenericParamDef` from 120 to 56 bytes. `GenericParamDef` is used a lot, so the extra indirection should hopefully be worth the size savings. r? `@ghost`
2021-10-20fix 'since' version numberNathan Stocks-1/+1
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
2021-10-20Auto merge of #7838 - nhamovitz:trailing_zs_arr_wo_repr, r=Manishearthbors-0/+389
Warn on structs with a trailing zero-sized array but no `repr` attribute Closes #2868 changelog: Implement ``[`trailing_empty_array`]``, which warns if a struct is defined where the last field is a zero-sized array but there are no `repr` attributes. Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters. Either way, a `repr` attribute is needed.
2021-10-20stabilize CString::from_vec_with_nul[_unchecked]Nathan Stocks-13/+9
2021-10-20Auto merge of #89978 - cjgillot:qarray, r=Mark-Simulacrumbors-538/+420
Merge the two depkind vtables Knowledge of `DepKind`s is managed using two arrays containing flags (is_anon, eval_always, fingerprint_style), and function pointers (forcing and loading code). This PR aims at merging the two arrays so as to reduce unneeded indirect calls and (hopefully) increase code locality. r? `@ghost`
2021-10-20Address review.Camille GILLOT-8/+1
2021-10-20Auto merge of #7849 - ThibsG:SafetyDoc, r=llogiqbors-0/+22
FIx FP in `missing_safety_doc` lint Fix FP where lint souldn't fire if any parent has `#[doc(hidden)]` attribute fixes: #7347 changelog: [`missing_safety_doc`] Fix FP if any parent has `#[doc(hidden)]` attribute
2021-10-20Inline DepNodeParams methods.Camille GILLOT-1/+18
2021-10-20Compute query vtable manually.Camille GILLOT-27/+29
2021-10-20Store node_intern_event_id in CurrentDepGraph.Camille GILLOT-22/+24
2021-10-20Build jump table at runtime.Camille GILLOT-130/+111
2021-10-20Invoke callbacks from rustc_middle.Camille GILLOT-47/+42
2021-10-20Merge two query callbacks arrays.Camille GILLOT-247/+180
2021-10-20Drop has_params.Camille GILLOT-40/+4
2021-10-20Make hash_result an Option.Camille GILLOT-41/+39
2021-10-20Move def_path_hash_to_def_id to rustc_middle.Camille GILLOT-28/+23
2021-10-20Avoid trivial lambdas.Camille GILLOT-4/+6
2021-10-20Do not lint if any parent has hidden attributeThibsG-0/+22
2021-10-20Add test to ensure that the missing_doc_code_examples is not triggered on ↵Guillaume Gomez-1/+10
foreign trait implementations
2021-10-20Auto merge of #90050 - michaelwoerister:fix-vtable-debug-name-crash-90019, ↵bors-7/+14
r=wesleywiser Erase late-bound regions before computing vtable debuginfo name. Fixes #90019. The `msvc_enum_fallback()` for computing enum type names needs to access the memory layout of niche enums in order to determine the type name. `compute_debuginfo_vtable_name()` did not properly erase regions before computing type names which made memory layout computation ICE when encountering un-erased regions. r? `@wesleywiser`
2021-10-20Add test for duplicated sidebar entries for reexported macroGuillaume Gomez-6/+19
2021-10-20Prevent invalid values from existing in Vec::swap_removeGiacomo Stevanato-3/+4