about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-03-06Auto merge of #108789 - matthiaskrgr:rollup-nyurto8, r=matthiaskrgrbors-0/+76
Rollup of 7 pull requests Successful merges: - #108244 (Add test for semicolon recovery ICE) - #108746 (Don't project to RPITIT that has no default value) - #108764 (Tweaks to -Zdrop-tracking-mir) - #108770 (Improve documentation and argument naming of some TyCtxt methods) - #108773 (x fmt: Only check modified files locally) - #108775 (Use the correct bound vars in return type suggestion.) - #108776 (Make `x test tidy` less noisy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-05Auto merge of #108157 - scottmcm:tuple-gt-via-partialcmp, r=dtolnaybors-0/+121
Use `partial_cmp` to implement tuple `lt`/`le`/`ge`/`gt` In today's implementation, `(A, B)::gt` contains calls to *both* `A::eq` *and* `A::gt`. That's fine for primitives, but for things like `String`s it's kinda weird -- `(String, usize)::gt` has a call to both `bcmp` and `memcmp` (<https://rust.godbolt.org/z/7jbbPMesf>) because when `bcmp` says the `String`s aren't equal, it turns around and calls `memcmp` to find out which one's bigger. This PR changes the implementation to instead implement `(A, …, C, Z)::gt` using `A::partial_cmp`, `…::partial_cmp`, `C::partial_cmp`, and `Z::gt`. (And analogously for `lt`, `le`, and `ge`.) That way expensive comparisons don't need to be repeated. Technically this is an observable change on stable, so I've marked it `needs-fcp` + `T-libs-api` and will r? rust-lang/libs-api I'm hoping that this will be non-controversial, however, since it's very similar to the observable changes that were made to the derives (#81384 #98655) -- like those, this only changes behaviour if a type overrode behaviour in a way inconsistent with the rules for the various traits involved. (The first commit here is #108156, adding the codegen test, which I used to make sure this doesn't regress behaviour for primitives.) Zulip conversation about this change: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60.3E.60.20on.20Tuples/near/328392927>.
2023-03-05Rollup merge of #108775 - cjgillot:issue-107860, r=compiler-errorsMatthias Krüger-0/+18
Use the correct bound vars in return type suggestion. Fixes https://github.com/rust-lang/rust/issues/107860
2023-03-05Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errorsMatthias Krüger-0/+3
Tweaks to -Zdrop-tracking-mir Split from https://github.com/rust-lang/rust/pull/107421 3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05Rollup merge of #108746 - ↵Matthias Krüger-0/+37
compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot Don't project to RPITIT that has no default value Replicates this behavior, but for RPITIT projection logic (which currently is separate) https://github.com/rust-lang/rust/blob/b1719530f44e3c8ec903f76020a52bd8764d5d10/compiler/rustc_trait_selection/src/traits/project.rs#L2105-L2115 Fixes #108738
2023-03-05Rollup merge of #108244 - lukas-code:semicolon-recovery-span, r=cjgillotMatthias Krüger-0/+18
Add test for semicolon recovery ICE closes https://github.com/rust-lang/rust/issues/108242
2023-03-05Use the correct bound vars in return type suggestion.Camille GILLOT-0/+18
2023-03-05Rollup merge of #108744 - ↵Matthias Krüger-0/+33
compiler-errors:non_lifetime_binders-bad-copy-clone, r=jackh726 Don't ICE when encountering bound var in builtin copy/clone bounds Fixes #108742
2023-03-05Rollup merge of #108626 - ozkanonur:consistent-json-docs, r=aDotInTheVoidMatthias Krüger-9/+5
rustdoc-json: switch from HashMap to FxHashMap to fix non-determinism Using `HashMap` in `rustdoc_json_types::Crate` were causing creating randomly ordered objects in the json doc files. Which might cause problems to people who are doing comparison on those files specially in CI pipelines. See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590 This PR fixes that issue and extends the coverage of `tests/run-make/rustdoc-verify-output-files` testing ability.
2023-03-05add test for https://github.com/rust-lang/rust/issues/108242Lukas Markeffsky-0/+18
2023-03-05drop_tracking_mir: diagnose recursive generator.Camille GILLOT-0/+3
2023-03-05Auto merge of #107844 - Zeegomo:no-drop-and-rep, r=cjgillotbors-131/+191
Desugaring of drop and replace at MIR build This commit desugars the drop and replace deriving from an assignment at MIR build, avoiding the construction of the `DropAndReplace` terminator (which will be removed in a following PR). In order to retain the same error messages for replaces a new `DesugaringKind::Replace` variant is introduced. The changes in the borrowck are also useful for future work in moving drop elaboration before borrowck, as no `DropAndReplace` would be present there anymore. Notes on test diffs: * `tests/ui/borrowck/issue-58776-borrowck-scans-children`: the assignment deriving from the desugaring kills the borrow. * `tests/ui/async-await/async-fn-size-uninit-locals.rs`, `tests/mir-opt/issue_41110.test.ElaborateDrops.after.mir`, `tests/mir-opt/issue_41888.main.ElaborateDrops.after.mir`: drop elaboration generates (or reads from) a useless drop flag due to an issue with the dataflow analysis. Will be fixed independently by https://github.com/rust-lang/rust/pull/106430. See https://github.com/rust-lang/rust/pull/104488 for more context
2023-03-05fix inconsistent json outputs from rustdocozkanonur-9/+5
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-03-04Rollup merge of #108734 - clubby789:rustdoc-layout-uninhabited, r=GuillaumeGomezMatthias Krüger-0/+8
rustdoc: Note in a type's layout/size if it is uninhabited Closes #87008 ![image](https://user-images.githubusercontent.com/13556931/222900244-8e326d51-8d3b-4700-a935-96830179e2e9.png)
2023-03-04Rollup merge of #108723 - notriddle:notriddle/where-clause, r=GuillaumeGomezMatthias Krüger-0/+42
rustdoc: function signature search with traits in `where` clause ## Before ![image](https://user-images.githubusercontent.com/1593513/222873534-a640a72a-c654-4702-9f3b-175129d9591d.png) ## After ![image](https://user-images.githubusercontent.com/1593513/222873544-fdfc431d-2b65-4b56-bede-0302ea9f153a.png)
2023-03-04Rollup merge of #108627 - estebank:suggestion-hightlight, r=WaffleLapkinMatthias Krüger-0/+65
Properly colorize multi-part suggestions in the same line Fix #108547.
2023-03-04Don't project to RPITIT that has no default valueMichael Goulet-0/+37
2023-03-04Don't ICE when encountering bound var in builtin copy/clone boundsMichael Goulet-0/+33
2023-03-04rustdoc: function signature search with traits in `where` clauseMichael Howell-0/+42
2023-03-04rustdoc: Note in a type's layout/size if it is uninhabitedclubby789-0/+8
2023-03-04Rollup merge of #108656 - GuillaumeGomez:rustdoc-search-unclosed-generic, ↵Dylan DPC-0/+10
r=notriddle Rustdoc search: Emit an error for unclosed generic Now, search like `a<` will error as it should (and as written in the eBNF). r? `@notriddle`
2023-03-04Rollup merge of #108298 - TaKO8Ki:fix-104440, r=cjgillotDylan DPC-0/+13
Fix ICE: check if snippet is `)` Fixes #107705
2023-03-04Properly colorize multi-part suggestions in the same lineEsteban Küber-0/+65
Fix #108547.
2023-03-03Auto merge of #108709 - matthiaskrgr:rollup-j2tjbyx, r=matthiaskrgrbors-28/+82
Rollup of 8 pull requests Successful merges: - #104549 (add -Zexport-executable-symbols to unstable book) - #108292 (Label opaque type for 'captures lifetime' error message) - #108540 (Add `Atomic*::from_ptr`) - #108634 (Add link to component dashboard) - #108647 (Remove dead pgo.sh file) - #108678 (Use `Option::as_slice` where applicable) - #108681 (Improve comments in `needs_process_obligation`.) - #108688 (Match unmatched backticks in library/) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-03Add test for unclosed genericGuillaume Gomez-0/+10
2023-03-03Rollup merge of #108292 - compiler-errors:opaque-captures-where, r=oli-obkMatthias Krüger-28/+82
Label opaque type for 'captures lifetime' error message Providing more information may help make this somewhat opaque (lol) error message a bit clearer.
2023-03-03Rollup merge of #108685 - est31:backticks_matchmaking, r=petrochenkovMatthias Krüger-4/+4
Match unmatched backticks in compiler/ Found with GNU grep: ``` grep -rEn '^(([^`]*`){2})*[^`]*`[^`]*$' compiler/ | rg -v '\s*[//]?.{1,2}```' ```
2023-03-03Rollup merge of #108674 - flip1995:clippy_backport, r=ManishearthMatthias Krüger-0/+40
Clippy Fix array-size-threshold config deserialization error Complementary PR to https://github.com/rust-lang/rust/pull/108673 in order to also get this into the **next** beta. r? ``@Mark-Simulacrum``
2023-03-03Rollup merge of #108667 - compiler-errors:issue-108664, r=estebankMatthias Krüger-0/+26
Fix another ICE in `point_at_expr_source_of_inferred_type` Types coming from method probes must only be investigated *structurally*, since they often contain escaping infer variables from generalization and autoderef. We already have a hack in this PR that erases variables from types, so just use that. Fixes #108664 The note attached to this error is pretty bad: ``` here the type of `primes` is inferred to be `[_]` ``` But that's unrelated to the PR. --- Side-note: This is a pretty easy to trigger beta regression, so I've nominated it. Alternatively, I'm slightly inclined to remove this code altogether until it can be reformulated to be more accurate and less ICEy.
2023-03-03Rollup merge of #108553 - compiler-errors:non-lt-late-bound-in-anon-ct, ↵Matthias Krüger-0/+38
r=petrochenkov Deny capturing late-bound non-lifetime param in anon const Introduce a new AnonConstBoundary so we can detect when we capture a late-bound non-lifetime param with `non_lifetime_binders` enabled. In the future, we could technically do something like introduce an early-bound parameter on the anon const, and stick the late-bound param in its substs (kinda like how we turn late-bound lifetimes in opaques into early-bound ones). But for now, just deny it so we don't ICE. Fixes #108191
2023-03-03Update expected closure coverage info in testGiacomo Pasini-2/+2
2023-03-03Add needs-unwindGiacomo Pasini-2/+3
2023-03-03Desugars drop and replace at MIR buildGiacomo Pasini-129/+188
This commit desugars the drop and replace deriving from an assignment at MIR build, avoiding the construction of the DropAndReplace terminator (which will be removed in a followign PR) In order to retain the same error messages for replaces a new DesugaringKind::Replace variant is introduced.
2023-03-03Match end user facing unmatched backticks in compiler/est31-4/+4
2023-03-03check if snippet is `)`Takayuki Maeda-0/+13
2023-03-03Label opaque type for 'captures lifetime' error messageMichael Goulet-28/+82
2023-03-02Rollup merge of #108672 - spastorino:new-rpitit-impl-side, r=compiler-errorsMatthias Krüger-0/+11
Feed queries on impl side for RPITITs when using lower_impl_trait_in_trait_to_assoc_ty I've added a test for traits that were already working and what I think is probably the last bit of infrastructure work needed. In following PRs I'm going to start adding things TDD style, tests and code that make it work. r? `@compiler-errors`
2023-03-02Rollup merge of #108624 - Nilstrieb:move-it-up, r=WaffleLapkinMatthias Krüger-9/+9
Make `ExprKind` the first field in `thir::Expr` This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2023-03-02Rollup merge of #108584 - GuillaumeGomez:rustdoc-search-background, r=notriddleMatthias Krüger-2/+41
Put backtick content from rustdoc search errors into a <code> elements Some screenshots of the result: ![Screenshot from 2023-02-28 22-37-09](https://user-images.githubusercontent.com/3050060/221990290-fa84f1cf-5a64-4ce5-8433-ee36cedf4c00.png) ![Screenshot from 2023-02-28 22-36-59](https://user-images.githubusercontent.com/3050060/221990298-f8177eeb-894b-4fce-a6fc-06d17c8b7ca2.png) ![Screenshot from 2023-02-28 22-36-51](https://user-images.githubusercontent.com/3050060/221990301-41bffd64-d041-41f1-995a-983925b1fbb1.png) You can test it [here](https://rustdoc.crud.net/imperio/rustdoc-search-background/foo/index.html?search=%22). r? ```@notriddle```
2023-03-02Rollup merge of #108573 - kornelski:runtimeenvs, r=WaffleLapkinMatthias Krüger-10/+13
Explain compile-time vs run-time difference in env!() error message This PR is clarifying error message of `env!()` based on this user question: https://users.rust-lang.org/t/environment-variable-out-dir-is-undefined/90067 It makes it clear that `env!()` is for env variables defined at compile-time. There's special-case help text for common Cargo build script variables. I've also rearranged the code to avoid allocating error message on the happy path when the env var is defined.
2023-03-02Rollup merge of #108557 - Nathan-Fenner:nathanf/adjust-error-span-fix-Some, ↵Matthias Krüger-5/+446
r=WaffleLapkin Point error span at Some constructor argument when trait resolution fails This is a follow up to #108254 and #106477 which extends error span refinement to handle a case which I mistakenly believed was handled in #106477. The goal is to refine the error span depicted below: ```rs trait Fancy {} impl <T> Fancy for Option<T> where T: Iterator {} fn want_fancy<F>(f: F) where F: Fancy {} fn example() { want_fancy(Some(5)); // (BEFORE) ^^^^^^^ `{integer}` is not an iterator // (AFTER) ^ `{integer}` is not an iterator } ``` I had used a (slightly more complex) example as an illustrative example in #108254 , but hadn't actually turned it into a test, because I had (incorrectly) believed at the time it was covered by existing behavior. It turns out that `Some` is slightly "special" in that it resolves differently from the other `enum` constructors I had tried, and therefore this test was actually broken. I've now updated the tests to include this example, and fixed the code to correctly resolve the `Some` constructor so that the span of the error is reduced.
2023-03-02Fix array-size-threshold config deserialization errorAlex Macleod-0/+40
2023-03-02Add simple trait testSantiago Pastorino-0/+11
2023-03-02Fix another ICE in point_at_expr_source_of_inferred_typeMichael Goulet-0/+26
2023-03-02Make `ExprKind` the first field in `thir::Expr`Nilstrieb-9/+9
This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2023-03-02Auto merge of #108654 - LeSeulArtichaut:revert-99767, r=compiler-errorsbors-58/+119
Revert stabilization of `#![feature(target_feature_11)]` This reverts #99767 due to the presence of bugs #108645 and #108646. cc `@joshtriplett` cc tracking issue #69098 r? `@ghost`
2023-03-02Auto merge of #108640 - matthiaskrgr:rollup-rii4t5t, r=matthiaskrgrbors-9/+147
Rollup of 5 pull requests Successful merges: - #108516 (Restrict `#[rustc_box]` to `Box::new` calls) - #108575 (Erase **all** regions when probing for associated types on ambiguity in astconv) - #108585 (Run compiler test suite in parallel on Fuchsia) - #108606 (Add test case for mismatched open/close delims) - #108609 (Highlight whole expression for E0599) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-02Revert "Stabilize `#![feature(target_feature_11)]`"Léo Lanteri Thauvin-58/+119
This reverts commit b379d216eefaba083a0627b1724d73f99d4bdf5c.
2023-03-02Add GUI test for rustdoc search errors backgroundGuillaume Gomez-2/+41
2023-03-02Rollup merge of #108609 - clubby789:e0599-highlight, r=estebankMatthias Krüger-9/+21
Highlight whole expression for E0599 Fixes #108603 This adds a secondary label to highlight the whole expression leading to the error. It also prevents empty labels being recognised as 'unexpected' by compiletest - otherwise, tests with NOTE annotations would pick up empty labels. `@rustbot` label +A-diagnostics