about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-11-30Add `-Zfunction-return={keep,thunk-extern}` optionMiguel Ojeda-0/+107
This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-30Auto merge of #118379 - compiler-errors:const-params-for-partialeq, r=fee1-deadbors-45/+13
Fix `PartialEq` args when `#[const_trait]` is enabled This is based off of your PR that enforces effects on all methods, so just see the last commits. r? fee1-dead
2023-11-29Avoid unnecessary pattern parse errors on `ref box`Esteban Küber-24/+2
2023-11-29fix rebaseEsteban Küber-2/+24
2023-11-29Always emit help when failing to parse enum variantEsteban Küber-0/+4
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-24/+79
Use the same approach used for match arm patterns.
2023-11-29Account for `(pat if expr) => {}`Esteban Küber-8/+25
When encountering match arm (pat if expr) => {}, recover and suggest removing parentheses. Fix #100825.
2023-11-29Change enum parse recoveryEsteban Küber-13/+9
2023-11-29Bubble parse error when expecting `)`Esteban Küber-51/+22
2023-11-29More accurate span for unnecessary parens suggestionEsteban Küber-1/+1
2023-11-29When parsing patterns, bubble all errors except reserved idents that aren't ↵Esteban Küber-6/+208
likely to appear in for head or match arm
2023-11-29Make `parse_pat_ident` not recover bad nameEsteban Küber-273/+14
2023-11-29Rollup merge of #118426 - aDotInTheVoid:const-wat, r=compiler-errors,cjgillotMatthias Krüger-0/+67
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-47/+129
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 #118191 - estebank:let-chain-typo, r=compiler-errorsMatthias Krüger-10/+23
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-0/+221
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-29Auto merge of #118433 - matthiaskrgr:rollup-fi9lrwg, r=matthiaskrgrbors-51/+32
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-29Rollup merge of #118429 - cuviper:its-arguments, r=compiler-errorsMatthias Krüger-2/+2
Fix a typo in a `format_args!` note
2023-11-29Rollup merge of #118413 - chenyukang:yukang-fix-118145-unwrap-for-shorthand, ↵Matthias Krüger-0/+303
r=compiler-errors Fix the issue of suggesting unwrap/expect for shorthand field Fixes #118145
2023-11-29Rollup merge of #118342 - compiler-errors:macro-generic-bang, r=estebankMatthias Krüger-0/+13
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-0/+24
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-51/+8
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-29Add `never_patterns` feature gateNadrieril-0/+221
2023-11-28Fix a typo in a `format_args!` noteJosh Stone-2/+2
2023-11-29Auto merge of #114841 - bvanjoi:fix-114814, r=cuviperbors-4/+81
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-0/+234
2023-11-28Rename and add another testAlona Enraght-Moony-3/+30
2023-11-28Auto merge of #118412 - matthiaskrgr:rollup-ghzhti2, r=matthiaskrgrbors-1/+1
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-2/+1
2023-11-28Add with_opt_const_effect_param helper, simplifyMichael Goulet-2/+2
2023-11-28Add PartialEq<&B> for &AMichael Goulet-44/+12
2023-11-28Fix PartialEq args when #[const_trait] is enabledMichael Goulet-1/+1
2023-11-28Fix coroutine validation for mixed panic strategyTomasz Miąsko-0/+24
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-13/+65
with target features outside an unsafe block
2023-11-28Fix spans for bad await in inline constMichael Goulet-47/+8
2023-11-28Eagerly return ExprKind::Err on yield/await in wrong coroutine contextMichael Goulet-4/+0
2023-11-28Suggest `let` or `==` on typo'd let-chainEsteban Küber-10/+23
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-28fix the issue of suggest unwrap/expect for shorthand fieldyukang-0/+69
2023-11-28Precommit test for https://github.com/rust-lang/rust/issues/118328.Alona Enraght-Moony-0/+41
2023-11-28Rollup merge of #118410 - krasimirgg:llvm-18-test, r=nikicMatthias Krüger-1/+1
update test for new LLVM 18 codegen LLVM at HEAD now emits `or disjoint`: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24076#018c1596-8153-488e-b622-951266a02f6c/741-774
2023-11-28def collector: Set correct namespace in `DefPathData` for foreign typesVadim Petrochenkov-1/+1
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-2/+2
2023-11-28update test for new LLVM 18 codegenKrasimir Georgiev-1/+1
LLVM at HEAD now emits `or disjoint`: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24076#018c1596-8153-488e-b622-951266a02f6c/741-774
2023-11-28Auto merge of #118405 - matthiaskrgr:rollup-3a2eevc, r=matthiaskrgrbors-8/+35
Rollup of 7 pull requests Successful merges: - #115331 (optimize str::iter::Chars::advance_by) - #118236 (Update mod comment) - #118299 (Update `OnceLock` documentation to give a concrete 'lazy static' example, and expand on the existing example.) - #118314 (Rename `{collections=>alloc}{tests,benches}`) - #118341 (Simplify indenting in THIR printing) - #118366 (Detect and reject malformed `repr(Rust)` hints) - #118397 (Fix comments for unsigned non-zero `checked_add`, `saturating_add`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-28Rollup merge of #118366 - fmease:detect-reject-malformed-rust-repr, ↵Matthias Krüger-8/+35
r=compiler-errors Detect and reject malformed `repr(Rust)` hints Fixes #118334.
2023-11-28Auto merge of #118282 - fee1-dead-contrib:enforce-more, r=compiler-errorsbors-30/+75
effects: Run `enforce_context_effects` for all method calls So that we also perform checks when overloaded `PartialEq`s are called. r? `@compiler-errors`
2023-11-27Rollup merge of #118381 - Enselic:edit-dist-len, r=WaffleLapkinMichael Goulet-0/+13
rustc_span: Use correct edit distance start length for suggestions Otherwise the suggestions can be off-base for non-ASCII identifiers. For example suggesting that `Ok` is a name similar to `读文`. Closes https://github.com/rust-lang/rust/issues/72553.
2023-11-27Rollup merge of #118202 - azhogin:azhogin/link_args_wrapping, r=petrochenkovMichael Goulet-0/+9
Added linker_arg(s) Linker trait methods for link-arg to be prefixed "-Wl," for cc-like linker args and not verbatim https://github.com/rust-lang/rust/issues/99427#issuecomment-1234443468 > here's one possible improvement to -l link-arg making it more portable between linkers and useful - befriending it with the verbatim modifier (https://github.com/rust-lang/rust/issues/99425). > > -l link-arg:-verbatim=-foo would add -Wl,-foo (or equivalent) when C compiler is used as a linker, and just -foo when bare linker is used. > -l link-arg:+verbatim=-bar on the other hand would always pass just -bar.