Vec: avoid creating slices to the elements
Instead of `self.deref_mut().as_mut_ptr()` to get a raw pointer to the buffer, use `self.buf.ptr_mut()`. This (a) avoids creating a unique reference to all existing elements without any need, and (b) creates a pointer that can actually be used for the *entire* buffer, and not just for the part of it covered by `self.deref_mut()`.
I also got worried about `RawVec::ptr` returning a `*mut T` from an `&self`, so I added both a mutable and an immutable version.
Cc @Gankro in particular for the `assume` changes -- I don't know why that is not in `Unique`, but I moved it up from `Vec::deref` to `RawVec::ptr` to avoid having to repeat it everywhere.
Fixes https://github.com/rust-lang/rust/issues/60847
Tweak `self` arg not as first argument of a method diagnostic
Mention that `self` is only valid on "associated functions"
```
error: unexpected `self` argument in function
--> $DIR/self-in-function-arg.rs:1:15
|
LL | fn foo(x:i32, self: i32) -> i32 { self }
| ^^^^ not valid as function argument
|
= note: `self` is only valid as the first argument of an associated function
```
When it is a method, mention it must be first
```
error: unexpected `self` argument in function
--> $DIR/trait-fn.rs:4:20
|
LL | fn c(foo: u32, self) {}
| ^^^^ must be the first associated function argument
```
Move a bunch of error recovery methods to `diagnostics.rs` away from `parser.rs`.
Fix#51547. CC #60015.
Mention that `self` is only valid on "associated functions"
```
error: unexpected `self` argument in function
--> $DIR/self-in-function-arg.rs:1:15
|
LL | fn foo(x:i32, self: i32) -> i32 { self }
| ^^^^ not valid as function argument
|
= note: `self` is only valid as the first argument of an associated function
```
When it is a method, mention it must be first
```
error: unexpected `self` argument in function
--> $DIR/trait-fn.rs:4:20
|
LL | fn c(foo: u32, self) {}
| ^^^^ must be the first associated function argument
```
Rollup of 13 pull requests
Successful merges:
- #61026 (Tweak macro parse errors when reaching EOF during macro call parse)
- #61095 (Update cargo)
- #61096 (tidy: don't short-circuit on license error)
- #61107 (Fix a couple docs typos)
- #61110 (Revert edition-guide toolstate override)
- #61111 (Fixed type-alias-bounds lint doc)
- #61113 (Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since 1.35)
- #61116 (Remove the incorrect warning from README.md)
- #61118 (Dont ICE on an attempt to use GAT without feature gate)
- #61121 (improve debug-printing of scalars)
- #61125 (Updated my mailmap entry)
- #61134 (Annotate each `reverse_bits` with `#[must_use]`)
- #61138 (Move async/await tests to their own folder)
Failed merges:
r? @ghost
Move async/await tests to their own folder
This moves run-pass and ui async/await tests to their own folder `src/test/ui/async-await` and organises some into subfolders. (It does not move rustdoc tests for async/await.)
I also did some drive-by cleaning up of issues/error code tests into their own folders (which already existed). These are in separate commits, so easy to separate out if that's more desirable.
r? @cramertj