Commit Graph

271064 Commits

Author SHA1 Message Date
lcnr
9cba14b95b use TypingEnv when no infcx is available
the behavior of the type system not only depends on the current
assumptions, but also the currentnphase of the compiler. This is
mostly necessary as we need to decide whether and how to reveal
opaque types. We track this via the `TypingMode`.
2024-11-18 10:38:56 +01:00
bors
bf6adec108 Auto merge of #133152 - jhpratt:rollup-wkqs5ud, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #132795 (Check `use<..>` in RPITIT for refinement)
 - #132944 (add parentheses when unboxing suggestion needed)
 - #132993 (Make rustc consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1`)
 - #133130 (`suggest_borrow_generic_arg`: instantiate clauses properly)
 - #133133 (rustdoc-search: add standalone trailing `::` test)
 - #133143 (Diagnostics for let mut in item context)
 - #133147 (Fixup some test directives)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-18 04:17:11 +00:00
Jacob Pratt
f6374b4b71
Rollup merge of #133147 - ChrisDenton:fixup, r=compiler-errors
Fixup some test directives

- A random comment had somehow been turned into an `//`@`` directive.
- More dubiously I also removed leading spaces from directives in 3 UI tests for consistency. These are the only rustc tests that use that formatting.

r? `@jieyouxu`
2024-11-17 22:30:51 -05:00
Jacob Pratt
6c4a7b6ff3
Rollup merge of #133143 - kornelski:let-mut-global, r=compiler-errors
Diagnostics for let mut in item context

The diagnostics for `let` at the top level did not account for `let mut`, which [made the error unclear](https://users.rust-lang.org/t/create-a-vector-of-constants-outside-main/121251/1).

I've made the diagnostic always display a link to valid items. I've added dedicated help for `let mut` case that suggests using a `Mutex` (to steer novice users away from the `static mut` trap). Unfortunately, neither the Rust book, nor libstd docs have dedicated section listing all other types for interior-mutable `static`s.
2024-11-17 22:30:51 -05:00
Jacob Pratt
8600e579d5
Rollup merge of #133133 - notriddle:notriddle/trailing-test, r=GuillaumeGomez
rustdoc-search: add standalone trailing `::` test

Follow up for #132569

r? `@GuillaumeGomez`
2024-11-17 22:30:50 -05:00
Jacob Pratt
fc4f71db68
Rollup merge of #133130 - dianne:fix-133118, r=compiler-errors
`suggest_borrow_generic_arg`: instantiate clauses properly

This simplifies and fixes the way `suggest_borrow_generic_arg` instantiates callees' predicates when testing them to see if a moved argument can instead be borrowed. Previously, it would ICE if the moved argument's type included a region variable, since it was getting passed to a call of `EarlyBinder::instantiate`. This makes the instantiation much more straightforward, which also fixes the ICE.

Fixes #133118

This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut` arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would make it suggest a shared borrow for that argument.
2024-11-17 22:30:49 -05:00
Jacob Pratt
c68fef9fc9
Rollup merge of #132993 - jieyouxu:i_am_very_stable, r=chenyukang
Make rustc consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1`

Addresses https://github.com/rust-lang/rust/issues/123404 to allow test writers to specify `//@ rustc-env:RUSTC_BOOTSTRAP=-1` to have a given rustc consider itself a stable rustc. This is only intended for testing usages.

I did not use `RUSTC_BOOTSTRAP=0` because that can be confusing, i.e. one might think that means "not bootstrapping", but "forcing a given rustc to consider itself a stable compiler" is a different use case.

I also added a specific test to check `RUSTC_BOOTSTRAP`'s various values and how that interacts with rustc's stability story w.r.t. features and cli flags.

Noticed when trying to write a test for enabling ICE file dumping on stable.

Dunno if this needs a compiler FCP or MCP, but I can file an MCP or ask someone to start an FCP if needed. Note that `RUSTC_BOOTSTRAP` is a perma-unstable env var and has no stability guarantees (heh) whatsoever. This does not affect bootstrapping because bootstrap never sets `RUSTC_BOOTSTRAP=-1`. If someone does set that when bootstrapping, it is considered PEBKAC.

Accompanying dev-guide PR: https://github.com/rust-lang/rustc-dev-guide/pull/2136

cc `@estebank` and `@rust-lang/wg-diagnostics` for FYI
2024-11-17 22:30:49 -05:00
Jacob Pratt
c874121487
Rollup merge of #132944 - linyihai:needing-parenthases-issue-132924, r=chenyukang
add parentheses when unboxing suggestion needed

This PR tried to `add parentheses when unboxing suggestion needed`

Fixes #132924
2024-11-17 22:30:48 -05:00
Jacob Pratt
e2993cd06e
Rollup merge of #132795 - compiler-errors:refine-rpitit, r=lcnr
Check `use<..>` in RPITIT for refinement

`#![feature(precise_capturing_in_traits)]` allows users to write `+ use<>` bounds on RPITITs to control what lifetimes are captured by the RPITIT.

Since RPITITs currently also warn for refinement in implementations, this PR extends that refinement check for cases where we *undercapture* in an implementation, since that may be indirectly "promising" a more relaxed outlives bound than the impl author intended.

For an opaque to be refining, we need to capture *fewer* parameters than those mentioned in the captured params of the trait. For example:

```
trait TypeParam<T> {
    fn test() -> impl Sized;
}
// Indirectly capturing a lifetime param through a type param substitution.
impl<'a> TypeParam<&'a ()> for i32 {
    fn test() -> impl Sized + use<> {}
    //~^ WARN impl trait in impl method captures fewer lifetimes than in trait
}
```

Since the opaque in the method (implicitly) captures `use<Self, T>`, and `Self = i32, T = &'a ()` in the impl, we must mention `'a` in our `use<..>` on the impl.

Tracking:
* https://github.com/rust-lang/rust/issues/130044
2024-11-17 22:30:47 -05:00
dianne
546ba3d310 suggest_borrow_generic_arg: instantiate clauses properly
Fixes issue 133118.
This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more
useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut`
arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would
make it suggest a shared borrow for that argument.
2024-11-17 18:09:36 -08:00
Michael Goulet
32d2340dbd Check use<..> in RPITIT for refinement 2024-11-18 00:27:44 +00:00
bors
3fb7e441ae Auto merge of #120370 - x17jiri:likely_unlikely_fix, r=saethlin
Likely unlikely fix

RFC 1131 ( https://github.com/rust-lang/rust/issues/26179 ) added likely/unlikely intrinsics, but they have been broken for a while: https://github.com/rust-lang/rust/issues/96276 , https://github.com/rust-lang/rust/issues/96275 , https://github.com/rust-lang/rust/issues/88767 . This PR tries to fix them.

Changes:
- added a new `cold_path()` intrinsic
- `likely()` and `unlikely()` changed to regular functions implemented using `cold_path()`
2024-11-17 23:57:53 +00:00
Kornel
7765f23ea1
Diagnostics for let mut in item context 2024-11-17 22:30:11 +00:00
Chris Denton
92ff69d368
fixup some test directives 2024-11-17 22:15:54 +00:00
bors
5ec7d6eee7 Auto merge of #132646 - jieyouxu:liberate-aarch64-gnu-debug, r=Kobzol
Liberate `aarch64-gnu-debug` from the shackles of `--test-args=clang`

### Changes

- Drop `--test-args=clang` from `aarch64-gnu-debug` so run-make tests that are `//@ needs-force-clang-based-tests` no longer only run if their test name contains `clang` (which is a very cool footgun).
- Reorganize run-make-suport library slightly to accommodate a raw gcc invocation.
- Fix `tests/run-make/mte-ffi/rmake.rs` to use `gcc` instead of *a* c compiler.

try-job: aarch64-gnu
try-job: aarch64-gnu-debug
2024-11-17 20:51:52 +00:00
Jiri Bobek
777003ae9f Likely unlikely fix 2024-11-17 21:49:10 +01:00
bors
a8e75c53d0 Auto merge of #133135 - jieyouxu:rollup-4q1wbyq, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #133029 (ABI checks: add support for some tier3 arches, warn on others.)
 - #133051 (Increase accuracy of `if` condition misparse suggestion)
 - #133060 (Trim whitespace in RemoveLet primary span)
 - #133093 (Let chains tests)
 - #133116 (stabilize const_ptr_is_null)
 - #133126 (alloc: fix `String`'s doc)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-17 16:24:54 +00:00
许杰友 Jieyou Xu (Joe)
defc8666a3
Rollup merge of #133126 - ohno418:fix-String-doc, r=jhpratt
alloc: fix `String`'s doc

Just a minor fix for `String` struct.
2024-11-17 23:56:11 +08:00
许杰友 Jieyou Xu (Joe)
af1c8be400
Rollup merge of #133116 - RalfJung:const-null-ptr, r=dtolnay
stabilize const_ptr_is_null

FCP passed in https://github.com/rust-lang/rust/issues/74939.

The second commit cleans up const stability around UB checks a bit, now that everything they need (except for `const_eval_select`) is stable.

Fixes https://github.com/rust-lang/rust/issues/74939
2024-11-17 23:56:10 +08:00
许杰友 Jieyou Xu (Joe)
ccc3f862d6
Rollup merge of #133093 - est31:let_chains_tests, r=traviscross
Let chains tests

Filing this as this marks off two of the open issues in #132833:

* extending the tests for `move-guard-if-let-chain.rs` and `conflicting_bindings.rs` to have chains with multiple let's (one implementation could for example search for the first `let` and then terminate).
* An instance where a temporary lives shorter than with nested ifs, breaking compilation: #103476. This was fixed in the end by the if let rescoping work.

Closes #103476
2024-11-17 23:56:10 +08:00
许杰友 Jieyou Xu (Joe)
0b157e88d7
Rollup merge of #133060 - tyrone-wu:removelet-span-suggestion, r=jieyouxu
Trim whitespace in RemoveLet primary span

Separate `RemoveLet` span into primary span for `let` and removal suggestion span for `let `, so that primary span does not include whitespace.

Fixes: #133031
2024-11-17 23:56:09 +08:00
许杰友 Jieyou Xu (Joe)
2f62fd3d13
Rollup merge of #133051 - estebank:cond-misparse, r=jieyouxu
Increase accuracy of `if` condition misparse suggestion

Fix #132656.

Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body".

```
error: expected `{`, found `map`
  --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30
   |
LL |     for _ in [1, 2, 3].iter()map(|x| x) {}
   |                              ^^^ expected `{`
   |
help: you might have meant to write a method call
   |
LL |     for _ in [1, 2, 3].iter().map(|x| x) {}
   |                              +
```

If a macro statement has been parsed after `else`, suggest a missing `if`:

```
error: expected `{`, found `falsy`
  --> $DIR/else-no-if.rs:47:12
   |
LL |     } else falsy! {} {
   |       ---- ^^^^^
   |       |
   |       expected an `if` or a block after this `else`
   |
help: add an `if` if this is the condition of a chained `else if` statement
   |
LL |     } else if falsy! {} {
   |            ++
```
2024-11-17 23:56:08 +08:00
许杰友 Jieyou Xu (Joe)
2d9690d2e7
Rollup merge of #133029 - veluca93:abi-checks-tier3, r=workingjubilee
ABI checks: add support for some tier3 arches, warn on others.

Followup to
- https://github.com/rust-lang/rust/pull/132842
- https://github.com/rust-lang/rust/pull/132173
- https://github.com/rust-lang/rust/issues/131800

r? ``@workingjubilee``
2024-11-17 23:56:08 +08:00
Michael Howell
fa2e214a43 rustdoc-search: add standalone trailing :: test
Follow up for #132569
2024-11-17 08:07:16 -07:00
bors
23e7ecb349 Auto merge of #125949 - erikdesjardins:nocomponent, r=jieyouxu
Revert "tidy: validate LLVM component names in tests"

This reverts #125472.

This has already caused a [bit](https://github.com/rust-lang/rust/pull/125702) of [trouble](https://github.com/rust-lang/rust/pull/125710), and I was mistaken about the original motivation--incorrect component names [_will_](https://github.com/rust-lang/rust/pull/125702#issuecomment-2137030731) be detected by a full CI run.

I no longer think it pulls its weight.

r? `@workingjubilee`
2024-11-17 13:19:56 +00:00
Jieyou Xu
c130501d65 Add a ui test for RUSTC_BOOTSTRAP vs rustc's stability 2024-11-17 19:59:52 +08:00
Jieyou Xu
202caa7c57 Add RUSTC_BOOTSTRAP=-1 to make rustc pretend as stable compiler 2024-11-17 19:59:52 +08:00
bors
1e0df74445 Auto merge of #133120 - matthiaskrgr:rollup-4actosy, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #131717 (Stabilize `const_atomic_from_ptr`)
 - #132134 (Remove `ResultsVisitable`)
 - #132449 (mark is_val_statically_known intrinsic as stably const-callable)
 - #132569 (rustdoc search: allow queries to end in an empty path segment)
 - #132787 (Unify FnKind between AST visitors and make WalkItemKind more straight forward)
 - #132832 (Deny capturing late-bound ty/const params in nested opaques)
 - #133097 (Opt out TaKO8Ki from review rotation for now)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-17 09:45:48 +00:00
bors
ee4a56e353 Auto merge of #132566 - saethlin:querify-mir-collection, r=cjgillot
Querify MonoItem collection

Factored out of https://github.com/rust-lang/rust/pull/131650. These changes are required for post-mono MIR opts, because the previous implementation would load the MIR for every Instance that we traverse (as well as invoke queries on it). The cost of that would grow massively with post-mono MIR opts because we'll need to load new MIR for every Instance, instead of re-using the `optimized_mir` for every Instance with the same DefId.

So the approach here is to add two new queries, `items_of_instance` and `size_estimate`, which contain the specific information about an Instance's MIR that MirUsedCollector and CGU partitioning need, respectively. Caching these significantly increases the size of the query cache, but that's justified by our improved incrementality (I'm sure walking all the MIR for a huge crate scales quite poorly).

This also changes `MonoItems` into a type that will retain the traversal order (otherwise we perturb a bunch of diagnostics), and will also eliminate duplicate findings. Eliminating duplicates removes about a quarter of the query cache size growth.

The perf improvements in this PR are inflated because rustc-perf uses `-Zincremental-verify-ich`, which makes loading MIR a lot slower because MIR contains a lot of Spans and computing the stable hash of a Span is slow. And the primary goal of this PR is to load less MIR. Some squinting at `collector profile_local perf-record +stage1` runs suggests the magnitude of the improvements in this PR would be decreased by between a third and a half if that flag weren't being used. Though this effect may apply to the regressions too since most are incr-full and this change also causes such builds to encode more Spans.
2024-11-17 06:39:47 +00:00
Yutaro Ohno
ec65dfc45e alloc: fix String's doc 2024-11-17 15:23:14 +09:00
bors
5afd5ad29c Auto merge of #133094 - weihanglo:update-cargo, r=weihanglo
Update cargo

15 commits in 4a2d8dc636445b276288543882e076f254b3ae95..69e595908e2c420e7f0d1be34e6c5b984c8cfb84
2024-11-09 19:10:33 +0000 to 2024-11-16 01:26:11 +0000
- refactor(fingerprint): Track the intent for each use of `UnitHash` (rust-lang/cargo#14826)
- fix(toml): Update frontmatter parser for RFC 3503 (rust-lang/cargo#14792)
- docs(unstable): Move -Zwarnings from stable to unstable section (rust-lang/cargo#14827)
- Simplify English used in guide (rust-lang/cargo#14825)
- feat(resolver): Stabilize resolver v3 (rust-lang/cargo#14754)
- docs: Clean up doc comments (rust-lang/cargo#14823)
- fix(remove): On error, suggest other dependencies  (rust-lang/cargo#14818)
- Always include Cargo.lock in published crates (rust-lang/cargo#14815)
- fix(build-rs)!: Updates from an audit (rust-lang/cargo#14817)
- feat(rustdoc): diplay env vars in extra verbose mode  (rust-lang/cargo#14812)
- Migrate build-rs to the Cargo repo (rust-lang/cargo#14786)
- chore(ci): Check for clippy `correctness` (rust-lang/cargo#14796)
- git: do not validate submodules of fresh checkouts (rust-lang/cargo#14605)
- refactor: clone-on-write when needed for InternedString (rust-lang/cargo#14808)
- fix(docs): typo in cargo-fmt.md (rust-lang/cargo#14805)
2024-11-17 03:38:37 +00:00
Ralf Jung
543627ddbe clean up const stability around UB checks 2024-11-16 22:50:22 +01:00
Ralf Jung
5eef5ee38a stabilize const_ptr_is_null 2024-11-16 22:50:22 +01:00
bors
f2a35426b6 Auto merge of #133115 - jieyouxu:cdb, r=chrisdenton
Update cdb annotations for some debuginfo tests with cdb `10.0.26100.2161`

GitHub CI runners [recently updated to Windows Server 2022 (20241113)](https://github.com/actions/runner-images/releases/tag/win22%2F20241113.3) which included Windows Software Development Kit version `10.1.26100.1742`, which transitively shipped a `cdb` version `10.0.26100.2161`.

This changed some cdb output, causing 3 debuginfo tests to fail (see #133107, https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/msvc.20update.20causing.20debuginfo.20failures):

```
tests\debuginfo\numeric-types.rs
tests\debuginfo\range-types.rs
tests\debuginfo\unit-type.rs
```

I updated cdb annotations for these 3 tests locally with a matching `cdb` version. However, I am not by any means a cdb expert nor debuginfo expert, I just reblessed the tests to match whatever the new cdb version produces to unblock the tree. It is certainly possible that debuginfo improved/regressed/both with the newer cdb version.

try-job: x86_64-msvc
2024-11-16 20:24:49 +00:00
Jieyou Xu
dccb6c0f27 Mark numeric-types.rs as 64-bit only for now
This is to unblock the tree, a proper fix will need to be investigated.
I think the debuginfo test suite supports revisions, however debugger
directives do not respect such revisions, which is problematic.

It's that 32-bit and 64-bit msvc of course have different integer widths
for `isize` and `usize`, meaning their underlying integer is different
and thus printed differently.
2024-11-17 04:16:59 +08:00
Matthias Krüger
17a9a7e345
Rollup merge of #133097 - jieyouxu:opt-out-review-rotation, r=jieyouxu
Opt out TaKO8Ki from review rotation for now

Hi `@TaKO8Ki,` I'm opting you out from compiler/diagnostics review rotation for now because I *think* you're very busy recently. Please feel free to re-add yourself (or close this PR) whenever you have more time / feel like it.
2024-11-16 21:05:47 +01:00
Matthias Krüger
a1c98ca160
Rollup merge of #132832 - compiler-errors:late-ty, r=cjgillot
Deny capturing late-bound ty/const params in nested opaques

First, this reverts a7f609504c. I can't exactly remember why I approved this specific bit of https://github.com/rust-lang/rust/pull/132466; specifically, I don't know that the purpose of that commit is, and afaict we will never have an opaque that captures late-bound params through a const because opaques can't be used inside of anon consts. Am I missing something `@cjgillot?` Since I can't see a case where this matters, and no tests seem to fail.

The second commit adds a `deny_late_regions: bool` to distinguish `Scope::LateBoundary` which should deny *any* late-bound params or just ty/consts. Then, when resolving opaques we wrap ourselves in a `Scope::LateBoundary { deny_late_regions: false }` so that we deny late-bound ty/const, which fixes a bunch of ICEs that all vaguely look like `impl for<T> Trait<Assoc = impl OtherTrait<T>>`.

I guess this could be achieved other ways; for example, with a different scope kind, or maybe we could just reuse `Scope::Opaque`. But this seems a bit more verbose. I'm open to feedback anyways.

Fixes #131535
Fixes #131637
Fixes #132530

I opted to remove those crashes tests ^ without adding them as regular tests, since they're basically triggering uninteresting late-bound ICEs far off in the trait solver, and the reason that existing tests such as `tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs` don't ICE are kinda just coincidental (i.e. due to a missing impl block). I don't really feel motivated to add random permutations to tests just to exercise non-lifetime binders.

r? cjgillot
2024-11-16 21:05:46 +01:00
Matthias Krüger
6b47c6d786
Rollup merge of #132787 - maxcabrajac:fnctxt, r=petrochenkov
Unify FnKind between AST visitors and make WalkItemKind more straight forward

Unifying `FnKind` requires a bunch of changes to `WalkItemKind::walk` signature so I'll change them in one go

related to #128974

r? `@petrochenkov`
2024-11-16 21:05:46 +01:00
Matthias Krüger
eff2b7017d
Rollup merge of #132569 - lolbinarycat:rustdoc-search-path-end-empty-v2, r=notriddle
rustdoc search: allow queries to end in an empty path segment

fixes https://github.com/rust-lang/rust/issues/129707

this can be used to show all items in a module,
or all associated items for a type.
currently sufferes slightly due to case insensitivity, so `Option::` will also show items in the `option::` module.

it disables the checking of the last path element, otherwise only items with short names will be shown

r? `@notriddle`
2024-11-16 21:05:45 +01:00
Matthias Krüger
fb5bd7ffcc
Rollup merge of #132449 - RalfJung:is_val_statically_known, r=compiler-errors
mark is_val_statically_known intrinsic as stably const-callable

The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal).

Cc `@rust-lang/lang` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary.
Cc `@rust-lang/wg-const-eval`
2024-11-16 21:05:44 +01:00
Matthias Krüger
5c81dbf4fa
Rollup merge of #132134 - nnethercote:rm-ResultsVisitable, r=cjgillot
Remove `ResultsVisitable`

`ResultsVisitable` has annoyed me for a while. This PR removes it. Details in the individual commits.

r? `@cjgillot.`
2024-11-16 21:05:44 +01:00
Matthias Krüger
07b033649e
Rollup merge of #131717 - tgross35:stabilize-const_atomic_from_ptr, r=RalfJung
Stabilize `const_atomic_from_ptr`

The API is already stable since https://github.com/rust-lang/rust/pull/115719, but const stability was blocked on `const_mut_refs`. Since that was recently stabilized, const stabilize the following:

```rust
// core::atomic

impl AtomicBool { pub const unsafe fn from_ptr<'a>(ptr: *mut bool) -> &'a AtomicBool; }

impl<T> AtomicPtr<T> { pub const unsafe fn from_ptr<'a>(ptr: *mut *mut T) -> &'a AtomicPtr<T>; }

impl AtomicU8    { pub const unsafe fn from_ptr<'a>(ptr: *mut u8)    -> &'a AtomicU8;    }
impl AtomicU16   { pub const unsafe fn from_ptr<'a>(ptr: *mut u16)   -> &'a AtomicU16;   }
impl AtomicU32   { pub const unsafe fn from_ptr<'a>(ptr: *mut u32)   -> &'a AtomicU32;   }
impl AtomicU64   { pub const unsafe fn from_ptr<'a>(ptr: *mut u64)   -> &'a AtomicU64;   }
impl AtomicUsize { pub const unsafe fn from_ptr<'a>(ptr: *mut usize) -> &'a AtomicUsize; }

impl AtomicI8    { pub const unsafe fn from_ptr<'a>(ptr: *mut i8)    -> &'a AtomicI8;    }
impl AtomicI16   { pub const unsafe fn from_ptr<'a>(ptr: *mut i16)   -> &'a AtomicI16;   }
impl AtomicI32   { pub const unsafe fn from_ptr<'a>(ptr: *mut i32)   -> &'a AtomicI32;   }
impl AtomicI64   { pub const unsafe fn from_ptr<'a>(ptr: *mut i64)   -> &'a AtomicI64;   }
impl AtomicIsize { pub const unsafe fn from_ptr<'a>(ptr: *mut isize) -> &'a AtomicIsize; }
```
2024-11-16 21:05:43 +01:00
Esteban Küber
6913194b8e review comment: move logic to new method 2024-11-16 20:03:31 +00:00
Esteban Küber
c09c73b996 Reword suggestion message 2024-11-16 20:03:31 +00:00
Esteban Küber
629a69f3e2 Better account for else if macro conditions mising an if
If a macro statement has been parsed after `else`, suggest a missing `if`:

```
error: expected `{`, found `falsy`
  --> $DIR/else-no-if.rs:47:12
   |
LL |     } else falsy! {} {
   |       ---- ^^^^^
   |       |
   |       expected an `if` or a block after this `else`
   |
help: add an `if` if this is the condition of a chained `else if` statement
   |
LL |     } else if falsy! {} {
   |            ++
```
2024-11-16 20:03:31 +00:00
Esteban Küber
04fe839177 Increase accuracy of if condition misparse suggestion
Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body".

```
error: expected `{`, found `map`
  --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30
   |
LL |     for _ in [1, 2, 3].iter()map(|x| x) {}
   |                              ^^^ expected `{`
   |
help: you might have meant to write a method call
   |
LL |     for _ in [1, 2, 3].iter().map(|x| x) {}
   |                              +
```
2024-11-16 20:03:31 +00:00
Jieyou Xu
e70df0909a Update cdb annotations for unit-type.rs with cdb 10.0.26100.2161 2024-11-17 00:50:54 +08:00
Jieyou Xu
94f3dcf601 Update cdb annotations for range-types.rs with cdb 10.0.26100.2161 2024-11-17 00:42:30 +08:00
Jieyou Xu
1503279593 Update cdb annotations for numeric-types with cdb 10.0.26100.2161 2024-11-17 00:33:40 +08:00
Jieyou Xu
dd688cb6c7 Opt out TaKO8Ki from review rotation for now 2024-11-16 16:51:39 +08:00