summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-06-06Revert "Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, ↵Rémy Rakic-101/+26
r=davidtwco" This reverts commit 57dad1d75e562ff73051c1c43b07eaf65c7dbd74, reversing changes made to 36316df9fe6c3e246153fe6e78967643cf08c148.
2024-06-06ast: Revert a breaking attribute visiting order changeVadim Petrochenkov-41/+25
(cherry picked from commit 6e67eaa311c8e2992ccc64cf6a9e8f311a02a5d4)
2024-06-06Add a test for resolving `macro_rules` calls inside attributesVadim Petrochenkov-0/+202
(cherry picked from commit 3c4066d1126b7c0ed13da96639ca86ffc42ceea6)
2024-06-06Add regression testsOli Scherer-0/+136
(cherry picked from commit 526090b901cbedcef7e1eec132e217917606a54d)
2024-06-06Wrap Context.ext in AssertUnwindSafeJubilee Young-38/+20
(cherry picked from commit 3a21fb5cec07052cb664b6a051e233cd4776283a)
2024-06-06Fix ICE in non-operand `aggregate_raw_ptr` instrinsic codegenScott McMurray-0/+23
(cherry picked from commit f60f2e8cb07d21b7d5b0fa7f96dacd2e806b98e4)
2024-06-06Handle Deref expressions in invalid_reference_castingBen Kimock-0/+7
(cherry picked from commit 2bb25d3f4ac8796a50f45409f3ef461ce83295f3)
2024-06-06Handle field projections like slice indexing in invalid_reference_castingBen Kimock-0/+6
(cherry picked from commit 0ca1a94b2bd58d19a1bd492300abd5bffe5263fb)
2024-06-06Fix insufficient logic when searching for the underlying allocationUrgau-0/+8
in the `invalid_reference_casting` lint, when trying to lint on bigger memory layout casts. (cherry picked from commit cd6a0c8c77575056f95d79ae1f5c460794e1388f)
2024-05-27revert leak check changes in candidate winnowinglcnr-241/+78
reverts the behavior changes of #119820 to give some additional time to `sqlx` as it is affected by this change.
2024-05-24Only make GAT ambiguous in match_projection_projections considering shallow ↵Michael Goulet-0/+19
resolvability (cherry picked from commit fa829feb2f7a3fee5890f3acf57b66029b123d18)
2024-05-16Make `non-local-def` lint Allow by defaultWesley Wiser-70/+130
(cherry picked from commit 23015b9ff4a7f829c2e0c884bdc0bcdb3c6d86f7)
2024-05-16Add test to make sure suggestions are still quickMichael Goulet-0/+247
(cherry picked from commit 8f97a2588caa808b4d46dc3224de5d40bbbcd94b)
2024-05-16rustdoc: use stability, instead of features, to decide what to showMichael Howell-2/+23
To decide if internal items should be inlined in a doc page, check if the crate is itself internal, rather than if it has the rustc_private feature flag. The standard library uses internal items, but is not itself internal and should not show internal items on its docs pages. (cherry picked from commit 6d6f67a98cbc399ac14a3f9a8ddf6ed30bb7fb83)
2024-05-16Fix ICEs in diagnostic::on_unimplementedMichael Goulet-0/+134
(cherry picked from commit 7dbdbaaa8e4ce77f9b2f1428c82f7166fe6f02fb)
2024-05-16Add more ICEs due to malformed diagnostic::on_unimplementedMichael Goulet-35/+56
(cherry picked from commit a8f2e33eec57d56477c45396e4860f92247f353a)
2024-05-16Add test for #124651Esteban Küber-0/+36
(cherry picked from commit 758e459427946d89a3d900973923e504f712babc)
2024-05-09Consider inner modules to be local in the `non_local_definitions` lintUrgau-0/+38
(cherry picked from commit 21c688af86a52cf5d44c69c274179e7410e01a49)
2024-04-28Rollup merge of #124165 - matthiaskrgr:slice-pattern-const-ice-incr, ↵Matthias Krüger-0/+39
r=Mark-Simulacrum add test for incremental ICE: slice-pattern-const.rs #83085 Fixes #83085
2024-04-27Rollup merge of #124425 - saethlin:ceci-nest-pas-une-ice, r=compiler-errorsMatthias Krüger-0/+52
Do not ICE on invalid consts when walking mono-reachable blocks The `bug!` here was written under the logic of "this condition is impossible, right?" except that of course, if the compiler is given code that results in an compile error, then the situation is possible. So now we just direct errors into the already-existing path for when we can't do a mono-time optimization.
2024-04-27Rollup merge of #124394 - gurry:123863-ice-unexpected-region, r=lcnrMatthias Krüger-6/+47
Fix ICE on invalid const param types Fixes ICE #123863 which occurs because the const param has a type which is not a `bool`, `char` or an integral type. The ICEing code path begins here in `typeck_with_fallback`: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_typeck/src/lib.rs#L167 The `fallback` invokes the `type_of` query and that eventually ends up calling `ct_infer` from the lowering code over here: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs#L561 and `ct_infer` ICEs at this location: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/collect.rs#L392 To fix the ICE it I'm triggering a `span_delayed_bug` before we hit `ct_infer` if the type of the const param is not one of the supported types ### Edit On `@lcnr's` suggestion I've changed the approach to not let `ReStatic` region hit the `bug!` in `ct_infer` instead of triggering a `span_delayed_bug`.
2024-04-27Rollup merge of #124370 - ShE3py:substitution-part-offset, r=fee1-deadMatthias Krüger-1/+1
Fix substitution parts having a shifted underline in some cases If two suggestions parts are side by side, the underline's offset: (WIP PR as an example, not yet pushed) ``` error: expected a pattern, found an expression --> ./main.rs:4:9 | 4 | 1 + 2 => 3 | ^^^^^ arbitrary expressions are not allowed in patterns | help: check the value in an arm guard | 4 | n if n == 1 + 2 => 3 | ~ +++++++++++++ ``` The emitter didn't take into account that the string had shrunk/grown if two substitution parts were side-by-side (surprisingly, there was only one case in the ui testsuite.) ``` help: check the value in an arm guard | 4 | n if n == 1 + 2 => 3 | ~ +++++++++++++ ``` ``@rustbot`` label +A-suggestion-diagnostics
2024-04-27Rollup merge of #124427 - gurry:122191-unhandled-type, r=matthiaskrgrMatthias Krüger-0/+76
Add missing tests for an ICE Fixes #122191
2024-04-27Rollup merge of #124382 - petrochenkov:itemvisit, r=lcnrMatthias Krüger-22/+22
ast: Generalize item kind visiting And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign). The diff is better viewed with whitespace ignored.
2024-04-27Add missing tests for an ICEGurinder Singh-0/+76
2024-04-27Fix ICE on invalid const param typesGurinder Singh-6/+47
2024-04-26Do not ICE on invalid consts when walking mono-reachable blocksBen Kimock-0/+52
2024-04-26Rollup merge of #124408 - matthiaskrgr:loltest, r=jieyouxuJacob Pratt-0/+102
crashes: add more tests
2024-04-26Rollup merge of #124383 - Urgau:port-print-native-static-libs, r=jieyouxuJacob Pratt-19/+76
Port run-make `--print=native-static-libs` to rmake.rs This PR port the run-make `--print=native-static-libs` test to rmake.rs The dedup was really awful in the `Makefile`, I'm glad to finally have a proper dedup detection for this. Related to https://github.com/rust-lang/rust/issues/121876 r? `@jieyouxu`
2024-04-27Also support MSVC in print-native-static-libs testUrgau-5/+18
2024-04-26Port run-make `--print=native-static-libs` to rmake.rsUrgau-19/+63
2024-04-26Auto merge of #122385 - lcnr:analyze-obligations-for-infer, r=compiler-errorsbors-28/+84
`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals As always, dealing with proof trees continues to be a hacked together mess. After this PR and #124380 the only remaining blocker for core is https://github.com/rust-lang/trait-system-refactor-initiative/issues/90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally. The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one. For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states. r? `@compiler-errors`
2024-04-26crashes: add more testsMatthias Krüger-0/+102
2024-04-26Auto merge of #120845 - petrochenkov:debmac, r=oli-obkbors-208/+116
debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and `#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local) - https://github.com/rust-lang/rust/issues/100758#issuecomment-1935815625 describes some debugging scenarios that motivate this default as reasonable. `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default. Stabilization report: https://github.com/rust-lang/rust/pull/120845#issuecomment-1939145242 Closes https://github.com/rust-lang/rust/issues/100758 Closes https://github.com/rust-lang/rust/issues/41743 Closes https://github.com/rust-lang/rust/issues/39153
2024-04-26Update lldb only testsVadim Petrochenkov-0/+2
2024-04-25Rollup merge of #124378 - dpaoliello:keeplib, r=jieyouxuMichael Goulet-1/+4
Keep the LIB env var in the compiler-builtins test The `tests/run-make/compiler-builtins` test was failing for me with Visual Studio 2022, complaining that it couldn't find `kernel32.lib`. For whatever reason, with VS 2022 we need to keep the `LIB` environment variable when invoking Cargo so that the linker can find the Windows SDK libs.
2024-04-25Keep the LIB env var in the compiler-builtins testDaniel Paoliello-1/+4
2024-04-25Auto merge of #124386 - matthiaskrgr:rollup-0a6yr00, r=matthiaskrgrbors-12/+148
Rollup of 3 pull requests Successful merges: - #124313 (Detect borrow error involving sub-slices and suggest `split_at_mut`) - #124374 (Don't ICE when `codegen_select_candidate` returns ambiguity in new solver) - #124380 (`Range` iteration specialization: remove trivial bounds) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-25ast: Generalize item kind visitingVadim Petrochenkov-22/+22
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
2024-04-25hir typeck: look into nested goalslcnr-28/+84
uses a `ProofTreeVisitor` to look into nested goals when looking at the pending obligations during hir typeck. Used by closure signature inference, coercion, and for async functions.
2024-04-25debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and ↵Vadim Petrochenkov-208/+114
`#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local). `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-25Rollup merge of #124374 - compiler-errors:fix-ambiguity-ice, r=lcnrMatthias Krüger-7/+17
Don't ICE when `codegen_select_candidate` returns ambiguity in new solver Because we merge identical candidates, we may have >1 impl candidate to in `codegen_select_error` but *not* have a trait error. r? lcnr
2024-04-25Rollup merge of #124313 - estebank:split-at-mut, r=fee1-deadMatthias Krüger-5/+131
Detect borrow error involving sub-slices and suggest `split_at_mut` ``` error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/suggest-split-at-mut.rs:13:18 | LL | let a = &mut foo[..2]; | --- first mutable borrow occurs here LL | let b = &mut foo[2..]; | ^^^ second mutable borrow occurs here LL | a[0] = 5; | ---- first borrow later used here | = help: use `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices ``` Address most of #58792. For follow up work, we should emit a structured suggestion for cases where we can identify the exact `let (a, b) = foo.split_at_mut(2);` call that is needed.
2024-04-25Auto merge of #124377 - matthiaskrgr:rollup-ajxjq35, r=matthiaskrgrbors-21/+13
Rollup of 2 pull requests Successful merges: - #124287 (Improved code with clippy) - #124326 (tests: remove few ignore-stage2) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-25Rollup merge of #124326 - klensy:ignore-stage2, r=compiler-errorsMatthias Krüger-21/+13
tests: remove few ignore-stage2 beta was branched long ago, so can be removed
2024-04-25Check equivalence of indices in more casesEsteban Küber-6/+3
2024-04-25Don't suggest `split_at_mut` when the multiple borrows have the same indexEsteban Küber-3/+19
2024-04-25Mention `split_at_mut` when mixing mutability in indexing opsEsteban Küber-2/+89
Emit suggestion when encountering ```rust let a = &mut foo[0]; let b = &foo[1]; a.use_mut(); ```
2024-04-25Only suggest `split_at_mut` on indexing borrowck errors for std typesEsteban Küber-5/+1
2024-04-25Detect borrow error involving sub-slices and suggest `split_at_mut`Esteban Küber-2/+32
``` error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/suggest-split-at-mut.rs:13:18 | LL | let a = &mut foo[..2]; | --- first mutable borrow occurs here LL | let b = &mut foo[2..]; | ^^^ second mutable borrow occurs here LL | a[0] = 5; | ---- first borrow later used here | = help: use `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices ``` Address most of #58792. For follow up work, we should emit a structured suggestion for cases where we can identify the exact `let (a, b) = foo.split_at_mut(2);` call that is needed.