| Age | Commit message (Collapse) | Author | Lines |
|
Simplify memory ordering intrinsics
This changes the names of the atomic intrinsics to always fully include their memory ordering arguments.
```diff
- atomic_cxchg
+ atomic_cxchg_seqcst_seqcst
- atomic_cxchg_acqrel
+ atomic_cxchg_acqrel_release
- atomic_cxchg_acqrel_failrelaxed
+ atomic_cxchg_acqrel_relaxed
// And so on.
```
- `seqcst` is no longer implied
- The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name.
- `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`.
- `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly.
- This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for #68464.
- This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](https://github.com/rust-lang/rust/pull/98383) that requires an FCP.
Suffixes for operations with a single memory order:
| Order | Before | After |
|---------|--------------|------------|
| Relaxed | `_relaxed` | `_relaxed` |
| Acquire | `_acq` | `_acquire` |
| Release | `_rel` | `_release` |
| AcqRel | `_acqrel` | `_acqrel` |
| SeqCst | (none) | `_seqcst` |
Suffixes for compare-and-exchange operations with two memory orderings:
| Success | Failure | Before | After |
|---------|---------|--------------------------|--------------------|
| Relaxed | Relaxed | `_relaxed` | `_relaxed_relaxed` |
| Relaxed | Acquire | :x: | `_relaxed_acquire` |
| Relaxed | SeqCst | :x: | `_relaxed_seqcst` |
| Acquire | Relaxed | `_acq_failrelaxed` | `_acquire_relaxed` |
| Acquire | Acquire | `_acq` | `_acquire_acquire` |
| Acquire | SeqCst | :x: | `_acquire_seqcst` |
| Release | Relaxed | `_rel` | `_release_relaxed` |
| Release | Acquire | :x: | `_release_acquire` |
| Release | SeqCst | :x: | `_release_seqcst` |
| AcqRel | Relaxed | `_acqrel_failrelaxed` | `_acqrel_relaxed` |
| AcqRel | Acquire | `_acqrel` | `_acqrel_acquire` |
| AcqRel | SeqCst | :x: | `_acqrel_seqcst` |
| SeqCst | Relaxed | `_failrelaxed` | `_seqcst_relaxed` |
| SeqCst | Acquire | `_failacq` | `_seqcst_acquire` |
| SeqCst | SeqCst | (none) | `_seqcst_seqcst` |
|
|
|
|
|
|
Improve some deriving code and add a test
The `.stdout` test is particularly useful.
r? `@petrochenkov`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rollup of 11 pull requests
Successful merges:
- #98548 (rustdoc-json: Allow Typedef to be different in sanity assert)
- #98560 (Add regression test for #85907)
- #98564 (Remove references to `./tmp` in-tree)
- #98602 (Add regression test for #80074)
- #98606 (:arrow_up: rust-analyzer)
- #98609 (Fix ICE for associated constant generics)
- #98611 (Fix glob import ICE in rustdoc JSON format)
- #98617 (Remove feature `const_option` from std)
- #98619 (Fix mir-opt wg name)
- #98621 (llvm-wrapper: adapt for removal of the ASanGlobalsMetadataAnalysis LLVM API)
- #98623 (fix typo in comment)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
r=lcnr
Fix ICE for associated constant generics
Fixes #98432
|
|
r=Mark-Simulacrum
Add regression test for #80074
closes #80074
|
|
r=Mark-Simulacrum
Add regression test for #85907
closes #85907
|
|
|
|
proc_macro/bridge: stop using a remote object handle for proc_macro Punct and Group
This is the third part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch transforms the `Punct` and `Group` types into structs serialized over IPC rather than handles, making them more efficient to create and manipulate from within proc-macros.
|
|
Rollup of 9 pull requests
Successful merges:
- #97346 (Remove a back-compat hack on lazy TAIT)
- #98261 (Remove `MAX_SUGGESTION_HIGHLIGHT_LINES`)
- #98337 ([RFC 2011] Optimize non-consuming operators)
- #98384 (Fix RSS reporting on macOS)
- #98420 (translation: lint fix + more migration)
- #98430 (Refactor iter adapters with less macros)
- #98555 (Hermit: Fix initializing lazy locks)
- #98595 (Implement `Send` and `Sync` for `ThinBox<T>`)
- #98597 (Remove unstable CStr/CString change from 1.62 release note)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
[RFC 2011] Optimize non-consuming operators
Tracking issue: https://github.com/rust-lang/rust/issues/44838
Fifth step of https://github.com/rust-lang/rust/pull/96496
The most non-invasive approach that will probably have very little to no performance impact.
## Current behaviour
Captures are handled "on-the-fly", i.e., they are performed in the same place expressions are located.
```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`
if !(
{ ***try capture `a` and then return `a`*** } > 1 && { ***try capture `b` and then return `b`*** } < 100
) {
panic!( ... );
}
```
As such, some overhead is likely to occur (Specially with very large chains of conditions).
## New behaviour for non-consuming operators
When an operator is known to not take `self`, then it is possible to capture variables **AFTER** the condition.
```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`
if !( a > 1 && b < 100 ) {
{ ***try capture `a`*** }
{ ***try capture `b`*** }
panic!( ... );
}
```
So the possible impact on the runtime execution time will be diminished.
r? ````@oli-obk````
|
|
Remove a back-compat hack on lazy TAIT
This PR's motivation is here: https://github.com/rust-lang/rust/issues/72614#issuecomment-1134595446
~~But removing a hack doesn't seem to reject the code on the issue, there're some more hacks?~~
r? ``@oli-obk``
|
|
Do not access HIR to check impl wf.
r? `@ghost`
|
|
|
|
|
|
|
|
|
|
|
|
Only keep a single query for well-formed checking
There are currently 3 queries to perform wf checks on different item-likes. This complexity is not required.
This PR replaces the query by:
- one query per item;
- one query to invoke it for a whole module.
This allows to remove HIR `ParItemLikeVisitor`.
|
|
|
|
Fix span issues in object safety suggestions
Fixes #98500
|
|
|
|
compiletest: add issue number param to `known-bug`
I was getting some errors while testing this, but I'm pretty sure that was unrelated to my changes.
Closes #98436
> Basically, instead of `// known-bug`, do `// known-bug #00000` or maybe `// known-bug chalk#00`?
>
> From: https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.2398095.3A.20NLL.3A.20unsound.20verification.20of.20higher.20ranked.20outlives.E2.80.A6/near/287258738
I also added an `unknown` escape-hatch because I didn't find corresponding issues for every `// known-bug`.
The syntax also ended up being `// known-bug: `, because of `set_name_value_directive`.
|
|
Check ADT field is well-formed before checking it is sized
Fixes #96810.
There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related.
We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
|
|
Improve memory ordering diagnostics
Before:

After:

---
Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct.
Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.
|
|
Perform coherence checking per impl.
r? `@ghost`
|
|
This greatly reduces round-trips to fetch relevant extra information about the
token in proc macro code, and avoids RPC messages to create Punct tokens.
|
|
|
|
Currently the generated code for methods like `eq`, `ne`, and `partial_cmp`
includes stuff like this:
```
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if true && __self_vi == __arg_1_vi {
...
}
```
This commit removes the unnecessary `true &&`, and makes the generating
code a little easier to read in the process. It also fixes some errors
in comments.
|
|
|
|
|
|
r=Mark-Simulacrum
Add regression test for #87558
Fixes #87558
|
|
Add a ui test for issue #91883
closes #91883
|
|
make const_err show up in future breakage reports
As tracked in https://github.com/rust-lang/rust/issues/71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since https://github.com/rust-lang/rust/pull/80394 (landed more than a year ago). Some CTFE errors are already hard errors since https://github.com/rust-lang/rust/pull/86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports.
Cc `````@rust-lang/wg-const-eval`````
|
|
[rustc_parse] Forbid `let`s in certain places
Currently only forbids in locals to resolve https://github.com/rust-lang/rust/pull/94927#issuecomment-1099605024 but feel free to point any other places.
|
|
|
|
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
diagnostics: consider parameter count when suggesting smart pointers
Fixes #96834
|
|
Fix backtrace UI test when panic=abort is used
The function `contains_verbose_expected` is only used when the panic strategy is not abort, so it caused a warning when it was abort, which made the UI test failed on stderr comparison.
|
|
Fix printing `impl trait` under binders
Before, we would render `impl for<'a> Trait<'a>` like `impl Trait<for<'a> 'a>`, lol.
|