summary refs log tree commit diff
path: root/src/test/ui/recursion
AgeCommit message (Collapse)AuthorLines
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-1/+1
2022-03-23separate const prop lint from optimizationsCarl Scherer-2/+6
2022-03-08Suggest `if let`/`let_else` for refutable pat in `let`Esteban Kuber-1/+5
2022-03-08Point at uncovered variants in enum definition in `note` instead of a ↵Esteban Kuber-5/+12
`span_label` This makes the order of the output always consistent: 1. Place of the `match` missing arms 2. The `enum` definition span 3. The structured suggestion to add a fallthrough arm
2022-01-26Ignore unwinding edges when checking for unconditional recursionTomasz Miąsko-2/+13
The unconditional recursion lint determines if all execution paths eventually lead to a self-recursive call. The implementation always follows unwinding edges which limits its practical utility. For example, it would not lint function `f` because a call to `g` might unwind. It also wouldn't lint function `h` because an overflow check preceding the self-recursive call might unwind: ```rust pub fn f() { g(); f(); } pub fn g() { /* ... */ } pub fn h(a: usize) { h(a + 1); } ``` To avoid the issue, assume that terminators that might continue execution along non-unwinding edges do so.
2021-11-14Move some tests to more reasonable directoriesCaio-0/+17
2021-09-28Improve help for recursion limit errorsRoss MacArthur-1/+1
2021-09-21Disable visible path calculation for PrettyPrinter in Ok path of compilerAlik Aslanyan-6/+6
2021-08-24Morph `layout_raw` query into `layout_of`.Eduard-Mihai Burtescu-12/+10
2021-08-19Revert "Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, ↵Erik Desjardins-3/+3
r=oli-obk"" This reverts commit 8e11199a153218c13a419df37a9bb675181cccb7.
2021-08-18Auto merge of #87738 - lqd:polonius-master, r=nikomatsakisbors-0/+30
Update `polonius-engine` to 0.13.0 This PR updates the use of `polonius-engine` to the recently released 0.13.0: - this version renamed a lot of relations to match the current terminology - "illegal subset relationships errors" (AKA "subset errors" or "universal region errors" in rustc parlance) have been implemented in all variants, and therefore the `Hybrid` variant can be the rustc default once again - some of the blessed expectations were updated: new tests have been added since the last time I updated the tests, diagnostics have changed, etc. In particular: - a few tests had trivial expectations changes such as basic diagnostics changes for the migrate-mode and full NLLs - others were recursion and lengths limits which emits a file, and under the polonius compare-mode, the folder has a different name - a few tests were ignored in the NLL compare-mode for reasons that obviously also apply to Polonius - some diagnostics were unified so that older expectations no longer made sense: the NLL and Polonius outputs were identical. - in a few cases Polonius gets a chance to emit more errors than NLLs A few tests in the compare-mode still are super slow and trigger the 60s warning, or OOM rustc during fact generation, and I've detailed these [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60): - `src/test/ui/numbers-arithmetic/saturating-float-casts.rs` -> OOM during rustc fact generation - `src/test/ui/numbers-arithmetic/num-wrapping.rs` - `src/test/ui/issues/issue-72933-match-stack-overflow.rs` - `src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs` - `src/test/ui/repr/repr-no-niche.rs` In addition, 2 tests don't currently pass and I didn't want to bless them now: they deal with HRTBs and miss errors that NLLs emit. We're currently trying to see if we need chalk to deal with HRTB errors (as we thought we would have to) but during the recent sprint, we discovered that we may be able to detect some of these errors in a way that resembles subset errors: - `ui/hrtb/hrtb-just-for-static.rs` -> 3 errors in NLL, 2 in polonius: a missing error about HRTB + needing to outlive 'static - `ui/issues/issue-26217.rs` -> missing HRTB that makes the test compile instead of emitting an error We'll keep talking about this at the next sprint as well. cc `@rust-lang/wg-polonius` r? `@nikomatsakis`
2021-08-17Auto merge of #88056 - erikdesjardins:revertzst, r=oli-obkbors-3/+3
Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk" This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15. Fixes #88043 r? `@oli-obk`
2021-08-16Use note to point at bound introducing requirementEsteban Küber-6/+10
2021-08-15Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk"Erik Desjardins-3/+3
This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15.
2021-08-14Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obkbors-3/+3
Run RemoveZsts pass at mir-opt-level=1 per https://github.com/rust-lang/rust/pull/83177#issuecomment-803942217 This pass removes assignments to ZST places. Perf (from https://github.com/rust-lang/rust/pull/83177#issuecomment-803442557): https://perf.rust-lang.org/compare.html?start=41b315a470d583f6446599984ff9ad3bd61012b2&end=bd5d1b96f0c64c9938feea831789e1b5bb2cd4a2 r? `@oli-obk`
2021-08-11Modify structured suggestion outputEsteban Küber-1/+1
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-07Run RemoveZsts at mir-opt-level=1Erik Desjardins-3/+3
Effectively reverts commit 6960bc9696b05b15d8d89ece2fef14e6e62a43fc.
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-1/+1
2021-08-03bless a few trivial tests under poloniusRémy Rakic-0/+30
These are all about reaching some type and recursion limits and saving the full type in a file, whose folder changes in this compare-mode.
2021-04-06Point at `impl` and type defs introducing requirements on E0277Esteban Küber-3/+15
2021-03-31prevent very long compilation runtimes in LateBoundRegionNameCollectorb-naber-0/+19
2021-03-09Deprecate items that accidentally weren't deprecatedbstrie-2/+2
Fixes #82080
2021-02-06path trimming: ignore type aliasesDan Aloni-1/+1
2020-10-26simplify-locals: Remove unused assignments regardless of rvalue kindTomasz Miąsko-0/+1
2020-09-21Record `tcx.def_span` instead of `item.span` in crate metadataAaron Hill-16/+4
This was missed in PR #75465. As a result, a few places have been using the full body span of functions, instead of just the header span.
2020-09-21Let user see the full type of type-length limit errorKornel Lesiński-2/+7
2020-09-19Address review commentsOliver Scherer-4/+4
2020-09-19Stop using the `const_eval` query for initializers of staticsOliver Scherer-5/+1
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-17Better handling for exponential-sized types in misc placesValerii Lashmanov-2/+2
Mostly to fix ui/issues/issue-37311-type-length-limit/issue-37311.rs. Most parts of the compiler can handle deeply nested types with a lot of duplicates just fine, but some parts still attempt to naively traverse type tree. Before such problems were caught by type length limit check, but now these places will have to be changed to handle duplicated types gracefully.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-5/+5
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-22Use smaller def span for functionsAaron Hill-7/+2
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-07-29Update ui testsOliver Scherer-3/+3
2020-07-27mv std libs to library/mark-3/+3
2020-06-30Bless failing testsLeSeulArtichaut-2/+6
2020-06-22Point at the call spawn when overflow occurs during monomorphizationAaron Hill-5/+27
This improves the output for issue #72577, but there's still more work to be done. Currently, an overflow error during monomorphization results in an error that points at the function we were unable to monomorphize. However, we don't point at the call that caused the monomorphization to happen. In the overflow occurs in a large recursive function, it may be difficult to determine where the issue is. This commit tracks and `Span` information during collection of `MonoItem`s, which is used when emitting an overflow error. `MonoItem` itself is unchanged, so this only affects `src/librustc_mir/monomorphize/collector.rs`
2020-06-15Rollup merge of #72879 - RalfJung:miri-tctx-at, r=oli-obkRalf Jung-2/+2
Miri: avoid tracking current location three times Miri tracks the current instruction to execute in the call stack, but it also additionally has two `TyCtxtAt` that carry a `Span` that also tracks the current instruction. That is quite silly, so this PR uses `TyCtxt` instead, and then uses a method for computing the current span when a `TyCtxtAt` is needed. Having less redundant (semi-)global state seems like a good improvement to me. :D To keep the ConstProp errors the same, I had to add the option to `error_to_const_error` to overwrite the span. Also for some reason this changes cycle errors a bit -- not sure if we are now better or worse as giving those queries the right span. (It is unfortunately quite easy to accidentally use `DUMMY_SP` by calling the query on a `TyCtxt` instead of a `TyCtxtAt`.) r? @oli-obk @eddyb
2020-06-12fix const_prop spans and re-bless testsRalf Jung-2/+2
2020-06-10review comments: only suggest one substitutionEsteban Küber-5/+1
2020-06-10On recursive ADT, provide indirection structured suggestionEsteban Küber-1/+8
2020-05-31Add descriptions for all queriesMatthew Jasper-5/+10
2020-04-08Small tweaks to required bound spanEsteban Küber-2/+2
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-2/+2
Keep more information about trait binding failures.
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-6/+1
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+1
2020-03-23Ignore tests on some platforms due to #53081Aaron Hill-1/+6
2020-03-22Store idents for `DefPathData` into crate metadataAaron Hill-0/+5
Previously, we threw away the `Span` associated with a definition's identifier when we encoded crate metadata, causing us to lose location and hygiene information. We now store the identifier's `Span` in the crate metadata. When we decode items from the metadata, we combine the name and span back into an `Ident`. This improves the output of several tests, which previously had messages suppressed due to dummy spans. This is a prerequisite for #68686, since throwing away a `Span` means that we lose hygiene information.
2020-02-12Auto merge of #68679 - matthewjasper:needs-type-op, r=varkorbors-1/+2
Improve `ty.needs_drop` * Handle cycles in `needs_drop` correctly * Normalize types when computing `needs_drop` * Move queries from rustc to rustc_ty * Avoid query in simple cases reopens #65918
2020-02-11Specify overflow checks behaviour in testMatthew Jasper-1/+2
2020-02-01Update existing tests for or-patternsMatthew Jasper-10/+2
2020-01-19fix real_drop_in_place in commentsRalf Jung-1/+1