about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2022-08-21Rework point-at-argMichael Goulet-38/+106
2022-08-20Rollup merge of #100617 - chenyukang:fix-100605, r=compiler-errorsMatthias Krüger-0/+55
Suggest the right help message for as_ref Fixes #100605
2022-08-20Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errorsMatthias Krüger-0/+3
suggest `once_cell::Lazy` for non-const statics Addresses https://github.com/rust-lang/rust/issues/100410 Some questions: - removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case: ```rust const FOO: Foo = non_const_fn(); ``` Should we suggest `once_cell` in this case as well? - The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?
2022-08-20Suggest the right help message for as_refyukang-0/+55
2022-08-19Auto merge of #100740 - Dylan-DPC:rollup-0td6yq4, r=Dylan-DPCbors-2/+2
Rollup of 9 pull requests Successful merges: - #99576 (Do not allow `Drop` impl on foreign fundamental types) - #100081 (never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn)) - #100208 (make NOP dyn casts not require anything about the vtable) - #100494 (Cleanup rustdoc themes) - #100522 (Only check the `DefId` for the recursion check in MIR inliner.) - #100592 (Manually implement Debug for ImportKind.) - #100598 (Don't fix builtin index when Where clause is found) - #100721 (Add diagnostics lints to `rustc_type_ir` module) - #100731 (rustdoc: count deref and non-deref as same set of used methods) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-19Auto merge of #100209 - cjgillot:source-file-index, r=estebankbors-5/+5
Lazily decode SourceFile from metadata Currently, source files from foreign crates are decoded up-front from metadata. Spans from those crates were matched with the corresponding source using binary search among those files. This PR changes the strategy by matching spans to files during encoding. This allows to decode source files on-demand, instead of up-front. The on-disk format for spans becomes: `<tag> <position from start of file> <length> <file index> <crate (if foreign file)>`.
2022-08-19Catch overflow earlyouz-a-6/+1
2022-08-19Rollup merge of #99576 - compiler-errors:foreign-fundamental-drop-is-bad, ↵Dylan DPC-2/+2
r=TaKO8Ki Do not allow `Drop` impl on foreign fundamental types `Drop` should not be implemented on `Pin<T>` even if `T` is local. This does not trigger regular orphan rules is because `Pin` is `#[fundamental]`... but we don't allow specialized `Drop` impls anyways, so these rules are not sufficient to prevent this impl on stable. Let's just choose even stricter rules, since we shouldn't be implementing `Drop` on a foreign ADT ever. Fixes #99575
2022-08-18Reword "Required because of the requirements on the impl of ..."Andy Wang-22/+22
2022-08-17implied_bounds: clarify our assumptionslcnr-11/+36
2022-08-16Do not allow Drop impl on foreign fundamental typesMichael Goulet-2/+2
2022-08-15Fix #95079 by adding help and suggestion for missing move in nested closureYan Chen-0/+8
2022-08-14suggest lazy-static for non-const staticscameron-0/+3
2022-08-13Rollup merge of #100479 - compiler-errors:argument-type-error-improvements, ↵Michael Goulet-4/+6
r=lcnr Argument type error improvements Motivated by this interesting code snippet: ```rust #[derive(Copy, Clone)] struct Wrapper<T>(T); fn foo(_: fn(i32), _: Wrapper<i32>) {} fn f(_: u32) {} fn main() { let w = Wrapper::<isize>(1isize); foo(f, w); } ``` Which currently errors like: ``` error[E0308]: arguments to this function are incorrect --> src/main.rs:10:5 | 10 | foo(f, w); | ^^^ - - expected `i32`, found `isize` | | | expected `i32`, found `u32` | = note: expected fn pointer `fn(i32)` found fn item `fn(u32) {f}` = note: expected struct `Wrapper<i32>` found struct `Wrapper<isize>` note: function defined here --> src/main.rs:4:4 | 4 | fn foo(_: fn(i32), _: Wrapper<i32>) {} | ^^^ ---------- --------------- ``` Specifically, that double `expected .. found ..` which is very difficult to correlate to the types in the arguments. Also, the fact that "expected `i32`, found `isize`" and the other argument mismatch label don't even really explain what's going on here. After this PR: ``` error[E0308]: arguments to this function are incorrect --> $DIR/two-mismatch-notes.rs:10:5 | LL | foo(f, w); | ^^^ | note: expected fn pointer, found fn item --> $DIR/two-mismatch-notes.rs:10:9 | LL | foo(f, w); | ^ = note: expected fn pointer `fn(i32)` found fn item `fn(u32) {f}` note: expected struct `Wrapper`, found a different struct `Wrapper` --> $DIR/two-mismatch-notes.rs:10:12 | LL | foo(f, w); | ^ = note: expected struct `Wrapper<i32>` found struct `Wrapper<isize>` note: function defined here --> $DIR/two-mismatch-notes.rs:4:4 | LL | fn foo(_: fn(i32), _: Wrapper<i32>) {} | ^^^ ---------- --------------- error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ``` Yeah, it's a bit verbose, but much clearer IMO. --- Open to discussions about how this could be further improved. Motivated by `@jyn514's` [tweet](https://mobile.twitter.com/joshuayn514/status/1558042020601634816) here.
2022-08-13Rollup merge of #99646 - compiler-errors:arg-mismatch-single-arg-label, ↵Michael Goulet-1/+1
r=estebank Only point out a single function parameter if we have a single arg incompatibility Fixes #99635
2022-08-13Do not inline non-simple argument type errors into labelsMichael Goulet-4/+6
2022-08-12Point out a single arg if we have a single arg incompatibilityMichael Goulet-1/+1
2022-08-12Rollup merge of #100247 - cjgillot:verify-dyn-trait-alias-defaults, r=lcnrDylan DPC-9/+9
Generalize trait object generic param check to aliases. The current algorithm only checks that `Self` does not appear in defaults for traits. This is not sufficient for trait aliases. This PR moves the check to trait object elaboration, which sees through trait aliases. Fixes https://github.com/rust-lang/rust/issues/82927. Fixes https://github.com/rust-lang/rust/issues/84789.
2022-08-10Generalize trait object generic param check to aliases.Camille GILLOT-9/+9
2022-08-10Rollup merge of #100098 - compiler-errors:field-suggestion-fixups, r=davidtwcoMatthias Krüger-0/+4
Some "this expression has a field"-related fixes Each commit does something different and is worth reviewing, but the final diff from `master..HEAD` contains the sum of the changes to the UI tests, since some commits added UI tests "regressions" which were later removed in other commits. The only change I could see adding on top of this is suppressing `Clone::clone` from the "this expression has a field that has this method" suggestion, since it's so commonly implemented by types that it's not worthwhile suggesting in general.
2022-08-09Rollup merge of #100238 - Bryysen:master, r=cjgillotMatthias Krüger-56/+0
Further improve error message for E0081 Closes #97533
2022-08-08Auto merge of #98863 - compiler-errors:projection-msg, r=estebankbors-20/+21
Implement special-cased projection error message for some common traits Not sure what the best phrasing is, but I feel like these are more clear than the plain `<Type as Iterator>::Output == Type` messages. If this is actually a good idea, are there any other traits this could benefit?
2022-08-08Adjust wordingMichael Goulet-20/+21
2022-08-07Implement special-cased projection error message for some common traitsMichael Goulet-8/+8
2022-08-07Further improve error message for E0081Bryysen-56/+0
Multiple duplicate assignments of the same discriminant are now reported in the samme error. We now point out the incrementation start point for discriminants that are not explicitly assigned that are also duplicates. Removed old test related to E0081 that is now covered by error-codes/E0081.rs. Also refactored parts of the `check_enum` function.
2022-08-07Remove even more box syntax uses from src/testest31-149/+90
Prior work, notably 6550021124451628b1efc60c59284465b109e3aa from #88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. Some tests that are very box syntax specific are not being migrated.
2022-08-06Bless ui tests.Camille GILLOT-5/+5
2022-08-05Rollup merge of #100168 - ↵Dylan DPC-7/+7
WaffleLapkin:improve_diagnostics_for_missing_type_in_a_const_item, r=compiler-errors Improve diagnostics for `const a: = expr;` Adds a suggestion to write a type when there is a colon, but the type is not present. I've also shrunk spans a little, so the suggestions are a little nicer. Resolves #100146 r? `@compiler-errors`
2022-08-05Improve diagnostics for `const a: = expr;`Maybe Waffle-7/+7
2022-08-05Auto merge of #95977 - FabianWolff:issue-92790-dead-tuple, r=estebankbors-32/+39
Warn about dead tuple struct fields Continuation of #92972. Fixes #92790. The language team has already commented on this in https://github.com/rust-lang/rust/pull/92972#issuecomment-1021511970; I have incorporated their requests here. Specifically, there is now a new allow-by-default `unused_tuple_struct_fields` lint (name bikesheddable), and fields of unit type are ignored (https://github.com/rust-lang/rust/pull/92972#issuecomment-1021815408), so error messages look like this: ``` error: field is never read: `1` --> $DIR/tuple-struct-field.rs:6:21 | LL | struct Wrapper(i32, [u8; LEN], String); | ^^^^^^^^^ | help: change the field to unit type to suppress this warning while preserving the field numbering | LL | struct Wrapper(i32, (), String); | ~~ ``` r? `@joshtriplett`
2022-08-03Auto merge of #100064 - RalfJung:disaligned, r=petrochenkovbors-0/+40
fix is_disaligned logic for nested packed structs https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests. Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03fix is_disaligned logic for nested packed structsRalf Jung-0/+40
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-32/+39
2022-08-03Consider privacy more carefully when suggesting accessing fieldsMichael Goulet-8/+0
2022-08-03Suggest expressions' fields even if they're not ADTsMichael Goulet-0/+12
2022-07-28Remove guess_head_span.Camille GILLOT-2/+4
2022-07-26Rollup merge of #99758 - WaffleLapkin:remove_useless_allow, r=Dylan-DPCMatthias Krüger-1/+0
remove useless `#[allow]` in a test The mentioned issue, https://github.com/rust-lang/rust/issues/54586 was fixed 4 years ago :)
2022-07-26remove useless `#[allow]` in a testMaybe Waffle-1/+0
2022-07-25Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkovbors-8/+7
Resolve function lifetime elision on the AST ~Based on https://github.com/rust-lang/rust/pull/97720~ Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST. This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`. This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR. r? `@petrochenkov`
2022-07-25Report elision failures on the AST.Camille GILLOT-8/+7
2022-07-23Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnrGuillaume Gomez-13/+4
Do not resolve associated const when there is no provided value Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted. ---- The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error. This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message. I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system? r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign. This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23Rollup merge of #99580 - fmease:fix-issue-99565, r=estebankMatthias Krüger-2/+2
Don't suggest unnameable generic arguments Fixes #99565. `@rustbot` label T-compiler A-diagnostics r? `@rust-lang/wg-diagnostics`
2022-07-22Do not resolve associated const when there is no provided valueMichael Goulet-13/+4
2022-07-22Rollup merge of #99539 - compiler-errors:bidirectional-block-suggestions, ↵Dylan DPC-2/+0
r=fee1-dead Improve suggestions for returning binding Fixes #99525 Also reworks the cause codes for match and if a bit, I think cleaning them up in a positive way. We no longer need to call `could_remove_semicolon` in successful code, which might save a few cycles?
2022-07-22Don't suggest unnameable generic argumentsLeón Orell Valerian Liehr-2/+2
2022-07-21Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-seMatthias Krüger-3/+21
Add `PhantomData` marker for dropck to `BTreeMap` closes #99408
2022-07-21Generalize same_type_modulo_inferMichael Goulet-2/+0
2022-07-19Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, ↵bors-2/+2
r=petrochenkov,GuillaumeGomez Improve the function pointer docs This is #97842 but for function pointers instead of tuples. The concept is basically the same. * Reduce duplicate impls; show `fn (T₁, T₂, …, Tₙ)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html
2022-07-19Improve the function pointer docsMichael Howell-2/+2
* Reduce duplicate impls; show only the `fn (T)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-19Rollup merge of #98028 - aticu:master, r=estebankMatthias Krüger-18/+19
Add E0790 as more specific variant of E0283 Fixes #81701 I think this should be good to go, there are only two things where I am somewhat unsure: - Is there a better way to get the fully-qualified path for the suggestion? I tried `self.tcx.def_path_str`, but that didn't seem to always give a correct path for the context. - Should all this be extracted into it's own method or is it fine where it is? r? `@estebank`