about summary refs log tree commit diff
path: root/src/test/ui/error-codes
AgeCommit message (Collapse)AuthorLines
2021-03-24resolve late lifetimes by itemJack Huey-11/+11
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-23Some refactoringvarkor-2/+2
2021-02-25Rollup merge of #82220 - henryboisdequin:fixes-80853, r=varkorDylan DPC-1/+1
fix the false 'defined here' messages Closes #80853. Take this code: ```rust struct S; fn repro_ref(thing: S) { thing(); } ``` Previously, the error message would be this: ``` error[E0618]: expected function, found `S` --> src/lib.rs:4:5 | 3 | fn repro_ref(thing: S) { | ----- `S` defined here 4 | thing(); | ^^^^^-- | | | call expression requires function error: aborting due to previous error ``` This is incorrect as `S` is not defined in the function arguments, `thing` is defined there. With this change, the following is emitted: ``` error[E0618]: expected function, found `S` --> $DIR/80853.rs:4:5 | LL | fn repro_ref(thing: S) { | ----- is of type `S` LL | thing(); | ^^^^^-- | | | call expression requires function | = note: local variable `S` is not a function error: aborting due to previous error ``` As you can see, this error message points out that `thing` is of type `S` and later in a note, that `S` is not a function. This change does seem like a downside for some error messages. Take this example: ``` LL | struct Empty2; | -------------- is of type `Empty2` ``` As you can see, the error message shows that the definition of `Empty2` is of type `Empty2`. Although this isn't wrong, it would be more helpful if it would say something like this (which was there previously): ``` LL | struct Empty2; | -------------- `Empty2` defined here ``` If there is a better way of doing this, where the `Empty2` example would stay the same as without this change, please inform me. **Update: This is now fixed** CC `@camelid`
2021-02-25add helpful error notes and fix the false 'defined here' messagesHenry Boisdequin-1/+1
2021-02-20Make "missing field" error message more naturalr00ster91-3/+3
2021-02-03make const_err a future incompat lintRalf Jung-0/+3
2021-01-26Tweak suggestion for missing field in patternsEsteban Küber-6/+6
Account for parser recovered struct and tuple patterns to avoid invalid suggestion. Follow up to #81103.
2021-01-23Adjust wording of a diagnosticoli-7/+7
2021-01-23Permit mutable references in all const contextsoli-30/+50
2021-01-19Rollup merge of #81147 - estebank:drop-suggestion, r=varkorGuillaume Gomez-5/+26
Fix structured suggestion for explicit `drop` call
2021-01-19Auto merge of #81103 - zackmdavis:comma_trail, r=davidtwcobors-3/+42
don't suggest erroneous trailing comma after `..` In #76612, suggestions were added for missing fields in patterns. However, the suggestions are being inserted just at the end of the last field in the pattern—before any trailing comma after the last field. This resulted in the "if you don't care about missing fields" suggestion to recommend code with a trailing comma after the field ellipsis (`..,`), which is actually not legal ("`..` must be at the end and cannot have a trailing comma")! Incidentally, the doc-comment on `error_unmentioned_fields` was using `you_cant_use_this_field` as an example field name (presumably copy-paste inherited from the description of Issue #76077), but the present author found this confusing, because unmentioned fields aren't necessarily unusable. The suggested code in the diff this commit introduces to `destructuring-assignment/struct_destructure_fail.stderr` doesn't work, but it didn't work beforehand, either (because of the "found reserved identifier `_`" thing), so you can't really call it a regression; it could be fixed in a separate PR. Resolves #78511. r? `@davidtwco` or `@estebank`
2021-01-18Add test case for suggestion E0283Daiki Ihara-2/+32
2021-01-17Fix structured suggestion for explicit `drop` callEsteban Küber-5/+26
2021-01-16don't suggest erroneous trailing comma after `..`Zack M. Davis-3/+42
In #76612, suggestions were added for missing fields in patterns. However, the suggestions are being inserted just at the end of the last field in the pattern—before any trailing comma after the last field. This resulted in the "if you don't care about missing fields" suggestion to recommend code with a trailing comma after the field ellipsis (`..,`), which is actually not legal ("`..` must be at the end and cannot have a trailing comma")! Incidentally, the doc-comment on `error_unmentioned_fields` was using `you_cant_use_this_field` as an example field name (presumably copy-paste inherited from the description of Issue #76077), but the present author found this confusing, because unmentioned fields aren't necessarily unusable. The suggested code in the diff this commit introduces to `destructuring-assignment/struct_destructure_fail.stderr` doesn't work, but it didn't work beforehand, either (because of the "found reserved identifier `_`" thing), so you can't really call it a regression; it could be fixed in a separate PR. Resolves #78511.
2021-01-14Rollup merge of #80017 - camelid:sugg-rest-pattern, r=estebankMara Bos-2/+7
Suggest `_` and `..` if a pattern has too few fields Fixes #80010.
2021-01-13Auto merge of #77524 - Patryk27:fixes/66228, r=estebankbors-17/+44
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-13Update tests for extern block lintingMark Rousskov-19/+17
2021-01-12Always show suggestions in their own subwindowsCamelid-4/+6
2021-01-12Only suggest `..` if more than one field is missingCamelid-10/+4
2021-01-12Specialize `..` help message for all fields vs. the restCamelid-1/+1
2021-01-12Pluralize 'parenthesis' correctlyCamelid-2/+2
It's 'parentheses', not 'parenthesis', when you have more than one.
2021-01-12Suggest `_` and `..` if a pattern has too few fieldsCamelid-0/+9
For example, this code: struct S(i32, f32); let S(x) = S(0, 1.0); will make the compiler suggest either: let S(x, _) = S(0, 1.0); or: let S(x, ..) = S(0, 1.0);
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-17/+44
2021-01-07Use correct span for structured suggestionEsteban Küber-4/+12
On structured suggestion for `let` -> `const` and `const` -> `let`, use a proper `Span` and update tests to check the correct application. Follow up to #80012.
2021-01-07bless testsDaiki Ihara-0/+2
2021-01-03Stylistic fixes to diagnostic messagesoli-1/+1
2021-01-03Refactor the non-transient cell borrow error diagnosticoli-4/+6
2021-01-03Update now-more-precise operation with a preciser messageoli-2/+2
2021-01-01Reinstate the error-code error over the feature gate erroroli-4/+2
2021-01-01Allow references to interior mutable data behind a feature gateoli-4/+15
2020-12-26update testsBastian Kauschke-2/+0
2020-12-19also const-check FakeReadRalf Jung-1/+30
2020-12-06suggestions from camelid reviewEthan Brierley-5/+1
2020-12-06smarter E0390Ethan Brierley-1/+1
2020-12-04 Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`Tim Diekmann-1/+1
2020-12-03Auto merge of #79620 - JohnTitor:label-name-sugg, r=davidtwcobors-1/+1
Tweak diagnostics on shadowing lifetimes/labels Fixes #79610 Skip adding a new test assuming we have already sufficient tests.
2020-12-02Tweak diagnostics on shadowing lifetimes/labelsYuki Okushi-1/+1
2020-12-02Auto merge of #78864 - Mark-Simulacrum:warn-on-forbids, r=pnkfelixbors-6/+6
Use true previous lint level when detecting overriden forbids Previously, cap-lints was ignored when checking the previous forbid level, which meant that it was a hard error to do so. This is different from the normal behavior of lints, which are silenced by cap-lints; if the forbid would not take effect regardless, there is not much point in complaining about the fact that we are reducing its level. It might be considered a bug that even `--cap-lints deny` would suffice to silence the error on overriding forbid, depending on if one cares about failing the build or precisely forbid being set. But setting cap-lints to deny is quite odd and not really done in practice, so we don't try to handle it specially. This also unifies the code paths for nested and same-level scopes. However, the special case for CLI lint flags is left in place (introduced by #70918) to fix the regression noted in #70819. That means that CLI flags do not lint on forbid being overridden by a non-forbid level. It is unclear whether this is a bug or a desirable feature, but it is certainly inconsistent. CLI flags are a sufficiently different "type" of place though that this is deemed out of scope for this commit. r? `@pnkfelix` perhaps? cc #77713 -- not marking as "Fixes" because of the lack of proper unused attribute handling in this PR
2020-11-29Auto merge of #78863 - KodrAus:feat/simd-array, r=oli-obkbors-1/+1
Support repr(simd) on ADTs containing a single array field This is a squash and rebase of `@gnzlbg's` #63531 I've never actually written code in the compiler before so just fumbled my way around until it would build 😅 I imagine there'll be some work we need to do in `rustc_codegen_cranelift` too for this now, but might need some input from `@bjorn3` to know what that is. cc `@rust-lang/project-portable-simd` ----- This PR allows using `#[repr(simd)]` on ADTs containing a single array field: ```rust #[repr(simd)] struct S0([f32; 4]); #[repr(simd)] struct S1<const N: usize>([f32; N]); #[repr(simd)] struct S2<T, const N: usize>([T; N]); ``` This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.
2020-11-22Drop support for cloudabi targetsLzu Tao-4/+2
2020-11-18Remove redundant notes in E0275Esteban Küber-126/+1
Fix #58964.
2020-11-14Use true previous lint level when detecting overriden forbidsMark Rousskov-6/+6
Previously, cap-lints was ignored when checking the previous forbid level, which meant that it was a hard error to do so. This is different from the normal behavior of lints, which are silenced by cap-lints; if the forbid would not take effect regardless, there is not much point in complaining about the fact that we are reducing its level. It might be considered a bug that even `--cap-lints deny` would suffice to silence the error on overriding forbid, depending on if one cares about failing the build or precisely forbid being set. But setting cap-lints to deny is quite odd and not really done in practice, so we don't try to handle it specially. This also unifies the code paths for nested and same-level scopes. However, the special case for CLI lint flags is left in place (introduced by #70918) to fix the regression noted in #70819. That means that CLI flags do not lint on forbid being overridden by a non-forbid level. It is unclear whether this is a bug or a desirable feature, but it is certainly inconsistent. CLI flags are a sufficiently different "type" of place though that this is deemed out of scope for this commit.
2020-11-08Support repr(simd) on ADTs containing a single array fieldgnzlbg-1/+1
This PR allows using `#[repr(simd)]` on ADTs containing a single array field: ```rust #[repr(simd)] struct S0([f32; 4]); #[repr(simd)] struct S1<const N: usize>([f32; N]); #[repr(simd)] struct S2<T, const N: usize>([T; N]); ``` This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.
2020-11-06Fixing Spelling Typosankushduacodes-2/+2
2020-10-27Add unsized_locals to INCOMPLETE_FEATURES listSantiago Pastorino-1/+1
2020-10-27Add unsized_fn_params featureSantiago Pastorino-3/+3
2020-10-25Merge remote-tracking branch 'upstream/master' into box-allocTim Diekmann-24/+67
2020-10-23Auto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnrbors-4/+4
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-21Auto merge of #78077 - petrochenkov:qvis, r=davidtwcobors-1/+10
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-20review commentsEsteban Küber-3/+3