| Age | Commit message (Collapse) | Author | Lines |
|
Rollup of 8 pull requests
Successful merges:
- #97183 (wf-check generators)
- #98320 (Mention first and last macro in backtrace)
- #99335 (Use split_once in FromStr docs)
- #99347 (Use `LocalDefId` in `OpaqueTypeKey`)
- #99392 (Fix debuginfo tests.)
- #99404 (Use span_bug for unexpected field projection type)
- #99410 (Update invalid atomic ordering lint)
- #99434 (Fix `Skip::next` for non-fused inner iterators)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Update invalid atomic ordering lint
The restriction that success ordering must be at least as strong as its
failure ordering in compare-exchange operations was lifted in #98383.
|
|
Mention first and last macro in backtrace
Slight improvement to diagnostic mentioning what macro an error originates from. Not sure if it's worthwhile.
|
|
wf-check generators
fixes #90409
We should not rely on generators being well formed by construction now that they can get used via type alias impl trait (and thus users can choose generic arguments that are invalid). This can cause surprising behaviour if (definitely unsound) transmutes are used, and it's generally saner to just check for well formedness.
|
|
proc_macro/bridge: stop using a remote object handle for proc_macro Ident and Literal
This is the fourth 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 `Ident` and `Group` types into structs serialized over IPC rather than handles.
Symbol values are interned on both the client and server when deserializing, to avoid unnecessary string copies and keep the size of `TokenTree` down. To do the interning efficiently on the client, the proc-macro crate is given a vendored version of the fxhash hasher, as `SipHash` appeared to cause performance issues. This was done rather than depending on `rustc_hash` as it is unfortunately difficult to depend on crates from within `proc_macro` due to it being built at the same time as `std`.
In addition, a custom arena allocator and symbol store was also added, inspired by those in `rustc_arena` and `rustc_span`. To prevent symbol re-use across multiple invocations of a macro on the same thread, a new range of `Symbol` names are used for each invocation of the macro, and symbols from previous invocations are cleaned-up.
In order to keep `Ident` creation efficient, a special ASCII-only case was added to perform ident validation without using RPC for simple identifiers. Full identifier validation couldn't be easily added, as it would require depending on the `rustc_lexer` and `unicode-normalization` crates from within `proc_macro`. Unicode identifiers are validated and normalized using RPC.
See the individual commit messages for more details on trade-offs and design decisions behind these patches.
|
|
|
|
Currently `#![forbid(unused_qualifications)]` is incompatible with all
derive's because we add `#[allow(unused_qualifications)]` in all
generated impl's.
|
|
Closes #99255
|
|
|
|
|
|
|
|
This reverts commit 9edaa76adce4de737db54194eb13d6c298827b37.
|
|
|
|
Doing this for all unicode identifiers would require a dependency on
`unicode-normalization` and `rustc_lexer`, which is currently not
possible for `proc_macro` due to it being built concurrently with `std`
and `core`. Instead, ASCII identifiers are validated locally, and an RPC
message is used to validate unicode identifiers when needed.
String values are interned on the both the server and client when
deserializing, to avoid unnecessary copies and keep Ident cheap to copy and
move. This appears to be important for performance.
The client-side interner is based roughly on the one from rustc_span, and uses
an arena inspired by rustc_arena.
RPC messages passing symbols always include the full value. This could
potentially be optimized in the future if it is revealed to be a
performance bottleneck.
Despite now having a relevant implementaion of Display for Ident, ToString is
still specialized, as it is a hot-path for this object.
The symbol infrastructure will also be used for literals in the next
part.
|
|
Add regression test for #95230
Closes #95230
r? ```@compiler-errors```
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
Use `typeck_results` to get accurate qpath res for arg mismatch error
Improves error message from "function" to actually what we're calling (e.g. enum variant constrcutor) in a few cases :smile_cat:
|
|
closes #99408
|
|
The restriction that success ordering must be at least as strong as its
failure ordering in compare-exchange operations was lifted in #98383.
|
|
|
|
Don't pass InferCtxt to WfPredicates
Simple cleanup. Infer vars will get passed up as obligations and shallowed resolved later. This actually improves one test output.
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
Do not ICE when we have `-Zunpretty=expanded` with invalid ABI
Fixes #99331
|
|
Do not constraint TAITs when checking impl/trait item compatibility
Check out the UI test for the example.
Open to other approaches to fix this issue -- ideally we _would_ be able to collect this opaque type constraint in a way to use it in `find_opaque_ty_constraints`, so we can report a better mismatch error in the incompatible case, and just allow it in the compatible case. But that seems like a bigger refactor, so I wouldn't want to start it unless someone else thought it was a good idea.
cc #99348
r? ``@oli-obk``
|
|
Be more precise when suggesting removal of parens on unit ctor
* Fixes #99240 by only suggesting to remove parens on path exprs, not arbitrary expressions with enum type
* Generalizes by suggesting removal of parens on unit struct, too, because why not?
|
|
The attribute is also renamed `fake_variadic`.
|
|
Use constant eval to do strict mem::uninit/zeroed validity checks
I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case.
Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies.
I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally.
Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay?
Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested.
Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)
|
|
|
|
rendering path
|
|
Add regression test for #95829
Closes #95829
r? `@compiler-errors`
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
Add `#[test]` to functions in test modules
I implemented a suggestion in #91770, but the ui test I created was inadequate and I have fixed that.
|
|
|
|
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
|
|
|
|
|
|
|
|
Revert "Highlight conflicting param-env candidates"
This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514.
Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.
|
|
Provide structured suggestion for dropped temp value
|
|
migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements
- Implements `IntoDiagnosticArg` for `char` using its `Debug` implementation and introduces a macro for those types which just delegate the implementation to `ToString`.
- Apply the `#[rustc_lint_diagnostics]` attribute to `LintDiagnosticBuilder::build` so that diagnostic migration lints will trigger for it - some diagnostics in `rustc_privacy` need updated after this since the lints apply to that crate.
- Add support for `MultiSpan` with any of the attributes that work on a `Span` in the diagnostic derive (`SessionDiagnostic` + `LintDiagnostic`). Requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in.
- Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the `warn` attribute already existing, so this name being unavailable for the derives to use. `#[warn_]` is used instead, which requires special-casing so that `{span_,}warn` is called instead of `{span_,}warn_`.
- Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable. I got tired after a while. I modified some diagnostic output for consistency while doing this, nothing too crazy.
r? `@compiler-errors`
|
|
Allow destructuring opaque types in their defining scopes
fixes #96572
Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck.
```rust
type T = impl Copy;
let foo: T = (1u32, 2u32);
let (a, b) = foo;
```
The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.
|
|
Rollup of 7 pull requests
Successful merges:
- #98387 (Add new unstable API `downcast` to `std::io::Error`)
- #98662 (Add std::fs::write documentation precision)
- #99253 (Remove FIXME from MIR `always_storage_live_locals`)
- #99264 (Fix typo in mod.rs)
- #99270 (Add `#[must_use]` to `Box::from_raw`)
- #99277 (Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends)
- #99307 (Add regression test for #64401)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Fix ICE in `named_arguments_used_positionally` lint
Fixes #99261
Fixes #99289
Fixes #99284
Fixes #99273
Fixes #99297
Fixes #99271
This match pattern:
```
FormatSpec { width: Count::CountIsName(s, _), .. }
| FormatSpec { precision: Count::CountIsName(s, _), .. }
```
does not account for when both `width` and `precision` are both `Count::CountIsName`, so split the check for these two fields into two separate `if let`.
Also, remove any future potential for ICEs by removing the index operator altogether.
---
It is still suspicious that this indexing was broken and caused the ICE, as opposed to just causing a spurious lint message.
cc `@PrestonFrom,` who may be familiar with this code because of implementing the lint this touches, perhaps you'd like to look into why named arguments in `FormatSpec.precision` seem to have indices that don't correspond to a span in `Context.arg_spans`?
Edit: Opened #99265 to track a (related?) incorrect argument indexing issue.
|
|
Add regression test for #64401
Closes #64401
r? `@compiler-errors`
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
Add `#[must_use]` to `Box::from_raw`
Fixes #99269
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
|
|
trait obligations for binops.
|
|
PR #5956 started checking the stability of path segments.
However, this was not applied to 'use tree' items
(e.g. 'use some::path::{ItemOne, ItemTwo}') due to the way
that we desugar these items in HIR lowering.
This PR modifies 'use tree' lowering to preserve resolution
information, which is needed by stability checking.
|