| Age | Commit message (Collapse) | Author | Lines |
|
Tweak "non-primitive cast" error
- Suggest borrowing expression if it would allow cast to work.
- Suggest using `<Type>::from(<expr>)` when appropriate.
- Minor tweak to `;` typo suggestion.
Partily address #47136.
|
|
Add tests for 'impl Default for [T; N]'
Related: #71690.
This pull request adds two tests:
- Even it T::default() panics, no leaks occur.
- [T; 0] is Default even if T is not.
I believe at some moment `Default` impl for arrays will be rewritten to use const generics instead of macros, and these tests will help to prevent behavior changes.
|
|
add raw_ref macros
In https://github.com/rust-lang/rust/issues/64490, various people were in favor of exposing `&raw` as a macro first before making the actual syntax stable. So this PR (unstably) introduces those macros.
I'll create the tracking issue if we're okay moving forward with this.
|
|
|
|
|
|
|
|
|
|
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
|
|
Co-authored-by: David Tolnay <dtolnay@gmail.com>
|
|
|
|
|
|
|
|
Fix typo in docs of std::mem
|
|
Use track caller for bug! macro
|
|
|
|
|
|
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
|
|
As suggested in PR feedback:
https://github.com/rust-lang/rust/pull/73011#discussion_r435728923
This allows count_code_region() to be handled like a normal intrinsic so
the InstanceDef::InjectedCode variant is no longer needed.
|
|
|
|
|
|
This initial version only injects counters at the top of each function.
Rust Coverage will require injecting additional counters at each
conditional code branch.
|
|
|
|
- Suggest borrowing expression if it would allow cast to work.
- Suggest using `<Type>::from(<expr>)` when appropriate.
- Minor tweak to `;` typo suggestion.
Partily address #47136.
|
|
|
|
Rollup of 10 pull requests
Successful merges:
- #72707 (Use min_specialization in the remaining rustc crates)
- #72740 (On recursive ADT, provide indirection structured suggestion)
- #72879 (Miri: avoid tracking current location three times)
- #72938 (Stabilize Option::zip)
- #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM)
- #73104 (Example about explicit mutex dropping)
- #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString)
- #73296 (Remove vestigial CI job msvc-aux.)
- #73304 (Revert heterogeneous SocketAddr PartialEq impls)
- #73331 (extend network support for HermitCore)
Failed merges:
r? @ghost
|
|
Stabilize Option::zip
This PR stabilizes the following API:
```rust
impl<T> Option<T> {
pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>;
}
```
This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E®exp=true&filter[lang][0]=Rust>.
The `zip_with` method is left unstably as this API is kinda niche
and it hasn't received much usage in Rust repositories on GitHub.
cc #70086
|
|
Fix iterator copied() documentation example code
The documentation for copied() gives example code with variable v_cloned instead of v_copied. This seems like a copy/paste error from cloned() and it would be clearer to use v_copied.
|
|
Group `Pattern::strip_*` method together
|
|
Display information about captured variable in `FnMut` error
Fixes #69446
When we encounter a region error involving an `FnMut` closure, we
display a specialized error message. However, we currently do not
tell the user which upvar was captured. This makes it difficult to
determine the cause of the error, especially when the closure is large.
This commit records marks constraints involving closure upvars
with `ConstraintCategory::ClosureUpvar`. When we decide to 'blame'
a `ConstraintCategory::Return`, we additionall store
the captured upvar if we found a `ConstraintCategory::ClosureUpvar` in
the path.
When generating an error message, we point to relevant spans if we have
closure upvar information available. We further customize the message if
an `async` closure is being returned, to make it clear that the captured
variable is being returned indirectly.
|
|
|
|
|
|
|
|
These are simply indexing safety.
|
|
We already implicitly (or explicitly??) do the bound checking for the indexing.
|
|
This is just the reverse of shift_head.
|
|
|
|
r=Mark-Simulacrum
Adjusted some doctests in libcore to use `should_panic`.
Fixes #73196 .
I grepped libstd and libcore for all the instances of this pattern that I could find, but its possible that I missed some of course. If anyone knows of any more, please let me know and I will add them to the PR.
|
|
Clarify the behaviour of Pattern when used with methods like str::contains
Fixes #45507.
I used the previous work by @Emerentius (thanks !), added a paragraph and checked the links (they work for me but I'm not against someone else checking them too).
|
|
Previously, some doctests were spawning new threads and joining them to
indicate that a particular call should panic; this hurt readability, so
the tests have been adjusted to simply call the method and use the
`should_panic` marker.
|
|
|
|
|
|
|
|
Migrate to numeric associated consts
The deprecation PR is #72885
cc #68490
cc rust-lang/rfcs#2700
|
|
Enable AVR as a Tier 3 target upstream
Tracking issue: #44052.
Things intentionally left out of the initial upstream:
* The `target_cpu` flag
I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915.
Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
|
|
std: Enable atomic.fence emission on wasm32
This commit removes the `#[cfg]` guards in `atomic::fence` on wasm
targets. Since these guards were originally added the upstream wasm
specification for threads gained an `atomic.fence` instruction, so LLVM
no longer panics on these intrinsics.
Although there aren't a ton of tests in-repo for this right now I've
tested locally and all of these fences generate `atomic.fence`
instructions in wasm.
Closes #65687
Closes #72997
|
|
Co-authored-by: lzutao <taolzu@gmail.com>
|
|
`saturating_add` example was not parameterized, but passed because the `u8` would saturate successfully
|
|
|
|
|
|
Fix a typo (size of the size)
|