Commit graph

168815 commits

Author SHA1 Message Date
ydah 36ad596ef3 Fix typo
This PR is fixes typo "avaiable" to "available".
2022-05-20 10:39:10 +09:00
bors 4d6992bc18 Auto merge of #97027 - cuviper:yesalias-refcell, r=thomcc
Use pointers in `cell::{Ref,RefMut}` to avoid `noalias`

When `Ref` and `RefMut` were based on references, they would get LLVM `noalias` attributes that were incorrect, because that alias guarantee is only true until the guard drops. A `&RefCell` on the same value can get a new borrow that aliases the previous guard, possibly leading to miscompilation. Using `NonNull` pointers in `Ref` and `RefCell` avoids `noalias`.

Fixes the library side of #63787, but we still might want to explore language solutions there.
2022-05-20 01:05:53 +00:00
Eric Holk 7d1dbdf3de Update IfLet syntax 2022-05-19 16:32:06 -07:00
Eric Holk fce4c7998b Remove old match guard pattern tracking code
This is subsumed by the new changes that count pattern variables as
bound for the whole guard expression.
2022-05-19 16:23:28 -07:00
Eric Holk d08efdec1c Borrow guard patterns for the body of the guard 2022-05-19 16:23:28 -07:00
Eric Holk 7db4c0277d Revert "Count copies of locals as borrowed temporaries"
This reverts commit 0d270b5e9f48268735f9a05462df65c9d1039855.
2022-05-19 16:23:28 -07:00
Eric Holk d5b72058fe Count copies of locals as borrowed temporaries 2022-05-19 16:23:27 -07:00
Eric Holk 577bf0f354 Further reduce test case
Thanks to @tmiasko for this one!
2022-05-19 16:23:27 -07:00
Eric Holk ab8c50f964 Add drop tracking version of yielding-in-match-guard.rs 2022-05-19 16:23:27 -07:00
bors a09d36deae Auto merge of #97180 - Dylan-DPC:rollup-aa5j2yw, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #96539 (Add release notes for 1.61.0)
 - #97142 (move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline)
 - #97155 (Fix doc typo)
 - #97169 (Improve `u32 as char` cast diagnostic)
 - #97170 (Remove unnecessay .report() on ExitCode)
 - #97171 (Add regression test for #88119)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-19 22:43:00 +00:00
Dan Gohman b836cf6fb8 Say "last" instead of "rightmost" in the documentation for std::str::rfind.
In the documentation comment for `std::str::rfind`, say "last" instead
of "rightmost" to describe the match that `rfind` finds. This follows the
spirit of #30459, for which `trim_left` and `trim_right` were replaced by
`trim_start` and `trim_end` to be more clear about how they work on
text which is displayed right-to-left.
2022-05-19 15:31:17 -07:00
bors 6f26383f8e Auto merge of #8841 - Serial-ATA:remove-code-block, r=xFrednet
Remove code block from `pub_enum_variant_names`

changelog: none

Just noticed this empty code block that no other lint has 😄.
![old](https://user-images.githubusercontent.com/69764315/169314573-098ce938-8a4c-4451-afd7-7b082823a0de.png)

r? `@xFrednet`
2022-05-19 21:46:18 +00:00
bors 879cd37fde Auto merge of #8840 - xFrednet:0000-mini-changelog-update, r=llogiq
Mini changelog update for Rust 1.61.0

I'll do the full release and sync tomorrow, as I sadly don't have the time today. This is a quick update to ensure that Rust's changelog will link to the correct section in our changelog.  The change is according to [our docs](8751e47bae/book/src/development/infrastructure/release.md (update-changelogmd))

changelog: none
2022-05-19 20:02:29 +00:00
SylvainDe 4c1daba940 Add implicit call to from_str via parse in documentation
The documentation mentions "FromStr’s from_str method is often used implicitly,
through str’s parse method. See parse’s documentation for examples.".

It may be nicer to show that in the code example as well.
2022-05-19 22:01:43 +02:00
Christian Poveda b67fafddaa
Update .mailmap 2022-05-19 14:13:13 -05:00
ajtribick 1a41a665cf
Reverse condition in Vec::retain_mut doctest 2022-05-19 20:54:16 +02:00
carbotaniuman e24673502f Remove unneeded asserts 2022-05-19 13:51:53 -05:00
Ralf Jung 4bb152c4bc fmt 2022-05-19 20:34:37 +02:00
Ralf Jung 42a91ed70c bless 32bit 2022-05-19 20:20:36 +02:00
Ralf Jung 5514b1176f interpret/validity: separately control checking numbers for being init and non-ptr 2022-05-19 20:16:25 +02:00
bors ea96091331 Auto merge of #8838 - tamaroning:fix_dbg, r=Jarcho,xFrednet
[dbg_macro] tolerates use of `dbg!` in items which have `#[cfg(test)]` attribute

fix: #8758
changelog: [dbg_macro] tolerates use of `dbg!` in items with `#[cfg(test)]` attribute
2022-05-19 15:46:35 +00:00
Dylan DPC 1fb9be0cee
Rollup merge of #97171 - JohnTitor:issue-88119, r=compiler-errors
Add regression test for #88119

Closes #88119
2022-05-19 17:22:51 +02:00
Dylan DPC 175974743a
Rollup merge of #97170 - benediktwerner:master, r=JohnTitor
Remove unnecessay .report() on ExitCode

Since #93442, the return type is `ExitCode` anyway so there's no need to do a conversion using `.report()` (which is now just a no-op).
2022-05-19 17:22:51 +02:00
Dylan DPC 3913d99c40
Rollup merge of #97169 - gimbles:u32-diagnostic, r=petrochenkov
Improve `u32 as char` cast diagnostic

Fixes #97160
2022-05-19 17:22:50 +02:00
Dylan DPC 12644bc39d
Rollup merge of #97155 - alygin:patch-1, r=JohnTitor
Fix doc typo

Fixes a minor doc typo for `atomic::fence()`.
2022-05-19 17:22:49 +02:00
Dylan DPC 362f598a75
Rollup merge of #97142 - SparrowLii:inline, r=tmiasko
move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline

This PR fixes the FIXME in the inline mir-opt which moves processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline
2022-05-19 17:22:48 +02:00
Dylan DPC 0ee37d5836
Rollup merge of #96539 - tmandry:relnotes-1.61, r=Mark-Simulacrum
Add release notes for 1.61.0

cc `@rust-lang/release`
2022-05-19 17:22:47 +02:00
Guillaume Gomez 8fe333abd0 Add new lint to enforce whitespace after keywords 2022-05-19 17:19:22 +02:00
Oli Scherer f9c4f2b7ad Fix up tests 2022-05-19 14:48:39 +00:00
gimbles 9e5c24eaf8 Improve u32 to char diagnostic 2022-05-19 20:03:40 +05:30
Serial 944e1bbca3 Remove code block from pub_enum_variant_names 2022-05-19 10:10:55 -04:00
Christian Poveda 8227e69018
formatting 2022-05-19 09:02:50 -05:00
bors c067287049 Auto merge of #97024 - lcnr:simplify_type-sus, r=<try>
`simplify_type` improvements and cursed docs

the existing `TreatParams` enum pretty much mixes everything up. Not sure why this looked right to me in #94057

This also includes two changes which impact perf:
- `ty::Projection` with inference vars shouldn't be treated as a rigid type, even if fully normalized
- `ty::Placeholder` only unifies with itself, so actually return `Some` for them

r? `@nikomatsakis`
2022-05-19 13:08:51 +00:00
Oli Scherer aa9eae50f3 Stable const things need a stability attribute 2022-05-19 12:30:38 +00:00
Oli Scherer cf5a803600 Rebase fallout 2022-05-19 12:26:06 +00:00
Jacob Pratt 5ff331142e Move check to existing pass
This alters the diagnostics a bit, as the trait method is still stable.
The only thing this check does is ensure that compilation fails if a
trait implementation is declared const-stable.
2022-05-19 12:21:45 +00:00
Jacob Pratt f0620c9503 Proper const stability check, default to unstable
Rather than deferring to const eval for checking if a trait is const, we
now check up-front. This allows the error to be emitted earlier, notably
at the same time as other stability checks.

Also included in this commit is a change of the default const stability
level to UNstable. Previously, an item that was `const` but did not
explicitly state it was unstable was implicitly stable.
2022-05-19 12:21:45 +00:00
Jacob Pratt a9dd4cfa6b Add and use stability helper methods
This avoids an ambiguity (when reading) where `.level.is_stable()` is
not immediately clear whether it is general stability or const
stability.
2022-05-19 12:21:45 +00:00
Jacob Pratt f53fc41cfc Fall back to being const-unstable when undeclared 2022-05-19 12:21:45 +00:00
Yuki Okushi 676604bdd2
Add regression test for #88119 2022-05-19 20:51:32 +09:00
Fridtjof Stoldt b787f4ce2b
Mini changelog update for Rust 1.61.0 2022-05-19 13:43:17 +02:00
tamaron db41df112a fix 2022-05-19 18:58:59 +09:00
benediktwerner 7013dc52d5 Remove unnecessay .report() on ExitCode 2022-05-19 11:47:36 +02:00
bors 6913c7487e Auto merge of #97114 - klensy:cursor-ref, r=petrochenkov
use CursorRef more

This allows skipping clone of `TreeAndSpacing` (and `TokenTree`).
2022-05-19 09:27:55 +00:00
Thayne McCombs 66d88c9a18 Change clear_poison to take the lock instead of a guard 2022-05-19 01:53:41 -06:00
bors 67a9bcb31b Auto merge of #97103 - luqmana:asm-unwind-cleanup, r=Amanieu,tmiasko
Update MIR passes to handle unwinding Inline Asm

Some more follow up fixes from https://github.com/rust-lang/rust/pull/95864#issuecomment-1094165398

r? `@Amanieu`
2022-05-19 06:57:59 +00:00
Luqman Aden af7f53d6d0 Add mir-opt test for asm_unwind + panic=abort 2022-05-18 23:15:00 -07:00
Christian Poveda d839d2ecc2
let generate_field_attrs_code create FieldInfo
this simplifies the code inside the `structure.each` closure argument
and allows to remove the `vis` field from `FieldInfo`.
2022-05-19 00:47:45 -05:00
bors 50872bdb99 Auto merge of #97033 - nbdd0121:unwind3, r=Amanieu
Remove libstd's calls to `C-unwind` foreign functions

Remove all libstd and its dependencies' usage of `extern "C-unwind"`.

This is a prerequiste of a WIP PR which will forbid libraries calling `extern "C-unwind"` functions to be compiled in `-Cpanic=unwind` and linked against `panic_abort` (this restriction is necessary to address soundness bug #96926).
Cargo will ensure all crates are compiled with the same `-Cpanic` but the std is only compiled `-Cpanic=unwind` but needs the ability to be linked into `-Cpanic=abort`.

Currently there are two places where `C-unwind` is used in libstd:
* `__rust_start_panic` is used for interfacing to the panic runtime. This could be `extern "Rust"`
* `_{rdl,rg}_oom`: a shim `__rust_alloc_error_handler` will be generated by codegen to call into one of these; they can also be `extern "Rust"` (in fact, the generated shim is used as `extern "Rust"`, so I am not even sure why these are not, probably because they used to `extern "C"` and was changed to `extern "C-unwind"` when we allow alloc error hooks to unwind, but they really should just be using Rust ABI).

For dependencies, there is only one `extern "C-unwind"` function call, in `unwind` crate. This can be expressed as a re-export.

More dicussions can be seen in the Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/soundness.20in.20mixed.20panic.20mode

`@rustbot` label: T-libs F-c_unwind
2022-05-19 04:04:40 +00:00
bors e6327bc8b8 Auto merge of #97159 - JohnTitor:rollup-ibl51vw, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #96866 (Switch CI bucket uploads to intelligent tiering)
 - #97062 (Couple of refactorings to cg_ssa::base::codegen_crate)
 - #97127 (Revert "Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se")
 - #97131 (Improve println! documentation)
 - #97139 (Move some settings DOM generation out of JS)
 - #97152 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-19 01:41:07 +00:00