about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2020-10-25Merge remote-tracking branch 'upstream/master' into box-allocTim Diekmann-197/+362
2020-10-24Rollup merge of #78072 - Nadrieril:cleanup-constant-matching, r=varkorJonas Schievink-50/+0
Cleanup constant matching in exhaustiveness checking This supercedes https://github.com/rust-lang/rust/pull/77390. I made the `Opaque` constructor work. I have opened two issues https://github.com/rust-lang/rust/issues/78071 and https://github.com/rust-lang/rust/issues/78057 from the discussion we had on the previous PR. They are not regressions nor directly related to the current PR so I thought we'd deal with them separately. I left a FIXME somewhere because I didn't know how to compare string constants for equality. There might even be some unicode things that need to happen there. In the meantime I preserved previous behavior. EDIT: I accidentally fixed #78071
2020-10-24Rollup merge of #77930 - estebank:ice-77919, r=eddybJonas Schievink-0/+59
Do not ICE with TraitPredicates containing [type error] Fix #77919.
2020-10-24Add some regression testsAlex Macleod-0/+134
Closes #56229 Closes #59494 Closes #70746 Closes #73229
2020-10-23Do not ICE with TraitPredicates containing [type error]Esteban Küber-0/+59
Fix #77919.
2020-10-23Auto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnrbors-36/+20
passes: `check_attr` on more targets This PR modifies `check_attr` so that: - Enum variants are now checked (some attributes would not have been prohibited on variants previously). - `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. This means that codegen attribute errors aren't shown if there are other errors first (e.g. from other attributes, as shown in `src/test/ui/macros/issue-68060.rs` changes below).
2020-10-23Rollup merge of #78263 - JohnTitor:mir-opt-ice-test, r=lcnrYuki Okushi-0/+4
Add regression test of issue-77668 Closes #77668
2020-10-23Rollup merge of #77488 - varkor:repr128-incomplete_features, r=jonas-schievinkYuki Okushi-0/+12
Mark `repr128` as `incomplete_features` As mentioned in https://github.com/rust-lang/rust/issues/56071 and noticed in https://github.com/rust-lang/rust/issues/77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it. Closes https://github.com/rust-lang/rust/issues/77457.
2020-10-23Make it regression test of issue-77668Yuki Okushi-0/+4
2020-10-21Mark `repr128` as `incomplete_features`varkor-0/+12
2020-10-21Auto merge of #78077 - petrochenkov:qvis, r=davidtwcobors-3/+3
Calculate visibilities once in resolve Then use them through a query based on resolver outputs. Item visibilities were previously calculated in three places - initially in `rustc_resolve`, then in `rustc_privacy` during type privacy checkin, and then in `rustc_metadata` during metadata encoding. The visibility logic is not entirely trivial, especially for things like constructors or enum variants, and all of it was duplicated. This PR deduplicates all the visibility calculations, visibilities are determined once during early name resolution and then stored in `ResolverOutputs` and are later available through `tcx` as a query `tcx.visibility(def_id)`. (This query existed previously, but only worked for other crates.) Some special cases (e.g. visibilities for closure types, which are needed for type privacy checking) are not processed in resolve, but deferred and performed directly in the query instead.
2020-10-21Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebankYuki Okushi-6/+6
Improve wording of "cannot multiply" type error For example, if you had this code: fn foo(x: i32, y: f32) -> f32 { x * y } You would get this error: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` However, that's not usually how people describe multiplication. People usually describe multiplication like how the division error words it: error[E0277]: cannot divide `i32` by `f32` --> src/lib.rs:2:7 | 2 | x / y | ^ no implementation for `i32 / f32` | = help: the trait `Div<f32>` is not implemented for `i32` So that's what this change does. It changes this: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` To this: error[E0277]: cannot multiply `i32` by `f32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32`
2020-10-21Rollup merge of #78002 - estebank:issue-77598, r=oli-obkYuki Okushi-59/+96
Tweak "object unsafe" errors CC #77598.
2020-10-20Rollup merge of #78061 - wesleywiser:opt_zst_const_interning, r=oli-obkGuillaume Gomez-0/+5
Optimize const value interning for ZST types Interning can skip any inhabited ZST type in general. Fixes #68010 r? @oli-obk
2020-10-20review commentsEsteban Küber-17/+17
2020-10-20Tweak "object unsafe" errorsEsteban Küber-56/+93
Fix #77598.
2020-10-20Rollup merge of #78121 - LeSeulArtichaut:issue-78115, r=tmandryYuki Okushi-0/+19
Do not ICE on pattern that uses a binding multiple times in generator Fixes #78115. r? @tmandry
2020-10-20Rollup merge of #78111 - SNCPlay42:not-always-self, r=lcnrYuki Okushi-30/+20
Trait predicate ambiguities are not always in `Self` When reporting ambiguities in trait predicates, the compiler incorrectly assumed the ambiguity was always in the type the trait should be implemented on, and never the generic parameters of the trait. This caused silly suggestions for predicates like `<KnownType as Trait<_>>`, such as giving explicit types to completely unrelated variables that happened to be of type `KnownType`. This also reverts #73027, which worked around this issue in some cases and does not appear to be necessary any more. fixes #77982 fixes #78055
2020-10-19Add regression testLeSeulArtichaut-0/+19
2020-10-19revert workaround #73027SNCPlay42-11/+6
2020-10-19don't assume trait ambiguity happens in `Self`SNCPlay42-19/+14
2020-10-19Calculate visibilities once in resolveVadim Petrochenkov-3/+3
Then use them through a query based on resolver outputs
2020-10-19Auto merge of #77278 - camelid:use-correct-article, r=estebankbors-2/+2
Use correct article in help message for conversion or cast Before it always used `an`; now it uses the correct article for the type.
2020-10-18Add some testsNadrieril-50/+0
2020-10-17Improve wording of "cannot multiply" type errorCamelid-6/+6
For example, if you had this code: fn foo(x: i32, y: f32) -> f32 { x * y } You would get this error: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` However, that's not usually how people describe multiplication. People usually describe multiplication like how the division error words it: error[E0277]: cannot divide `i32` by `f32` --> src/lib.rs:2:7 | 2 | x / y | ^ no implementation for `i32 / f32` | = help: the trait `Div<f32>` is not implemented for `i32` So that's what this change does. It changes this: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` To this: error[E0277]: cannot multiply `i32` by `f32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32`
2020-10-17Make it more clear when complaining about async fn's return typesGus Wynn-0/+63
2020-10-17Optimize const value interning for ZST typesWesley Wiser-0/+5
Interning can skip any inhabited ZST type in general.
2020-10-18Rollup merge of #78048 - blyxxyz:e0424-improve-self-placement, r=lcnrYuki Okushi-1/+19
Suggest correct place to add `self` parameter when inside closure It would incorrectly suggest adding it as a parameter to the closure instead of the containing function. [For example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1936bcd1e5f981573386e0cee985c3c0): ``` help: add a `self` receiver parameter to make the associated `fn` a method | 5 | let _ = || self&self; | ^^^^^ ``` `DiagnosticMetadata.current_function` is only used for these messages so tweaking its behavior should be ok.
2020-10-18Rollup merge of #78043 - willcrozi:e0210-error-note-fix, r=lcnrYuki Okushi-1/+1
Fix grammar in note for orphan-rule error [E0210] Fixes the grammar in the error note for [E0210] from: _"= note: implementing a foreign trait is only possible if at least one of the types for which **is it** implemented is local"_ to: _"= note: implementing a foreign trait is only possible if at least one of the types for which **it is** implemented is local"_ The content of this commit is the result of running the following command at the repository root: `find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/which is it implemented/which it is implemented/g'`
2020-10-17Suggest correct place to add `self` parameter when inside closureJan Verbeek-1/+19
It would incorrectly suggest adding it as a parameter to the closure instead of the containing function.
2020-10-17Fix grammar in note for orphan-rule error [E0210]Will Crozier-1/+1
2020-10-17Rollup merge of #77925 - JohnTitor:sugg-min-features, r=davidtwco,oli-obkYuki Okushi-0/+3
Suggest minimal subset features in `incomplete_features` lint This tells users that we have a minimal subset feature of it and they can fix the lint warning without allowing it. The wording improvement is helpful :) Fixes #77913
2020-10-17Rollup merge of #77855 - ↵Yuki Okushi-9/+93
davidtwco:pr-77341-follow-up-non-constructable-variants, r=estebank resolve: further improvements to "try using the enum's variant" diagnostic Follow-up on https://github.com/rust-lang/rust/pull/77341#issuecomment-702738281. This PR improves the diagnostic modified in #77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). In addition, the wording of the tuple-variant-only case is improved slightly. I've not made further changes to the tuple-variant-only case (e.g. to only suggest variants with the correct number of fields) because I don't think I have enough information to do so reliably (e.g. in the case where there is an attempt to construct a tuple variant, I have no information on how many fields were provided; and in the case of pattern matching, I only have a slice of spans and would need to check for things like `..` in those spans, which doesn't seem worth it). r? @estebank
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+3
2020-10-16Merge branch 'master' into box-allocTim Diekmann-16/+134
2020-10-15resolve: improve "try using tuple struct" messageDavid Wood-2/+2
This commit improves the tuple struct case added in rust-lang/rust#77341 so that the context is mentioned in more of the message. Signed-off-by: David Wood <david@davidtw.co>
2020-10-15resolve: suggest variants with placeholdersDavid Wood-7/+91
This commit improves the diagnostic modified in rust-lang/rust#77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). Signed-off-by: David Wood <david@davidtw.co>
2020-10-15ensure arguments are included in count mismatch spanAndy Russell-9/+18
2020-10-07Upgrade to tracing 0.2.13Joshua Nelson-7/+0
The primary motivation is to get the changes from https://github.com/tokio-rs/tracing/pull/990. Example output: ``` $ RUSTDOC_LOG=debug rustdoc +rustc2 warning: some trace filter directives would enable traces that are disabled statically | `debug` would enable the DEBUG level for all targets = note: the static max level is `info` = help: to enable DEBUG logging, remove the `max_level_info` feature ``` - Remove useless test This was testing for an ICE when passing `RUST_LOG=rustc_middle`. I noticed it because it started giving the tracing warning (because tests are not run with debug-logging enabled). Since this bug seems unlikely to re-occur, I just removed it altogether.
2020-10-07Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, ↵bors-0/+116
r=estebank resolve: improve "try using the enum's variant" Fixes #73427. This PR improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation. r? `@estebank`
2020-10-07Support custom allocators in `Box`Tim Diekmann-9/+9
Remove `Box::leak_with_alloc` Add leak-test for box with allocator Rename `AllocErr` to `AllocError` in leak-test Add `Box::alloc` and adjust examples to use the new API
2020-10-06Update to chalk 0.31. Implement some unimplemented. Ignore some tests in ↵Jack Huey-16/+26
compare mode chalk don't finish.
2020-10-06Fix tests from rebaseMatthew Jasper-34/+32
2020-10-06Fix rebaseMatthew Jasper-1/+1
2020-10-06Don't immediately error for recursive projectionsMatthew Jasper-2/+2
2020-10-06Fix bootstrapMatthew Jasper-1/+1
2020-10-06Normalize projection bounds when considering candidatesMatthew Jasper-57/+44
This unfortunately requires some winnowing hacks to avoid now ambiguous candidates.
2020-10-06Ensure that associated types for trait objects satisfy their boundsMatthew Jasper-5/+12
2020-10-06Check projections are well-formed when using projection candidatesMatthew Jasper-42/+0
2020-10-06Separate bounds and predicates for associated/opaque typesMatthew Jasper-139/+46