about summary refs log tree commit diff
path: root/tests/ui/issues
AgeCommit message (Collapse)AuthorLines
2023-07-24new unstable option: -Zwrite-long-types-to-diskMahdi Dibaiee-13/+16
This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests. This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/ This means ui tests can fail depending on how long the path to their file is. Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.
2023-07-23make `noop_method_call` warn by defaultDeadbeef-0/+2
2023-07-21Double check that hidden types match the expected hidden typeOli Scherer-49/+0
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-35/+7
2023-07-18added links as a notenxya-7/+7
2023-07-18add links to query documentation for E0391nxya-7/+7
2023-07-18added links as a notenxya-7/+42
2023-07-18add links to query documentation for E0391nxya-7/+7
2023-07-13Rollup merge of #113353 - compiler-errors:select-better, r=lcnrMatthias Krüger-23/+0
Implement selection for `Unsize` for better coercion behavior In order for much of coercion to succeed, we need to be able to deal with partial ambiguity of `Unsize` traits during selection. However, I pessimistically implemented selection in the new trait solver to just bail out with ambiguity if it was a built-in impl: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs#L126 This implements a proper "rematch" procedure for dealing with built-in `Unsize` goals, so that even if the goal is ambiguous, we are able to get nested obligations which are used in the coercion selection-like loop: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_hir_typeck/src/coercion.rs#L702 Second commit just moves a `resolve_vars_if_possible` call to fix a bug where we weren't detecting a trait upcasting to occur. r? ``@lcnr``
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-17/+16
2023-07-08Auto merge of #113491 - matthiaskrgr:rollup-mueqz7h, r=matthiaskrgrbors-27/+27
Rollup of 6 pull requests Successful merges: - #113005 (Don't call `query_normalize` when reporting similar impls) - #113064 (std: edit [T]::swap docs) - #113138 (Add release notes for 1.71.0) - #113217 (resolve typerelative ctors to adt) - #113254 (Use consistent formatting in Readme) - #113482 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-08Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillotMatthias Krüger-27/+27
Don't call `query_normalize` when reporting similar impls Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well. The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions: ``` error[E0277]: the trait bound `[X; 35]: Default` is not satisfied --> /home/gh-compiler-errors/test.rs:4:5 | 4 | <[X; 35] as Default>::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` | = help: the following other types implement trait `Default`: &[T] &mut [T] [T; 32] [T; core::::array::{impl#30}::{constant#0}] [T; core::::array::{impl#31}::{constant#0}] [T; core::::array::{impl#32}::{constant#0}] [T; core::::array::{impl#33}::{constant#0}] [T; core::::array::{impl#34}::{constant#0}] and 27 others ``` So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-08Eagerly resolve vars in predicate during coercion loopMichael Goulet-23/+0
2023-07-07Mark more hanging new-solver testsMichael Goulet-2/+3
2023-07-03update testslcnr-12/+1
2023-06-29Fix type privacy lints error messageBryanskiy-3/+5
2023-06-29Rollup merge of #112670 - petrochenkov:typriv, r=eholkMatthias Krüger-4/+5
privacy: Type privacy lints fixes and cleanups See individual commits. Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-27Don't sort strings right after we just sorted by typesMichael Goulet-27/+27
2023-06-27Rollup merge of #112454 - ferrocene:pa-compiletest-dynamic-linking, r=davidtwcoMatthias Krüger-1/+2
Make compiletest aware of targets without dynamic linking Some parts of the compiletest internals and some tests require dynamic linking to work, which is not supported by all targets. Before this PR, this was handled by if branches matching on the target name. This PR loads whether a target supports dynamic linking or not from the target spec, and adds a `// needs-dynamic-linking` attribute for tests that require it. Note that I was not able to replace all the old conditions based on the target name, as some targets have `dynamic_linking: true` in their spec but pretend they don't have it in compiletest. Also, to get this to work I had to *partially* revert #111472 (cc `@djkoloski` `@tmandry` `@bjorn3).` On one hand, only the target spec contains whether a target supports dynamic linking, but on the other hand a subset of the fields can be overridden through `-C` flags (as far as I'm aware only `-C panic=$strategy`). The solution I came up with is to take the target spec as the base, and then override the panic strategy based on `--print=cfg`. Hopefully that should not break y'all again.
2023-06-26Auto merge of #112887 - WaffleLapkin:become_unuwuable_in_hir, ↵bors-8/+8
r=compiler-errors,Nilstrieb `hir`: Add `Become` expression kind (explicit tail calls experiment) This adds `hir::ExprKind::Become` alongside ast lowering. During hir-thir lowering we currently lower `become` as `return`, so that we can partially test `become` without ICEing. cc `@scottmcm` r? `@Nilstrieb`
2023-06-26`hir`: Add `Become` expression kindMaybe Waffle-8/+8
2023-06-23Rollup merge of #112643 - compiler-errors:sized-obl-for-arg, r=wesleywiserMatthias Krüger-18/+2
Always register sized obligation for argument Removes a "hack" that skips registering sized obligations for parameters that are simple identifiers. This doesn't seem to affect diagnostics because we're probably already being smart enough about deduplicating identical error messages anyways. Fixes #112608
2023-06-22Tweak privacy errors to account for reachable itemsEsteban Küber-2/+6
Suggest publicly accessible paths for items in private mod: When encountering a path in non-import situations that are not reachable due to privacy constraints, search for any public re-exports that the user could use instead. Track whether an import suggestion is offering a re-export. When encountering a path with private segments, mention if the item at the final path segment is not publicly accessible at all. Add item visibility metadata to privacy errors from imports: On unreachable imports, record the item that was being imported in order to suggest publicly available re-exports or to be explicit that the item is not available publicly from any path. In order to allow this, we add a mode to `resolve_path` that will not add new privacy errors, nor return early if it encounters one. This way we can get the `Res` corresponding to the final item in the import, which is used in the privacy error machinery.
2023-06-20add support for needs-dynamic-linkingPietro Albini-1/+2
2023-06-15privacy: Feature gate new type privacy lintsVadim Petrochenkov-4/+5
2023-06-15Extend `unused_must_use` to cover block exprs许杰友 Jieyou Xu (Joe)-2/+2
2023-06-15Always register sized obligation for argumentMichael Goulet-18/+2
2023-06-13Move testMichael Goulet-52/+0
2023-06-13Erase regions even if normalization fails in writebackMichael Goulet-1/+31
2023-06-13Auto merge of #112549 - jieyouxu:fix-tests-for-unit-bindings, r=Nilstriebbors-10/+10
Adjust UI tests for `unit_bindings` lint - Explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Use `let () = init;` or `let pat = ();` where appropriate. - Fix disjoint-capture-in-same-closure test which wasn't actually testing a closure: `tests/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs`. Note that unfortunately there's *a lot* of UI tests, there are a couple of places where I may have left something like `let (): ()` (this is not needed but is left over from an ealier version of the lint) which is bad style. This PR is to help with the `unit_bindings` lint at #112380.
2023-06-12Adjust UI tests for `unit_bindings`许杰友 Jieyou Xu (Joe)-10/+10
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-06-11Auto merge of #111801 - Bryanskiy:lints1, r=petrochenkovbors-2/+30
Private-in-public lints implementation Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-06-12Private-in-public lints implementationBryanskiy-2/+30
2023-06-10Auto merge of #111818 - Urgau:uplift_cmp_nan, r=cjgillotbors-0/+1
Uplift `clippy::cmp_nan` lint This PR aims at uplifting the `clippy::cmp_nan` lint into rustc. ## `invalid_nan_comparisons` ~~(deny-by-default)~~ (warn-by-default) The `invalid_nan_comparisons` lint checks comparison with `f32::NAN` or `f64::NAN` as one of the operand. ### Example ```rust,compile_fail let a = 2.3f32; if a == f32::NAN {} ``` ### Explanation NaN does not compare meaningfully to anything – not even itself – so those comparisons are always false. ----- Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751 `@rustbot` label: +I-lang-nominated r? compiler
2023-06-10Uplift improved version of `clippy::cmp_nan` to rustcUrgau-0/+1
2023-06-09Ignore tests that hang in new solverMichael Goulet-2/+3
2023-06-09Auto merge of #112450 - matthiaskrgr:rollup-fdbazkr, r=matthiaskrgrbors-1/+1
Rollup of 5 pull requests Successful merges: - #112323 (Don't mention already-set fields in struct constructor missing field error) - #112395 (Add Terminator::InlineAsm conversion from MIR to SMIR) - #112411 (add programmerjake to portable-simd cc list) - #112428 (Structurally resolve pointee in `check_pat_lit`) - #112444 (Don't debug-print `Interned` or `PrivateZst`) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-09Rollup merge of #112323 - compiler-errors:dont-mention-set-fields, ↵Matthias Krüger-1/+1
r=WaffleLapkin Don't mention already-set fields in struct constructor missing field error Fixes #111149
2023-06-08Peel borrows before suggesting as_ref/as_derefMichael Goulet-2/+3
2023-06-08More robust as_ref/as_deref suggestionsMichael Goulet-8/+6
2023-06-05Don't mention already set fieldsMichael Goulet-1/+1
2023-06-05Resolve vars in result from scrape_region_constraintsMichael Goulet-2/+4
2023-06-03Auto merge of #111516 - compiler-errors:issue-111500, r=jackh726bors-2/+5
Don't use `can_eq` in `derive(..)` suggestion for missing method Unsatisfied predicates returned from method probe may reference inference vars from that probe, so drop this extra check I added in #110877 for more accurate derive suggestions... Fixes #111500
2023-05-29Rollup merge of #111558 - c410-f3r:t3st3ss, r=WaffleLapkinMatthias Krüger-349/+0
Move tests r? `@petrochenkov`
2023-05-28Auto merge of #111813 - scottmcm:pretty-mir, r=cjgillotbors-4/+2
MIR: opt-in normalization of `BasicBlock` and `Local` numbering This doesn't matter at all for actual codegen, but after spending some time reading pre-codegen MIR, I was wishing I didn't have to jump around so much in reading post-inlining code. So this add two passes that are off by default for every mir level, but can be enabled (`-Zmir-enable-passes=+ReorderBasicBlocks,+ReorderLocals`) for humans.
2023-05-24Move testsCaio-349/+0
2023-05-21Tweak the post-order for multi-successor blocksScott McMurray-4/+2
2023-05-18Simplify suggestion when returning bare dyn traitMichael Goulet-4/+8
2023-05-13Auto merge of #111363 - asquared31415:tidy_no_random_ui_tests, r=fee1-deadbors-7/+6
Add a tidy check to find unexpected files in UI tests, and clean up the results While looking at UI tests, I noticed several weird files that were not being tested, some from even pre-1.0. I added a tidy check that fails if any files not known to compiletest or not used in tests (via manual list) are present in the ui tests. Unfortunately the root entry limit had to be raised by 1 to accommodate the stderr file for one of the tests. r? `@fee1-dead`
2023-05-12Don't use can_eq in derive suggestion for missing methodMichael Goulet-2/+5