about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2024-03-05Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelixbors-0/+48
Add a scheme for moving away from `extern "rust-intrinsic"` entirely All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic. This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic. cc https://github.com/rust-lang/rust/issues/63585 follow-up to #120500 MCP at https://github.com/rust-lang/compiler-team/issues/720
2024-03-04Auto merge of #120468 - alexcrichton:start-wasm32-wasi-rename, r=wesleywiserbors-3/+3
Add a new `wasm32-wasip1` target to rustc This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * https://github.com/rust-lang/compiler-team/issues/607 * https://github.com/rust-lang/compiler-team/issues/695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](https://github.com/rust-lang/rust/pull/119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-0/+48
2024-03-04Auto merge of #121964 - matthiaskrgr:rollup-rtcju5m, r=matthiaskrgrbors-0/+99
Rollup of 3 pull requests Successful merges: - #121130 (Suggest moving definition if non-found macro_rules! is defined later) - #121912 (Properly deal with GATs when looking for method chains to point at) - #121927 (Add a proper `with_no_queries` to printing) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-04Rollup merge of #121912 - fmease:diag-method-chains-gat, ↵Matthias Krüger-0/+49
r=compiler-errors,estebank Properly deal with GATs when looking for method chains to point at Fixes #121898. ~~While it prevents an ICE and the structured suggestion is correct, the method chain diagnostic notes are weird / useless / incorrect judging by a quick look. I guess I should improve that in this PR.~~ Sufficiently taken care of. r? estebank or compiler-errors (#105332, #105674).
2024-03-04Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, ↵Matthias Krüger-0/+50
r=matthiaskrgr Suggest moving definition if non-found macro_rules! is defined later Fixes #121061
2024-03-04Auto merge of #121900 - chenyukang:yukang-fix-121425-repr-pack-error, ↵bors-34/+103
r=compiler-errors Fix misleading message in struct repr alignment and packed Fixes #121425 By the way, fix the spans for the argument in the second commit.
2024-03-03Rollup merge of #121749 - jieyouxu:issue-45127-fix, r=petrochenkovMatthias Krüger-14/+126
Don't lint on executable crates with `non_snake_case` names Revives #111130, cc `@GilShoshan94.` Closes #45127.
2024-03-03Rollup merge of #121528 - Alexendoo:unused_qualifications, r=petrochenkovMatthias Krüger-7/+127
Consider middle segments of paths in `unused_qualifications` Currently `unused_qualifications` looks at the last segment of a path to see if it can be trimmed, this PR extends the check to the middle segments also ```rust // currently linted use std::env::args(); std::env::args(); // Removes `std::env::` ``` ```rust // newly linted use std::env; std::env::args(); // Removes `std::` ``` Paths with generics in them are now linted as long as the part being trimmed is before any generic args, e.g. it will now suggest trimming `std::vec::` from `std::vec::Vec<usize>` Paths with any segments that are from an expansion are no longer linted Fixes #100979 Fixes #96698
2024-03-03Move testsCaio-0/+0
2024-03-03Consider middle segments of paths in `unused_qualifications`Alex Macleod-7/+127
2024-03-03Only run lint tests on x86_64-unknown-linux-gnu许杰友 Jieyou Xu (Joe)-13/+17
We're trying to test lint behavior, not per-target crate-type support.
2024-03-03Rollup merge of #121917 - GuillaumeGomez:pattern-complexity_limit.rs, ↵Guillaume Gomez-0/+141
r=Nadrieril Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching Needed for https://github.com/rust-lang/rust-analyzer/issues/9528. This PR adds a new attribute only available when running rust testsuite called `pattern_complexity` which allows to set the maximum recursion for the pattern matching. It is quite useful to ensure the complexity doesn't grow, like in `tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs`. r? `@Nadrieril`
2024-03-03Ignore cdylib test for i686-unknown-linux-musl许杰友 Jieyou Xu (Joe)-0/+1
2024-03-03Add feature gate test for `pattern_complexity` attributeGuillaume Gomez-0/+18
2024-03-03Add and update tests to use `pattern_complexity`Guillaume Gomez-0/+123
2024-03-03Auto merge of #121877 - estebank:fancy-svg, r=compiler-errorsbors-147/+421
On tests that specify `--color=always` emit SVG file with stderr output Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly. <img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-03fix spans of arguments in diagnosticyukang-33/+33
2024-03-03Properly deal with GATs when looking for method chains to point atLeón Orell Valerian Liehr-0/+49
2024-03-02On tests that specify --color=always emit SVG file with stderr outputEsteban Kuber-147/+421
Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.
2024-03-02Rollup merge of #121731 - oli-obk:eager_opaque_checks, r=compiler-errorsGuillaume Boisseau-2/+35
Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore r? `@compiler-errors` one bubble down, two more to go the test is unrelated, just something I noticed would be good to test in both the old solver and the new.
2024-03-02Rollup merge of #121716 - Nadrieril:simple-binding-order, r=matthewjasperGuillaume Boisseau-0/+48
match lowering: Lower bindings in a predictable order After the recent refactorings, we can now lower bindings in a truly predictable order. The order in https://github.com/rust-lang/rust/pull/120214 was an improvement but not very clear. With this PR, we lower bindings from left to right, with the special case that `x @ pat` is traversed as `pat @ x` (i.e. `x` is lowered after any bindings in `pat`). This description only applies in the absence of or-patterns. Or-patterns make everything complicated, because the binding place depends on the subpattern. Until I have a better idea I leave them to be handled in whatever weird order arises from today's code. r? `@matthewjasper`
2024-03-02Rollup merge of #120761 - rcvalle:rust-dfsan, r=nikicGuillaume Boisseau-1/+566
Add initial support for DataFlowSanitizer Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-02Add a new `wasm32-wasip1` target to rustcAlex Crichton-3/+3
This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * https://github.com/rust-lang/compiler-team/issues/607 * https://github.com/rust-lang/compiler-team/issues/695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](https://github.com/rust-lang/rust/pull/119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
2024-03-02Fix misleading message when using a named constant as a struct alignment/packyukang-10/+79
2024-03-02Ignore wasm in dylib/proc-macro crate type tests许杰友 Jieyou Xu (Joe)-4/+6
2024-03-02Auto merge of #121890 - matthiaskrgr:rollup-mv26uwt, r=matthiaskrgrbors-4/+46
Rollup of 9 pull requests Successful merges: - #109263 (fix typo in documentation for std::fs::Permissions) - #120684 (Update E0716.md for clarity) - #121715 (match lowering: pre-simplify or-patterns too) - #121739 (Display short types for unimplemented trait) - #121815 (Move `gather_comments`.) - #121835 (Move `HandleStore` into `server.rs`.) - #121847 (Remove hidden use of Global) - #121861 (Use the guaranteed precision of a couple of float functions in docs) - #121875 ( Account for unmet T: !Copy in E0277 message) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-02Rollup merge of #121875 - estebank:e0277-drive-by, r=compiler-errorsMatthias Krüger-4/+4
Account for unmet T: !Copy in E0277 message ``` error[E0277]: the trait bound `T: !Copy` is not satisfied --> $DIR/simple.rs:10:16 | LL | not_copy::<T>(); | ^ the trait bound `T: !Copy` is not satisfied ``` instead of the current ``` error[E0277]: the trait bound `T: !Copy` is not satisfied --> $DIR/simple.rs:10:16 | LL | not_copy::<T>(); | ^ the trait `!Copy` is not implemented for `T` ```
2024-03-02Rollup merge of #121739 - jieyouxu:loooong-typename, r=estebankMatthias Krüger-0/+42
Display short types for unimplemented trait Shortens unimplemented trait diagnostics. Now shows: ``` error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display` --> $DIR/on_unimplemented_long_types.rs:4:17 | LL | pub fn foo() -> impl std::fmt::Display { | ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter LL | LL | / Some(Some(Some(Some(Some(Some(Some(Some(Some(S... LL | | Some(Some(Some(Some(Some(Some(Some(Some(So... LL | | Some(Some(Some(Some(Some(Some(Some(Som... LL | | Some(Some(Some(Some(Some(Some(Some... ... | LL | | ))))))))))), LL | | ))))))))))) | |_______________- return type was inferred to be `Option<Option<Option<...>>>` here | = help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. ``` I'm not 100% sure if this is desirable, or if we should just let the long types remain long. This is also kinda a short-term bandaid solution. The real long term solution is to properly migrate `rustc_trait_selection`'s error reporting to use translatable diagnostics and then properly handle type name printing. Fixes #121687.
2024-03-02Auto merge of #121864 - compiler-errors:type-relating-variances, r=aliemjaybors-0/+31
Don't grab variances in `TypeRelating` relation if we're invariant Since `Invariant.xform(var) = Invariant` always, so just copy what the generalizer relation does. Fixes #110106
2024-03-02Auto merge of #121657 - estebank:issue-119665, r=davidtwcobors-43/+63
Detect more cases of `=` to `:` typo When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span arround and mention it. If the type could continue being parsed as an expression, suggest replacing the `:` with a `=`. ``` error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.` --> file.rs:2:32 | 2 | let _: std::env::temp_dir().join("foo"); | - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=` | | | while parsing the type for `_` | help: use `=` if you meant to assign ``` Fix #119665.
2024-03-01Add initial support for DataFlowSanitizerRamon de C Valle-1/+566
Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-02Account for unmet `T: !Copy` in E0277 messageEsteban Küber-4/+4
2024-03-01Rollup merge of #121811 - ↵Matthias Krüger-1/+1
rcvalle:rust-cfi-move-ui-tests-to-sanitizer-directory, r=compiler-errors Move sanitizer ui tests to sanitizer directory Moves the sanitizer ui tests to the sanitizer directory and removes the sanitizer prefix from tests file names similarly to how the sanitizer codegen tests are organized.
2024-03-01Rollup merge of #121803 - estebank:dont-mention-type-error-e0277, ↵Matthias Krüger-2/+0
r=compiler-errors Never say "`Trait` is implemented for `{type error}`" When a trait bound error occurs, we look for alternative types that would have made the bound succeed. For some reason `{type error}` sometimes would appear as a type that would do so. We now remove `{type error}` from the list in every case to avoid nonsensical `note`s.
2024-03-01Rollup merge of #121497 - lcnr:coherence-suggest-increasing-recursion-limit, ↵Matthias Krüger-68/+7
r=compiler-errors `-Znext-solver=coherence`: suggest increasing recursion limit r? `@compiler-errors`
2024-03-01Rollup merge of #121153 - chenyukang:yukang-fix-105431-type-mismatch, r=estebankMatthias Krüger-0/+205
Suggest removing superfluous semicolon when statements used as expression Fixes #105431 - it's not a pure recursive visitor, so I guess there may be some more complex scenarios not covered. - moved `consider_removing_semicolon` to `compiler/rustc_infer` for reusing this helper function.
2024-03-01Rollup merge of #120305 - clubby789:unused-import-line, r=estebankMatthias Krüger-12/+56
Delete line if suggestion would replace it with an empty line Fixes #120296
2024-03-01Rollup merge of #111505 - GuillaumeGomez:turn-invalid-doc-attr-into-err, ↵Matthias Krüger-90/+18
r=rustdoc Made `INVALID_DOC_ATTRIBUTES` lint deny by default Fixes https://github.com/rust-lang/rust/issues/82730. # Explanations The `INVALID_DOC_ATTRIBUTES` lint was marked as "will become a hard error into the future" for quite some time so making it `deny` by default. <del>Waiting on https://github.com/rust-lang/backtrace-rs/pull/524 for now.</del>
2024-03-01Avoid silently writing to a file when the involved ty is long许杰友 Jieyou Xu (Joe)-0/+2
2024-03-01Don't grab variances if we're invariantMichael Goulet-0/+31
2024-03-01Rollup merge of #121853 - lcnr:normalizes_to-polarity, r=compiler-errorsMatthias Krüger-0/+22
normalizes-to: handle negative impls necessary to build the stage 2 compiler in #121848 :grin: r? `@compiler-errors`
2024-03-01Rollup merge of #121819 - nnethercote:fix-121812, r=oli-obkMatthias Krüger-0/+17
Handle stashing of delayed bugs By just emitting them immediately, because it does happen in practice, when errors are downgraded to delayed bugs. We already had one case in `lint.rs` where we handled this at the callsite. This commit changes things so it's handled within `stash_diagnostic` instead, because #121812 identified a second case, and it's possible there are more. Fixes #121812. r? ````@oli-obk````
2024-03-01Rollup merge of #121580 - Suyashtnt:issue-121502-fix, r=michaelwoeristerMatthias Krüger-6/+6
make unused_imports less assertive in test modules closes #121502 This is a fairly small change and I used the fix suggested in the example expected error message. Not sure if I should've rather used the alternatives but this one seems the most descriptive. Some alternatives: - if this is meant to be a test module, add `#[cfg(test)]` to the containing module - try adding #[cfg(test)] to this test module - consider adding #[allow(unused_imports)] if you want to silent the lint on the unused import - consider removing the unused import
2024-03-01Rollup merge of #121475 - jieyouxu:tidy-stderr-check, r=the8472,compiler-errorsMatthias Krüger-595/+0
Add tidy check for .stderr/.stdout files for non-existent test revisions Closes #77498.
2024-03-01Rollup merge of #121416 - veera-sivarajan:bugfix-120785, r=nnethercoteMatthias Krüger-0/+38
Improve error messages for generics with default parameters Fixes #120785 Issue: Previously, all type parameters with default types were deliberately ignored to simplify error messages. For example, an error message for Box type would display `Box<T>` instead of `Box<T, _>`. But, this resulted in unclear error message when a concrete type was used instead of the default type. Fix: This PR fixes it by checking if a concrete type is specified after a default type to display the entire type name or the simplified type name.
2024-03-01Rollup merge of #120646 - clubby789:uninit-destructuring-sugg, ↵Matthias Krüger-1/+49
r=michaelwoerister Fix incorrect suggestion for uninitialized binding in pattern Fixes #120634
2024-03-01normalizes-to: handle negative implslcnr-0/+22
2024-03-01If suggestion would leave an empty line, delete itclubby789-12/+56
2024-03-01Auto merge of #121462 - compiler-errors:eq-and-sub, r=lcnrbors-8/+11
Combine `Sub` and `Equate` Combine `Sub` and `Equate` into a new relation called `TypeRelating` (that name sounds familiar...) Tracks the difference between `Sub` and `Equate` via `ambient_variance: ty::Variance` much like the `NllTypeRelating` relation, but implemented slightly jankier because it's a more general purpose relation. r? lcnr