about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-08-18Auto merge of #114951 - cuviper:rollup-iitoep5, r=cuviperbors-37/+70
Rollup of 5 pull requests Successful merges: - #113715 (Unstable Book: update `lang_items` page and split it) - #114897 (Partially revert #107200) - #114913 (Fix suggestion for attempting to define a string with single quotes) - #114931 (Revert PR #114052 to fix invalid suggestion) - #114944 (update `thiserror` to version >= 1.0.46) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-17Rollup merge of #114931 - Urgau:revert-114052, r=compiler-errorsJosh Stone-36/+56
Revert PR #114052 to fix invalid suggestion This PR reverts https://github.com/rust-lang/rust/pull/114052 to fix the invalid suggestion produced by the PR. Unfortunately the invalid suggestion cannot be improved from the current position where it's emitted since we lack enough information (is an assignment?, left or right?, ...) to be able to fix it here. Furthermore the previous wasn't wrong, just suboptimal, contrary to the current one which is just wrong. Added a regression test and commented out some code instead of removing it so we can use it later. Reopens https://github.com/rust-lang/rust/issues/114050 Fixes https://github.com/rust-lang/rust/issues/114925
2023-08-17Rollup merge of #114913 - beetrees:escape-double-quote, r=davidtwcoJosh Stone-1/+14
Fix suggestion for attempting to define a string with single quotes Currently attempting to compile `fn main() { let _ = '\\"'; }` will result in the following error message: ``` error: character literal may only contain one codepoint --> src/main.rs:1:21 | 1 | fn main() { let _ = '\\"'; } | ^^^^^ | help: if you meant to write a `str` literal, use double quotes | 1 | fn main() { let _ = "\\""; } | ~~~~~ ``` The suggestion is invalid as it fails to escape the `"`. This PR fixes the suggestion so that it now reads: ``` help: if you meant to write a `str` literal, use double quotes | 1 | fn main() { let _ = "\\\""; } | ~~~~~~ ``` The relevant test is also updated to ensure that this does not regress in future.
2023-08-17Auto merge of #114904 - cjgillot:no-ref-debuginfo, r=wesleywiserbors-552/+773
Remove references in VarDebugInfo The codegen implementation is broken, and attempted to read uninitialized memory. Fixes https://github.com/rust-lang/rust/issues/114488
2023-08-17Bless codegen tests.Camille GILLOT-16/+16
2023-08-17Auto merge of #114802 - chenyukang:yukang-fix-114979-bad-parens-dyn, r=estebankbors-8/+80
Fix bad suggestion when wrong parentheses around a dyn trait Fixes #114797
2023-08-17Bless mir-opt tests.Camille GILLOT-362/+531
2023-08-17Add test.Camille GILLOT-0/+57
2023-08-17Revert "Implement references VarDebugInfo."Camille GILLOT-174/+169
This reverts commit 2ec007191348ef7cc13eb55e44e007b02cf75cf3.
2023-08-17Revert PR #114052 to fix invalid suggestionUrgau-36/+56
2023-08-17Auto merge of #114922 - matthiaskrgr:rollup-qktdihi, r=matthiaskrgrbors-1/+76
Rollup of 5 pull requests Successful merges: - #112751 (rustdoc: Fixes with --test-run-directory and relative paths.) - #114749 (Update `mpsc::Sender` doc to reflect that it implements `Sync`) - #114876 (Don't ICE in `is_trivially_sized` when encountering late-bound self ty) - #114881 (clarify CStr lack of layout guarnatees) - #114921 (Remove Folyd from librustdoc static files) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-17Rollup merge of #114876 - compiler-errors:non-lifetime-binders-sized, ↵Matthias Krüger-0/+30
r=wesleywiser Don't ICE in `is_trivially_sized` when encountering late-bound self ty We can see a bound ty var here: https://github.com/rust-lang/rust/blob/b531630f4255216fce1400c45976e04f1ab35a84/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs#L13-L34 Fixes #114872
2023-08-17Rollup merge of #112751 - ehuss:persist-test-run-directory, r=jshaMatthias Krüger-1/+46
rustdoc: Fixes with --test-run-directory and relative paths. Fixes #112191 Fixes #112210 This fixes some issues with `--test-run-directory` and its interaction with `--runtool` and `--persist-doctests`. Relative directories don't work with `Command::current_dir` very well because it has platform-specific behavior with relative paths. This fixes it by avoiding the use of relative paths. This is needed because cargo is switching to use `--test-run-directory`, and it uses relative paths when interacting with rustdoc/rustc.
2023-08-17Auto merge of #114875 - Zalathar:line-numbers, r=ozkanonurbors-2655/+2655
coverage: Anonymize line numbers in `run-coverage` test snapshots LLVM's coverage reporter always prints line numbers in its coverage reports. For testing purposes this is slightly inconvenient, because it means that adding or removing a line in a test file causes all subsequent lines in the snapshot to change. That makes it harder to see the actually meaningful changes in the re-blessed snapshot. --- This change fixes that by adding another normalization pass that replaces all line numbers in the coverage reports with `LL`, which is similar to what UI tests tell the compiler to do when emitting line numbers in error messages.
2023-08-17coverage: Anonymize line numbers in `run-coverage` test snapshotsZalathar-2655/+2655
This makes the test snapshots less sensitive to lines being added/removed.
2023-08-16Auto merge of #111555 - cjgillot:elaborate-drops, r=tmiaskobors-60/+52
Only run MaybeInitializedPlaces dataflow once to elaborate drops This pass allows forward dataflow analyses to modify the CFG depending on the dataflow state. This possibility is used for the `MaybeInitializedPlace` analysis in drop elaboration, to skip the dataflow effect of dead unwinds without having to compute dataflow twice.
2023-08-16Fix suggestion for attempting to define a string with single quotesbeetrees-1/+14
2023-08-16Do not pre-compute reachable blocks.Camille GILLOT-6/+18
2023-08-16Only run MaybeInitializedPlaces once for drop elaboration.Camille GILLOT-54/+34
2023-08-16Rollup merge of #114784 - Urgau:many-improve-invalid_reference_casting-lint, ↵Matthias Krüger-17/+102
r=est31 Improve `invalid_reference_casting` lint This PR improves the `invalid_reference_casting` lint: - by considering an unlimited number of casts instead only const to mut ptr - by also considering ptr-to-integer and integer-to-ptr casts - by also taking into account [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast), [`ptr::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast-1) and [`ptr::cast_const`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast_const) Most of this improvements comes from skimming Github Code Search result for [`&mut \*.*as \*const`](https://github.com/search?q=lang%3Arust+%2F%26mut+%5C*.*as+%5C*const%2F&type=code) r? ``@est31`` (maybe)
2023-08-16Auto merge of #112500 - lukas-code:span-ctxt, r=petrochenkovbors-30/+145
Fix argument removal suggestion around macros Fixes #112437. Fixes #113866. Helps with #114255. The issue was that `span.find_ancestor_inside(outer)` could previously return a span with a different expansion context from `outer`. This happens for example for the built-in macro `panic!`, which expands to another macro call of `panic_2021!` or `panic_2015!`. Because the call site of `panic_20xx!` has not associated source code, its span currently points to the call site of `panic!` instead. Something similar also happens items that get desugared in AST->HIR lowering. For example, `for` loops get two spans: One "inner" span that has the `.desugaring_kind()` kind set to `DesugaringKind::ForLoop` and one "outer" span that does not. Similar to the macro situation, both of these spans point to the same source code, but have different expansion contexts. This causes problems, because joining two spans with different expansion contexts will usually[^1] not actually join them together to avoid creating "spaghetti" spans that go from the macro definition to the macro call. For example, in the following snippet `full_span` might not actually contain the `adjusted_start` and `adjusted_end`. This caused the broken suggestion / debug ICE in the linked issues. ```rust let adjusted_start = start.find_ancestor_inside(shared_ancestor); let adjusted_end = end.find_ancestor_inside(shared_ancestor); let full_span = adjusted_start.to(adjusted_end) ``` To fix the issue, this PR introduces a new method, `find_ancestor_inside_same_ctxt`, which combines the functionality of `find_ancestor_inside` and `find_ancestor_in_same_ctxt`: It finds an ancestor span that is contained within the parent *and* has the same syntax context, and is therefore safe to extend. This new method should probably be used everywhere, where the returned span is extended, but for now it is just used for the argument removal suggestion. Additionally, this PR fixes a second issue where the function call itself is inside a macro but the arguments come from outside the macro. The test is added in the first commit to include stderr diff, so this is best reviewed commit by commit. [^1]: If one expansion context is the root context and the other is not.
2023-08-16Auto merge of #114850 - khei4:khei4/trailing_zero_codegen, r=nikicbors-0/+22
add codegen test for `trailing_zeros` comparison This PR add codegen test for https://github.com/rust-lang/rust/issues/107554#issuecomment-1677369236 Fixes #107554.
2023-08-16Auto merge of #114847 - nikic:update-llvm-12, r=cuviperbors-0/+66
Update LLVM submodule Merge the current release/17.x branch. Fixes #114691. Fixes #114312. The test for the latter is taken from #114726.
2023-08-16Rollup merge of #114779 - MU001999:fix/114701, r=petrochenkovMatthias Krüger-0/+30
Add check before suggest removing parens Fixes #114701
2023-08-16Rollup merge of #114746 - compiler-errors:atb-no-const, r=TaKO8KiMatthias Krüger-0/+20
Don't add associated type bound for non-types We had this fix for equality constraints (#99890), but for some reason not trait constraints :sweat_smile: Fixes #114744
2023-08-16add codegen test for issue 107554khei4-0/+22
specify llvm-version and bit width for int arg add missing percent simbol
2023-08-16Don't ICE in is_trivially_sized when encountering late-bound self tyMichael Goulet-0/+30
2023-08-15Auto merge of #111071 - nyurik:simpler-issue-94005, r=m-ou-sebors-24/+24
Cleaner assert_eq! & assert_ne! panic messages This PR finishes refactoring of the assert messages per #94005. The panic message format change #112849 used to be part of this PR, but has been factored out and just merged. It might be better to keep both changes in the same release once FCP vote completes. Modify panic message for `assert_eq!`, `assert_ne!`, the currently unstable `assert_matches!`, as well as the corresponding `debug_assert_*` macros. ```rust assert_eq!(1 + 1, 3); assert_eq!(1 + 1, 3, "my custom message value={}!", 42); ``` #### Old messages ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3` ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3`: my custom message value=42! ``` #### New messages ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed left: 2 right: 3 ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed: my custom message value=42! left: 2 right: 3 ``` History of fixing #94005 * #94016 was a lengthy PR that was abandoned * #111030 was similar, but it stringified left and right arguments, and thus caused compile time performance issues, thus closed * #112849 factored out the two-line formatting of all panic messages Fixes #94005 r? `@m-ou-se`
2023-08-15Cleaner assert_eq! & assert_ne! panic messagesYuri Astrakhan-24/+24
Modify panic message for `assert_eq!`, `assert_ne!`, the currently unstable `assert_matches!`, as well as the corresponding `debug_assert_*` macros. ```rust assert_eq!(1 + 1, 3); assert_eq!(1 + 1, 3, "my custom message value={}!", 42); ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3` ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion failed: `(left == right)` left: `2`, right: `3`: my custom message value=42! ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed left: 2 right: 3 ``` ```plain thread 'main' panicked at $DIR/main.rs:6:5: assertion `left == right` failed: my custom message value=42! left: 2 right: 3 ``` This PR is a simpler subset of the #111030, but it does NOT stringify the original left and right source code assert expressions, thus should be faster to compile.
2023-08-15Rollup merge of #114853 - GuillaumeGomez:migrate-gui-test-color-33, r=notriddleMatthias Krüger-3/+3
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
2023-08-15Rollup merge of #114819 - estebank:issue-78124, r=compiler-errorsMatthias Krüger-0/+40
Point at return type when it influences non-first `match` arm When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
2023-08-15Rollup merge of #114668 - compiler-errors:match-fn-def, r=petrochenkovMatthias Krüger-0/+30
Deny `FnDef` in patterns We can only see these via `const { .. }` patterns, which are unstable. cc #76001 (tracking issue for inline const pats) Fixes #114658 Fixes #114659
2023-08-15Rollup merge of #114644 - compiler-errors:lt-err, r=wesleywiserMatthias Krüger-7/+21
Point out expectation even if we have `TypeError::RegionsInsufficientlyPolymorphic` just a minor tweak, since saying "one type is more general than the other" kinda sucks if we don't actually point out two types.
2023-08-16Fix bad suggestion when wrong parentheses around a dyn traityukang-8/+80
2023-08-15Migrate GUI colors test to original CSS color formatGuillaume Gomez-3/+3
2023-08-15Rollup merge of #114831 - ↵Guillaume Gomez-1/+16
compiler-errors:next-solver-projection-subst-compat, r=lcnr Check projection args before substitution in new solver Don't ICE when an impl has the wrong kind of GAT arguments r? lcnr
2023-08-15Rollup merge of #114830 - compiler-errors:ui-test-annotations, r=petrochenkovGuillaume Gomez-17/+17
Clean up some bad UI testing annotations These annotations do nothing :sweat_smile:
2023-08-15Rollup merge of #114829 - ↵Guillaume Gomez-0/+2
compiler-errors:next-solver-only-unsize-to-dyn-once, r=lcnr Separate `consider_unsize_to_dyn_candidate` from other unsize candidates Move the unsize candidate assembly *just for* `T -> dyn Trait` out of `assemble_candidates_via_self_ty` so that we only consider it once, instead of for every normalization step of the self ty. This makes sure that we don't assemble several candidates that are equal modulo normalization when we really don't care about normalizing the self type of an `T: Unsize<dyn Trait>` goal anyways. Fixes rust-lang/trait-system-refactor-initiative#57 r? lcnr
2023-08-15Rollup merge of #114828 - compiler-errors:next-solver-probe-upcasting, r=lcnrGuillaume Gomez-3/+15
Probe when assembling upcast candidates so they don't step on eachother's toes in new solver Lack of a probe causes one candidate to disqualify the other due to inference side-effects. r? lcnr
2023-08-15Rollup merge of #114827 - compiler-errors:next-solver-dyn-safe-candidates, ↵Guillaume Gomez-0/+2
r=lcnr Only consider object candidates for object-safe dyn types in new solver We apparently allow this per RFC2027 :skull: r? lcnr
2023-08-15Rollup merge of #114825 - cuviper:gimli-0.28, r=compiler-errorsGuillaume Gomez-0/+9
Upgrade std to gimli 0.28.0 Gimli 0.28 removed its `From<EndianSlice> for &[u8]` that was the root cause of #113238. This dependency update mirrors rust-lang/backtrace-rs#557, but since that doesn't require any code changes in `backtrace`, we can also apply that right away for our nested `std/backtrace` feature.
2023-08-15Rollup merge of #114820 - ehuss:unknown-lint-mod-warning, r=compiler-errorsGuillaume Gomez-0/+36
Add test for unknown_lints from another file. This adds a test for #84936 which was incidentally fixed via #97266. It is a strange issue where `#![allow(unknown_lints)]` at the crate root was not applying to unknown lints that fired in a non-inline-module. I did not dig further into how #97266 fixed it, but I did verify it. I couldn't find any existing tests which did anything similar. Closes #84936
2023-08-15Remove extra errorsr0cky-39/+6
2023-08-15Cherry-pick test for issue #114312DianQK-0/+27
2023-08-15Add test for #114691Nikita Popov-0/+39
2023-08-15Improve `invalid_reference_casting` lintUrgau-17/+102
2023-08-15Auto merge of #114023 - compiler-errors:coinductive-cycle-lint, r=lcnrbors-6/+72
Warn on inductive cycle in coherence leading to impls being considered not overlapping This PR implements a `coinductive_overlap_in_coherence` lint (#114040), which warns users against cases where two impls are considered **not** to overlap during coherence due to an inductive cycle disproving one of the predicates after unifying the two impls. Cases where this lint fires will become an overlap error if we ever move to coinduction, so I'd like to make this a warning to avoid having more crates take advantage of this behavior in the mean time. Also, since the new trait solver treats inductive cycles as ambiguity, not an error, this is a blocker for landing the new trait solver in coherence.
2023-08-15Deny FnDef in patternsMichael Goulet-0/+30
2023-08-15more nitsMichael Goulet-3/+4
2023-08-15nitsMichael Goulet-1/+1
Co-authored-by: lcnr <rust@lcnr.de>