Repository navigation
ReSkolemized can leak into error messages #13998
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
examples/examples.rs:46:26: 46:34 error: lifetime of function argument does not outlive the function call
examples/examples.rs:46 let f = SlotAny::new(two_args);
^~~~~~~~
note: the function argument is only valid for lifetime ReInfer(ReSkolemized(0u, BrAnon(0u)))
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'assertion failed: !ty::type_needs_infer(ty)', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/typeck/mod.rs:251
stack backtrace:
1: 0x10c3c9a64 - rt::backtrace::imp::write::habc56a229da3d9445Ea::v0.11.pre
2: 0x10c31e00e - rt::unwind::begin_unwind_inner::he30d2051ed995551bfa::v0.11.pre
3: 0x10c31d4c7 - rt::unwind::begin_unwind_fmt::h6e44c556d6cd8deelea::v0.11.pre
4: 0x109914c56 - middle::typeck::write_ty_to_tcx::h2b827da2c5dd52b30fu::v0.11.pre
5: 0x10991135e - middle::typeck::check::writeback::resolve_type_vars_for_node::h56adc403301d71a1TS1::v0.11.pre
6: 0x10991583a - middle::typeck::check::writeback::visit_expr::hf20f6553222bc96ft51::v0.11.pre
7: 0x109915b3d - middle::typeck::check::writeback::visit_expr::hf20f6553222bc96ft51::v0.11.pre
8: 0x109917a6e - middle::typeck::check::writeback::visit_local::h60d5d5890d438f00Ja2::v0.11.pre
9: 0x109915570 - middle::typeck::check::writeback::visit_stmt::h57274c9f7367d7c8T41::v0.11.pre
10: 0x109917023 - visit::walk_block::h4813911114547969337::v0.11.pre
11: 0x10991a312 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h648841adac5a5f12yn2::v0.11.pre
12: 0x10996ae17 - middle::typeck::check::check_bare_fn::h727d76d1a8c0577cx36::v0.11.pre
13: 0x109962d4e - middle::typeck::check::check_item::hb3e06af45cad1763Uz7::v0.11.pre
14: 0x10996ab2d - middle::typeck::check::check_item_types::h4794d86cd018c594P26::v0.11.pre
15: 0x109aad54f - util::common::time::h13076619411820452536::v0.11.pre
16: 0x109aac47d - middle::typeck::check_crate::h979c5052f97482abIzu::v0.11.pre
17: 0x109eb5b21 - driver::driver::phase_3_run_analysis_passes::ha118c3d47f9c07e1Ssf::v0.11.pre
18: 0x109ebb572 - driver::driver::compile_input::h09b012d109a97ff53Rf::v0.11.pre
19: 0x109ee1ba7 - run_compiler::h1896b068d115fa30akn::v0.11.pre
20: 0x109ef9afd - main_args::closure.91270
21: 0x109ef7e92 - monitor::closure.91145
22: 0x109ef2a7b - task::TaskBuilder::try::closure.90911
23: 0x109665d6c - task::spawn_opts::closure.7135
24: 0x10c3bfa68 - rt::task::Task::run::closure.40347
25: 0x10c3cec4c - rust_try
26: 0x10c3bf8e7 - rt::task::Task::run::ha1efa04543646d12L57::v0.11.pre
27: 0x109665bef - task::spawn_opts::closure.7107
28: 0x10c3c8436 - rt::thread::thread_start::h2d864941e9d800a8YK8::v0.11.pre
29: 0x7fff8ce75899 - _pthread_body
30: 0x7fff8ce7572a - _pthread_struct_init
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
alexcrichton commentedon May 6, 2014
Do you have an example of a code snippet to reproduce this ICE?
jmmk commentedon May 6, 2014
In the code that caused the error I am importing from a library I am building, but if I copy paste the library code into the file, I get
error: cannot determine a type for this local variable: unconstrained typeinstead.Basically what I have (This does not reproduce the compiler error):
luqmana commentedon May 7, 2014
@jmmk Could you at least link that library then so we can reproduce it?
jmmk commentedon Jul 14, 2014
@luqmana sorry for the slow response, but I finally got around to looking at this again.
I just tested this on the newest nightly and it gives the compiler error:
Stacktrace:
[-]ICE: function lifetime [/-][+]ReInfer(ReSkolemized(0u, BrAnon(0u))) in a diagnostic message[/+]nham commentedon Jun 4, 2015
The error message for this code is looking much nicer:
I think there's still room for improvement here. Perhaps the E0308 explanation could give an example and explain what the problem is (and what "concrete lifetime" and "bound lifetime parameter" mean, possibly)
[-]ReInfer(ReSkolemized(0u, BrAnon(0u))) in a diagnostic message[/-][+]ReSkolemized can leak into error messages[/+]arielb1 commentedon Aug 18, 2015
crappy error message still possible:
gives
shepmaster commentedon Aug 23, 2016
Continuing on to 2016:
9 remaining items
mark-i-m commentedon Oct 10, 2019
@estebank This happens on master with nll enabled, e.g. this ui test:
rust/src/test/ui/async-await/issues/issue-63388-1.nll.stderr
Lines 1 to 7 in ece4977
Notice:
captures lifetime '_#22restebank commentedon Oct 10, 2019
I feel that even though the general problem is the same as originally reported, it is different enough that it would have warranted making a new ticket.
That being said, thanks for digging up a relevant test to keep track of the fix.
steveklabnik commentedon Sep 18, 2020
Triage: this FIXME is still here
rust/compiler/rustc_infer/src/infer/error_reporting/mod.rs
Lines 103 to 110 in 41dc394
estebank commentedon Jul 26, 2022
https://github.com/rust-lang/rust/blob/master/src/test/ui/async-await/issues/issue-63388-1.stderr no longer shows a repro, but https://github.com/rust-lang/rust/blob/8cc87250efc5b5fcec85d43eaa73f7a9acc2198a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr does
estebank commentedon Jan 5, 2023
I believe that the only cases where we still show these is when using
-Zverbose. Do we have any counter-example? Otherwise I'm tempted at just closing this.estebank commentedon Jan 19, 2023
Steve's linked code is still there, but changing it has no effect anywhere in the test suite. This is not positive proof of anything, but I believe it might be code only accessible through
-Zverbose. I will go ahead and close this.Fix up `DescriptionCtx::new`.
Fix up `DescriptionCtx::new`.
added Default impls
added Default impls
Use clearer multipart suggestions for `unnecessary_map_or` lint (rust…
Make `unnecessary_map_or` work with ref and `Deref` to `Option`/`Resu…