about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
2022-05-22Use revisions for NLL in nllJack Huey-29/+48
2022-05-21correctly deal with user type ascriptions in patlcnr-0/+34
2022-05-13Rollup merge of #96615 - JohnTitor:test-54779, r=compiler-errorsMatthias Krüger-0/+62
Add a regression test for #54779 Closes #54779 r? `@jackh726`
2022-05-08Move some tests to more reasonable placesCaio-0/+130
2022-05-06Auto merge of #96268 - ↵bors-19/+0
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-02Add a regression test for #54779Yuki Okushi-0/+62
2022-05-01Move some tests to more reasonable placesCaio-0/+61
2022-04-30Bless tests.Camille GILLOT-41/+75
2022-04-27Auto merge of #96371 - c410-f3r:z-errors, r=petrochenkovbors-0/+50
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-0/+50
2022-04-25Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLLmarmeladema-0/+5
2022-04-24Bless testsmarmeladema-0/+2
2022-04-24Recover missing suggestion part under NLLmarmeladema-15/+21
2022-04-24Improve span for `consider adding an explicit lifetime bound` suggestions ↵marmeladema-30/+41
under NLL Because NLL borrowck is run after typeck, `in_progress_typeck_results` was always `None` which was preventing the retrieval of the span to which the suggestion is suppose to add the lifetime bound. We now manually pass the `LocalDefId` owner to `construct_generic_bound_failure` so that under NLL, we give the owner id of the current body.
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-19/+0
2022-04-05Rollup merge of #95591 - jackh726:nll-revisions-1, r=oli-obkDylan DPC-60/+117
Use revisions to track NLL test output (part 1) The idea here is 2 fold: 1) When we eventually do make NLL default on, that PR should be systematic in "delete revisions and corresponding error annotations" 2) This allows us to look at test NLL outputs in chunks. (Though, I've opted here not to "mark" these tests. There are some tests with NLL revisions *now* that will be missed. I expect we do a second pass once we have all the tests with NLL revisions; these tests should be easy enough to eyeball.) The actual review here should be "easy", but a bit tedious. I expect we should manually go through each test output and confirm it's okay. The majority of these are either: 1) Only span change (the one I see most common is highlighting an entire function call, rather than just the function name in that call) 2) "E0308 mismatched types" -> "lifetime does not live long enough" 3) "E0495 cannot infer an appropriate lifetime for lifetime parameter" -> "lifetime does not live long enough" 4) "E0312 lifetime of reference outlives lifetime of borrowed content" -> "lifetime does not live long enough" 5) "E0759 `XXX` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement" -> "lifetime does not live long enough" 6) "E0623 lifetime mismatch" -> "lifetime does not live long enough" Other than the now lack of an error code, most of these look fine (with most giving more helpful suggestions now). `rfc1623` output isn't great. cc ``@marmeladema`` if you want to look through these Let's r? ``@oli-obk`` since you've commented on the Zulip thread ;)
2022-04-05Move some tests with compare-mode=nll output to revisionsJack Huey-60/+117
2022-04-04Format invariance notes with backticksMichael Goulet-14/+14
2022-04-04Handle reporting invariance of fn pointerMichael Goulet-0/+34
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-21/+49
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-09Auto merge of #94515 - estebank:tweak-move-error, r=davidtwcobors-4/+2
Tweak move error Point at method definition that causes type to be consumed. Fix #94056.
2022-03-07Update tests after feature stabilizationEric Holk-13/+3
2022-03-07add tests for #94502lcnr-0/+45
2022-03-03Tweak move errorEsteban Kuber-4/+2
Point at method definition that causes type to be consumed. Fix #94056.
2022-02-24Remove in-band lifetimesMichael Goulet-6/+4
2022-02-16Fix inconsistent symbol mangling with -ZverboseTomasz Miąsko-5/+5
Always skip arguments that are the defaults of their respective parameters, to avoid generating inconsistent symbols for builds with `-Zverbose` flag and without it.
2022-02-12Update chalk testsMatthew Jasper-29/+30
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-22/+21
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-11Revert "Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk"Oli Scherer-27/+0
This reverts commit 1f0a96862ac9d4c6ca3e4bb500c8b9eac4d83049, reversing changes made to bf242bb1199e25ca2274df5c4114e0c9436b74e9.
2022-02-08Improve opaque type higher-ranked region error message under NLLAaron Hill-0/+27
Currently, any higher-ranked region errors involving opaque types fall back to a generic "higher-ranked subtype error" message when run under NLL. This PR adds better error message handling for this case, giving us the same kinds of error messages that we currently get without NLL: ``` error: implementation of `MyTrait` is not general enough --> $DIR/opaque-hrtb.rs:12:13 | LL | fn foo() -> impl for<'a> MyTrait<&'a str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough | = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`... = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2` error: aborting due to previous error ``` To accomplish this, several different refactoring needed to be made: * We now have a dedicated `InstantiateOpaqueType` struct which implements `TypeOp`. This is used to invoke `instantiate_opaque_types` during MIR type checking. * `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is needed to report opaque type region errors. * We no longer assume that all `TypeOp`s correspond to canonicalized queries. This allows us to properly handle opaque type instantiation (which does not occur in a query) as a `TypeOp`. A new `ErrorInfo` associated type is used to determine what additional information is used during higher-ranked region error handling. * The body of `try_extract_error_from_fulfill_cx` has been moved out to a new function `try_extract_error_from_region_constraints`. This allows us to re-use the same error reporting code between canonicalized queries (which can extract region constraints directly from a fresh `InferCtxt`) and opaque type handling (which needs to take region constraints from the pre-existing `InferCtxt` that we use throughout MIR borrow checking).
2022-02-07Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakisbors-21/+22
Lazy type-alias-impl-trait Previously opaque types were processed by 1. replacing all mentions of them with inference variables 2. memorizing these inference variables in a side-table 3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing. This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around. Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing * https://github.com/rust-lang/rfcs/pull/2515 much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities). r? `@nikomatsakis` fixes #93411 fixes #88236
2022-02-06Fix tracking issue for `const_fn_trait_bound`Ruby Lazuli-1/+1
It previously pointed to #57563, the conglomerate issue for `const fn` (presumably under the feature gate `const_fn`). `const_fn_trait_bounds` weren't mentioned here, so this commit changes its tracking issue to a new one.
2022-02-02blessOli Scherer-5/+5
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-16/+17
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-01-21Auto merge of #93173 - matthiaskrgr:rollup-49bj7ta, r=matthiaskrgrbors-43/+28
Rollup of 10 pull requests Successful merges: - #91965 (Add more granular `--exclude` in `x.py`) - #92467 (Ensure that early-bound function lifetimes are always 'local') - #92586 (Set the allocation MIN_ALIGN for espidf to 4.) - #92835 (Improve error message for key="value" cfg arguments.) - #92843 (Improve string concatenation suggestion) - #92963 (Implement tuple array diagnostic) - #93046 (Use let_else in even more places) - #93109 (Improve `Arc` and `Rc` documentation) - #93134 (delete `Stdin::split` forwarder) - #93139 (rustdoc: fix overflow-wrap for table layouts) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-21Rollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obkMatthias Krüger-43/+28
Ensure that early-bound function lifetimes are always 'local' During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2022-01-21Override rustc version in ui and mir-opt tests to get stable hashesThe 8472-3/+3
Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles. Using `RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER` stabilizes hashes calcuated for the individual tests so no test-dependent normalization is needed. Hashes for the standard library still change so some normalizations are still needed.
2022-01-15Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakisMatthias Krüger-5/+5
Prefer projection candidates instead of param_env candidates for Sized predicates Fixes #89352 Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed. This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible. r? ```@nikomatsakis```
2021-12-31Ensure that early-bound function lifetimes are always 'local'Aaron Hill-43/+28
During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2021-12-29Refactor variance diagnostics to work with more typesAaron Hill-0/+11
Instead of special-casing mutable pointers/references, we now support general generic types (currently, we handle `ty::Ref`, `ty::RawPtr`, and `ty::Adt`) When a `ty::Adt` is involved, we show an additional note explaining which of the type's generic parameters is invariant (e.g. the `T` in `Cell<T>`). Currently, we don't explain *why* a particular generic parameter ends up becoming invariant. In the general case, this could require printing a long 'backtrace' of types, so doing this would be more suitable for a follow-up PR. We still only handle the case where our variance switches to `ty::Invariant`.
2021-12-22When obligation is a sized predicate, prefer projection or object candidates ↵Jack Huey-5/+5
instead of param_env candidates
2021-12-17Fix typo in "new region bound" suggestionEsteban Kuber-1/+1
The lifetime name shoud always appear in text surrounded by `.
2021-12-13Include rustc version in `rustc_span::StableCrateId`pierwill-3/+3
Normalize symbol hashes in compiletest. Remove DefId sorting
2021-12-10Tweak wordingEsteban Kuber-1/+1
2021-11-21Simplify for loop desugarCameron Steffen-4/+2
2021-11-18Move some tests to more reasonable directoriesCaio-0/+91
2021-11-17Rollup merge of #90667 - rukai:improve_static_lifetime_diagnostics, r=estebankMatthias Krüger-9/+12
Improve diagnostics when a static lifetime is expected Makes progress towards https://github.com/rust-lang/rust/issues/90600 The diagnostics here were previously entirely removed due to giving a misleading suggestion but if we instead provide an informative label in that same location it should better help the user understand the situation. I included the example from the issue as it demonstrates an area where the diagnostics are still lacking. Happy to remove that if its just adding noise atm.
2021-11-14Move some tests to more reasonable directoriesCaio-0/+149
2021-11-14Improve diagnostics when a static lifetime is expectedLucas Kent-9/+12
2021-10-21Add test for issue #78561samlich-0/+23