about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2022-05-22Rollup merge of #97043 - c410-f3r:z-errors, r=petrochenkovJack Huey-324/+0
Move some tests to more reasonable directories r? `@petrochenkov`
2022-05-20Rollup merge of #97109 - ↵Matthias Krüger-0/+6
TaKO8Ki:fix-misleading-cannot-infer-type-for-type-parameter-error, r=oli-obk Fix misleading `cannot infer type for type parameter` error closes #93198
2022-05-20report ambiguous type parameters when their parents are impl or fnTakayuki Maeda-0/+6
fix ci error emit err for `impl_item`
2022-05-20Move testsCaio-324/+0
2022-05-20Auto merge of #97027 - cuviper:yesalias-refcell, r=thomccbors-0/+36
Use pointers in `cell::{Ref,RefMut}` to avoid `noalias` When `Ref` and `RefMut` were based on references, they would get LLVM `noalias` attributes that were incorrect, because that alias guarantee is only true until the guard drops. A `&RefCell` on the same value can get a new borrow that aliases the previous guard, possibly leading to miscompilation. Using `NonNull` pointers in `Ref` and `RefCell` avoids `noalias`. Fixes the library side of #63787, but we still might want to explore language solutions there.
2022-05-18Rollup merge of #96378 - compiler-errors:trait-upcast-error, r=nagisaDylan DPC-1/+2
Mention traits and types involved in unstable trait upcasting Fixes #95972 by printing the traits being upcasted and the types being coerced that cause that upcasting... --- the poor span mentioned in the original issue has nothing to do with trait upcasting diagnostic here... > The original example I had that made me run into this issue had an even longer expression there (multiple chained iterator methods) which just got all highlighted as one big block saying "somewhere here trait coercion is used and it's not allowed". I don't think I can solve that issue in general without fixing the ObligationCauseCode and span that gets passed into Coerce.
2022-05-17Mention traits being upcasted, types being coercedMichael Goulet-1/+2
2022-05-17better error for bad LHS in binop-assignMichael Goulet-5/+0
2022-05-15rustc: Stricter checking for #[link] attributesVadim Petrochenkov-6/+6
2022-05-13Test RefCell aliasingJosh Stone-0/+36
2022-05-12Add tests.Camille GILLOT-0/+2
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-4/+13
2022-05-08Move some tests to more reasonable placesCaio-174/+0
2022-05-06Resolve vars before emitting coerce suggestions tooJack Huey-0/+8
2022-05-06Auto merge of #96268 - ↵bors-14/+2
jackh726:remove-mutable_borrow_reservation_conflict-lint, r=nikomatsakis Remove mutable_borrow_reservation_conflict lint and allow the code pattern This was the only breaking issue with the NLL stabilization PR. Lang team decided to go ahead and allow this. r? `@nikomatsakis` Closes #59159 Closes #56254
2022-05-02Auto merge of #96600 - c410-f3r:z-errors, r=petrochenkovbors-525/+0
Move some tests to more reasonable places cc https://github.com/rust-lang/rust/issues/73494 r? `@petrochenkov` 16602 -> `codegen` because of https://github.com/rust-lang/rust/issues/16602#issuecomment-53806665
2022-05-01Move some tests to more reasonable placesCaio-525/+0
2022-04-30Bless the UI testsScott McMurray-1/+3
2022-04-30Bless tests.Camille GILLOT-2/+11
2022-04-27Auto merge of #96371 - c410-f3r:z-errors, r=petrochenkovbors-341/+0
Move some tests to more reasonable places cc https://github.com/rust-lang/rust/issues/73494 r? `@petrochenkov`
2022-04-26Move some tests to more reasonable placesCaio-341/+0
2022-04-27Auto merge of #96459 - Dylan-DPC:rollup-de6ud9d, r=Dylan-DPCbors-8/+14
Rollup of 6 pull requests Successful merges: - #92569 (Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts) - #96370 (Cleanup `report_method_error` a bit) - #96383 (Fix erased region escaping into wfcheck due to #95395) - #96385 (Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL) - #96410 (rustdoc: do not write `{{root}}` in `pub use ::foo` docs) - #96430 (Fix handling of `!` in rustdoc search) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-27Rollup merge of #96385 - ↵Dylan DPC-0/+5
marmeladema:nll-fix-trait-lifetime-bound-suggestions, r=jackh726 Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL This is done by replacing the duplicated (and very partial) implementation from borrowck with one inspsired from `NiceRegionError::try_report_static_impl_trait` and by re-using `suggest_new_region_bound`. Fixes #96277 r? ```@jackh726```
2022-04-26Auto merge of #96425 - oli-obk:fix_incremental_regression_unsafety_checking, ↵bors-3/+3
r=compiler-errors Fix incremental perf regression unsafety checking Perf regression introduced in #96294 We will simply avoid emitting the name of the unsafe function in MIR unsafeck, since we're moving to THIR unsafeck anyway.
2022-04-26Add new diagnosticGeorge-8/+9
2022-04-26Revert "add `DefId` to unsafety violations and display function path in E0133"Oli Scherer-3/+3
This reverts commit 8b8f6653cfd54525714f02efe7af0a0f830e185c.
2022-04-26Auto merge of #94034 - willcrichton:fix-trait-suggestion-for-binops, r=estebankbors-3/+3
Fix incorrect suggestion for trait bounds involving binary operators This PR fixes #93927, #92347, #93744 by replacing the bespoke trait-suggestion logic in `op.rs` with a more common code path. The downside is that this fix causes some suggestions to not include an `Output=` type, reducing their usefulness. Note that this causes one case in the `missing-bounds.rs` test to fail rustfix. So I would need to move that code into a separate non-fix test if this PR is otherwise acceptable.
2022-04-25Replace suggest_constraining_param with suggest_restricting_param_boundWill Crichton-3/+3
to fix incorrect suggestion for trait bounds involving binary operators. Fixes #93927, #92347, #93744.
2022-04-25Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLLmarmeladema-0/+5
2022-04-24only show a simple description in E0133 span labelEmil Gardström-6/+6
2022-04-24add `DefId` to unsafety violations and display function path in E0133Emil Gardström-12/+12
this enables consumers to access the function definition that was reported to be unsafe
2022-04-22Auto merge of #96144 - c410-f3r:z-errors, r=petrochenkovbors-293/+0
Move some tests to more reasonable places cc #73494 r? `@petrochenkov`
2022-04-21Move some tests to more reasonable directoriesCaio-293/+0
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-14/+2
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-1/+5
2022-04-17Bless tests.Camille GILLOT-21/+25
2022-04-16Implementation for 65853Jack Huey-67/+249
This attempts to bring better error messages to invalid method calls, by applying some heuristics to identify common mistakes. The algorithm is inspired by Levenshtein distance and longest common sub-sequence. In essence, we treat the types of the function, and the types of the arguments you provided as two "words" and compute the edits to get from one to the other. We then modify that algorithm to detect 4 cases: - A function input is missing - An extra argument was provided - The type of an argument is straight up invalid - Two arguments have been swapped - A subset of the arguments have been shuffled (We detect the last two as separate cases so that we can detect two swaps, instead of 4 parameters permuted.) It helps to understand this argument by paying special attention to terminology: "inputs" refers to the inputs being *expected* by the function, and "arguments" refers to what has been provided at the call site. The basic sketch of the algorithm is as follows: - Construct a boolean grid, with a row for each argument, and a column for each input. The cell [i, j] is true if the i'th argument could satisfy the j'th input. - If we find an argument that could satisfy no inputs, provided for an input that can't be satisfied by any other argument, we consider this an "invalid type". - Extra arguments are those that can't satisfy any input, provided for an input that *could* be satisfied by another argument. - Missing inputs are inputs that can't be satisfied by any argument, where the provided argument could satisfy another input - Swapped / Permuted arguments are identified with a cycle detection algorithm. As each issue is found, we remove the relevant inputs / arguments and check for more issues. If we find no issues, we match up any "valid" arguments, and start again. Note that there's a lot of extra complexity: - We try to stay efficient on the happy path, only computing the diagonal until we find a problem, and then filling in the rest of the matrix. - Closure arguments are wrapped in a tuple and need to be unwrapped - We need to resolve closure types after the rest, to allow the most specific type constraints - We need to handle imported C functions that might be variadic in their inputs. I tried to document a lot of this in comments in the code and keep the naming clear.
2022-04-12Don't test -Cdefault-linker-libraries=yes when cross compiling.Mara Bos-0/+1
2022-04-11Auto merge of #95758 - compiler-errors:issue-54771, r=estebankbors-1/+1
Only suggest removing semicolon when expression is compatible with `impl Trait` https://github.com/rust-lang/rust/issues/54771#issuecomment-476423690 > It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there. Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?). cc #54771
2022-04-10only suggest removing semicolon when expr implements traitMichael Goulet-1/+1
2022-04-10--bless testsMaybe Waffle-0/+5
2022-04-05Rollup merge of #95654 - notriddle:notriddle/issue-95616, r=davidtwcoDylan DPC-3/+3
diagnostics: use correct span for const generics Fixes #95616
2022-04-05Rollup merge of #95525 - ohno418:suggest-derivable-trait-E0277, ↵Dylan DPC-0/+12
r=compiler-errors Suggest derivable trait on E0277 error Closes https://github.com/rust-lang/rust/issues/95099 .
2022-04-05Suggest derivable trait on E0277ohno418-0/+12
2022-04-05Rollup merge of #95603 - compiler-errors:dyn-return, r=oli-obkDylan DPC-1/+1
Fix late-bound ICE in `dyn` return type suggestion This fixes the root-cause of the attached issues -- the root problem is that we're using the return type from a signature with late-bound instead of early-bound regions. The change on line 1087 (`let Some(liberated_sig) = typeck_results.liberated_fn_sigs().get(fn_hir_id) else { return false; };`) makes sure we're grabbing the _right_ return type for this suggestion to check the `dyn` predicates with. Fixes #91801 Fixes #91803 This fix also includes some drive-by changes, specifically: 1. Don't suggest boxing when we have `-> dyn Trait` and are already returning `Box<T>` where `T: Trait` (before we always boxed the value). 2. Suggestion applies even when the return type is a type alias (e.g. `type Foo = dyn Trait`). This does cause the suggestion to expand to the aliased type, but I think it's still beneficial. 3. Split up the multipart suggestion because there's a 6-line max in the printed output... I am open to splitting out the above changes, if we just want to fix the ICE first. cc: ```@terrarier2111``` and #92289
2022-04-05Rollup merge of #91873 - estebank:mention-impls-for-unsatisfied-trait, ↵Dylan DPC-2/+55
r=davidtwco Mention implementers of unsatisfied trait When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` ``` error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:5 | LL | f1(2u32, 4u32); | ^^ the trait `Foo` is not implemented for `u32` | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `f1` --> $DIR/associated-types-path-2.rs:13:14 | LL | pub fn f1<T: Foo>(a: T, x: T::A) {} | ^^^ required by this bound in `f1` ``` Suggest dereferencing in more cases. Fix #87437, fix #90970.
2022-04-04Refer to the TraitRef::identity in the message to be clearerEsteban Kuber-4/+4
2022-04-04Dedup logic and improve output for other types that impl traitEsteban Kuber-17/+17
2022-04-04Fix list lengthEsteban Kuber-0/+20
2022-04-04Fix #90970, doesn't address #87437Esteban Kuber-0/+1