about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-11-29Always emit help when failing to parse enum variantEsteban Küber-2/+11
2023-11-29review comment: rework `parse_for_head` to reduce branchingEsteban Küber-36/+42
2023-11-29Fix tidyEsteban Küber-2/+15
2023-11-29Fix test and move to more appropriate directoryEsteban Küber-37/+63
2023-11-29Change how `for (x in foo) {}` is handledEsteban Küber-81/+138
Use the same approach used for match arm patterns.
2023-11-29Account for `(pat if expr) => {}`Esteban Küber-47/+132
When encountering match arm (pat if expr) => {}, recover and suggest removing parentheses. Fix #100825.
2023-11-29Change enum parse recoveryEsteban Küber-21/+44
2023-11-29Bubble parse error when expecting `)`Esteban Küber-51/+25
2023-11-29More accurate span for unnecessary parens suggestionEsteban Küber-30/+12
2023-11-29When parsing patterns, bubble all errors except reserved idents that aren't ↵Esteban Küber-7/+221
likely to appear in for head or match arm
2023-11-29Make `parse_pat_ident` not recover bad nameEsteban Küber-274/+15
2023-11-29Auto merge of #118315 - WaffleLapkin:don't-repeat_byte, r=m-ou-sebors-16/+2
Use `usize::repeat_u8` instead of implementing `repeat_byte` in `memchr.rs` It's simpler that way and the tricks don't actually make a difference: https://godbolt.org/z/zrvYY1dGx
2023-11-29Auto merge of #118443 - matthiaskrgr:rollup-mp8o3m4, r=matthiaskrgrbors-187/+909
Rollup of 7 pull requests Successful merges: - #118157 (Add `never_patterns` feature gate) - #118191 (Suggest `let` or `==` on typo'd let-chain) - #118231 (also add is_empty to const raw slices) - #118333 (Print list of missing target features when calling a function with target features outside an unsafe block) - #118426 (ConstProp: Correctly remove const if unknown value assigned to it.) - #118428 (rustdoc: Move `AssocItemRender` and `RenderMode` to `html::render`.) - #118438 (Update nto-qnx.md) Failed merges: - #118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-29Rollup merge of #118438 - AkhilTThomas:patch-1, r=JohnTitorMatthias Krüger-4/+2
Update nto-qnx.md x.py does not support specifying multiple `--target` keywords. The targets must be specified comma separated. Error: `error: the argument '--target <TARGET>' cannot be used multiple times`
2023-11-29Rollup merge of #118428 - aDotInTheVoid:doc-cleanup, r=GuillaumeGomezMatthias Krüger-20/+21
rustdoc: Move `AssocItemRender` and `RenderMode` to `html::render`. They're only used for HTML, so it makes more sense for them to live their.
2023-11-29Rollup merge of #118426 - aDotInTheVoid:const-wat, r=compiler-errors,cjgillotMatthias Krüger-1/+73
ConstProp: Correctly remove const if unknown value assigned to it. Closes #118328 The problematic sequence of MIR is: ```rust _1 = const 0_usize; _1 = const _; // This is an associated constant we can't know before monomorphization. _0 = _1; ``` 1. When `ConstProp::visit_assign` happens on `_1 = const 0_usize;`, it records that `0x0usize` is the value for `_1`. 2. Next `visit_assign` happens on `_1 = const _;`. Because the rvalue `.has_param()`, it can't be const evaled. 3. Finaly, `visit_assign` happens on `_0 = _1;`. Here it would think the value of `_1` was `0x0usize` from step 1. The solution is to remove consts when checking the RValue fails, as they may have contained values that should now be invalidated, as that local was overwritten. This should probably be back-ported to beta. Stable is more iffy, as it's gone unidentified since 1.70, so I only think it's worthwhile if there's another reason for a 1.74.1 release anyway.
2023-11-29Rollup merge of #118333 - eduardosm:print-missing-target-features, r=est31Matthias Krüger-123/+374
Print list of missing target features when calling a function with target features outside an unsafe block Fixes https://github.com/rust-lang/rust/issues/108680 Supersedes https://github.com/rust-lang/rust/pull/109710. I used the same wording for the messages, but the implementation is different. r? `@est31`
2023-11-29Rollup merge of #118231 - RalfJung:const-raw-slice-empty, r=cuviperMatthias Krüger-3/+21
also add is_empty to const raw slices We have this on mutable raw slices but not const raw slices, which makes little sense. Cc https://github.com/rust-lang/rust/issues/71146
2023-11-29Rollup merge of #118191 - estebank:let-chain-typo, r=compiler-errorsMatthias Krüger-18/+93
Suggest `let` or `==` on typo'd let-chain When encountering a bare assignment in a let-chain, suggest turning the assignment into a `let` expression or an equality check. ``` error: expected expression, found `let` statement --> $DIR/bad-if-let-suggestion.rs:5:8 | LL | if let x = 1 && i = 2 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions help: you might have meant to continue the let-chain | LL | if let x = 1 && let i = 2 {} | +++ help: you might have meant to compare for equality | LL | if let x = 1 && i == 2 {} | + ```
2023-11-29Rollup merge of #118157 - Nadrieril:never_pat-feature-gate, r=compiler-errorsMatthias Krüger-18/+325
Add `never_patterns` feature gate This PR adds the feature gate and most basic parsing for the experimental `never_patterns` feature. See the tracking issue (https://github.com/rust-lang/rust/issues/118155) for details on the experiment. `@scottmcm` has agreed to be my lang-team liaison for this experiment.
2023-11-29Update nto-qnx.mdAkhilTThomas-4/+2
x.py does not support specify multiple --target keywords. The targets must be specified comma separated.
2023-11-29Auto merge of #118433 - matthiaskrgr:rollup-fi9lrwg, r=matthiaskrgrbors-325/+220
Rollup of 7 pull requests Successful merges: - #116839 (Implement thread parking for xous) - #118265 (remove the memcpy-on-equal-ptrs assumption) - #118269 (Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs`) - #118394 (Remove HIR opkinds) - #118398 (Add proper cfgs in std) - #118419 (Eagerly return `ExprKind::Err` on `yield`/`await` in wrong coroutine context) - #118422 (Fix coroutine validation for mixed panic strategy) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-29Auto merge of #118434 - matthiaskrgr:rollup-k1upt8b, r=matthiaskrgrbors-132/+489
Rollup of 7 pull requests Successful merges: - #118342 (Dont suggest `!` for path in function call if it has generic args) - #118383 (Address unused tuple struct fields in the standard library) - #118401 (`rustc_ast_lowering` cleanups) - #118409 (format_foreign.rs: unwrap return Option value for `fn position`, as it always returns Some) - #118413 (Fix the issue of suggesting unwrap/expect for shorthand field) - #118425 (Update cargo) - #118429 (Fix a typo in a `format_args!` note) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-29Rollup merge of #118429 - cuviper:its-arguments, r=compiler-errorsMatthias Krüger-3/+3
Fix a typo in a `format_args!` note
2023-11-29Rollup merge of #118425 - weihanglo:update-cargo, r=weihangloMatthias Krüger-0/+0
Update cargo 7 commits in 9b13310ca596020a737aaa47daa4ed9ff8898a2f..26333c732095d207aa05932ce863d850fb309386 2023-11-24 16:20:51 +0000 to 2023-11-28 20:07:39 +0000 - docs: link to the packages lint table from the related workspace table (rust-lang/cargo#13057) - Add more doc comments for gc changes. (rust-lang/cargo#13055) - docs: Provide pointers for MSRV (rust-lang/cargo#13056) - Fixed typo in SemVer Compatibility documentation page (rust-lang/cargo#13054) - refactor: use custom error instead of anyhow (rust-lang/cargo#13050) - review and remove ignored tests in rustfix (rust-lang/cargo#13047) - docs: add doc comments for rustfix (rust-lang/cargo#13048) r? ghost
2023-11-29Rollup merge of #118413 - chenyukang:yukang-fix-118145-unwrap-for-shorthand, ↵Matthias Krüger-9/+341
r=compiler-errors Fix the issue of suggesting unwrap/expect for shorthand field Fixes #118145
2023-11-29Rollup merge of #118409 - klensy:position-opt, r=compiler-errorsMatthias Krüger-29/+19
format_foreign.rs: unwrap return Option value for `fn position`, as it always returns Some Trivial cleanup. It will be nice to have way to run exhaustiveness analysis on similar cases to see dead code.
2023-11-29Rollup merge of #118401 - nnethercote:rustc_ast_lowering, r=compiler-errorsMatthias Krüger-85/+96
`rustc_ast_lowering` cleanups Just some cleanups I found while looking through this code. r? `@spastorino`
2023-11-29Rollup merge of #118383 - ↵Matthias Krüger-0/+1
shepmaster:unused-tuple-struct-field-cleanup-stdlib, r=m-ou-se Address unused tuple struct fields in the standard library
2023-11-29Rollup merge of #118342 - compiler-errors:macro-generic-bang, r=estebankMatthias Krüger-6/+29
Dont suggest `!` for path in function call if it has generic args Fixes #118335
2023-11-29Rollup merge of #118422 - tmiasko:mix, r=compiler-errorsMatthias Krüger-12/+28
Fix coroutine validation for mixed panic strategy Validation introduced in #113124 allows `UnwindAction::Continue` and `TerminatorKind::Resume` to occur only in functions with ABI that can unwind. The function ABI depends on the panic strategy, which can vary across crates. Usually MIR is built and validated in the same crate. The coroutine drop glue thus far was an exception. As a result validation could fail when mixing different panic strategies. Avoid the problem by executing `AbortUnwindingCalls` along with the validation. Fixes #116953.
2023-11-29Rollup merge of #118419 - compiler-errors:await-span2, r=cjgillotMatthias Krüger-85/+36
Eagerly return `ExprKind::Err` on `yield`/`await` in wrong coroutine context This PR does 2 things: 1. Refuses to lower `.await` or `yield` when we are outside of the right coroutine context for the operator. Instead, we lower to `hir::ExprKind::Err`, to silence subsequent redundant errors. 2. Reworks a bit of the span tracking in `LoweringContext` to fix a bad span when we have something like `let x = [0; async_fn().await]` where the `await` is inside of an anon const. The span for the "item" still kinda sucks, since it overlaps with the `await` span, but at least it's accurate.
2023-11-29Rollup merge of #118398 - mu001999:std/add_cfgs, r=thomccMatthias Krüger-0/+11
Add proper cfgs in std Detected by #118257
2023-11-29Rollup merge of #118394 - nnethercote:rm-hir-Ops, r=cjgillotMatthias Krüger-202/+42
Remove HIR opkinds `hir::BinOp`, `hir::BinOpKind`, and `hir::UnOp` are identical to `ast::BinOp`, `ast::BinOpKind`, and `ast::UnOp`, respectively. This seems silly, so this PR removes the HIR ones. (A re-export lets the AST ones be referred to using a `hir::` qualifier, which avoids renaming churn.) r? `@cjgillot`
2023-11-29Rollup merge of #118269 - compiler-errors:poly, r=wesleywiserMatthias Krüger-22/+6
Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs` I did this recently with `FnSigs` and `PolyFnSigs` but didn't think to do it with `TraitRefs` and `PolyTraitRefs`.
2023-11-29Rollup merge of #118265 - RalfJung:memcpy, r=cuviperMatthias Krüger-3/+2
remove the memcpy-on-equal-ptrs assumption One of the libc we support, musl, [defines `memcpy` with `restrict` pointers](https://git.musl-libc.org/cgit/musl/tree/src/string/memcpy.c#n5). This in fact matches the definition in the C standard. Calling that `memcpy` with overlapping pointers is clearly UB, who knows what the compiler did when optimizing this `memcpy` -- it certainly assumed source and destination to be disjoint. Lucky enough, it does not seem like we actually need this assumption that `memcpy(p, p, n)` is always allowed. clang and GCC need it since they use `memcpy` to compile C assignments, but [we use memmove for similar code](https://godbolt.org/z/bcW85WYcM). There are no known cases where LLVM introduces calls to memcpy on equal pointers itself. (And if there were, that would be a soundness bug in rustc due to the musl issue mentioned above.) This does mean we must make sure to never call the LLVM `memcpy` builtin on equal ranges even though the LangRef says that is allowed. Currently that is the case so we just need to make sure it remains the case. :) Cc `@rust-lang/opsem` `@rust-lang/wg-llvm`
2023-11-29Rollup merge of #116839 - joboet:xous_thread_parking, r=m-ou-seMatthias Krüger-1/+95
Implement thread parking for xous This follows the pattern set by [the Windows parker](https://github.com/rust-lang/rust/blob/ddef56d5dfa18f169af9db912dc8e8343797eebb/library/std/src/sys/windows/thread_parking.rs) when it uses keyed events. An atomic variable is used to track the state and optimize the fast path, while notifications are send via the ticktime server to block and unblock the thread. ping `@xobs` `@rustbot` label +T-libs +A-atomic r? libs
2023-11-29Add `never_patterns` feature gateNadrieril-18/+325
2023-11-29Auto merge of #118348 - Mark-Simulacrum:feature-code-size, r=compiler-errorsbors-6/+14
Cut code size for feature hashing This locally cuts ~32 kB of .text instructions. This isn't really a clear win in terms of readability. IMO the code size benefits are worth it (even if they're not necessarily present in the x86_64 hyperoptimized build, I expect them to translate similarly to other platforms). Ultimately there's lots of "small ish" low hanging fruit like this that I'm seeing that seems worth tackling to me, and could translate into larger wins in aggregate.
2023-11-28Fix a typo in a `format_args!` noteJosh Stone-3/+3
2023-11-29rustdoc: Move `AssocItemRender` and `RenderMode` to `html::render`.Alona Enraght-Moony-20/+21
They're only used for HTML, so it makes more sense for them to live their.
2023-11-29Auto merge of #114841 - bvanjoi:fix-114814, r=cuviperbors-4/+95
add track_caller for arith ops Fixes #114814 `#[track_caller]` is works, r? `@scottmcm`
2023-11-29More fix on mismatched type suggestion for shorthand fieldsyukang-9/+266
2023-11-28Rename and add another testAlona Enraght-Moony-3/+30
2023-11-28Auto merge of #118412 - matthiaskrgr:rollup-ghzhti2, r=matthiaskrgrbors-136/+125
Rollup of 6 pull requests Successful merges: - #118193 (Add missing period in `std::process::Command` docs) - #118222 (unify read_to_end and io::copy impls for reading into a Vec) - #118323 (give dev-friendly error message for incorrect config profiles) - #118378 (Perform LTO optimisations with wasm-ld + -Clinker-plugin-lto) - #118399 (Clean dead codes in miri) - #118410 (update test for new LLVM 18 codegen) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-28ConstProp: Remove const when rvalue check fails.Alona Enraght-Moony-3/+7
2023-11-28Update cargoWeihang Lo-0/+0
2023-11-28Yeet E0744Michael Goulet-15/+8
2023-11-28Fix coroutine validation for mixed panic strategyTomasz Miąsko-12/+28
Validation introduced in #113124 allows UnwindAction::Continue and TerminatorKind::Resume to occur only in functions with ABI that can unwind. The function ABI depends on the panic strategy, which can vary across crates. Usually MIR is built and validated in the same crate. The coroutine drop glue thus far was an exception. As a result validation could fail when mixing different panic strategies. Avoid the problem by executing AbortUnwindingCalls along with the validation.
2023-11-28thir-unsafeck: print list of missing target features when calling a function ↵Eduardo Sánchez Muñoz-32/+187
with target features outside an unsafe block