Skip to content

Intermittent borrow checker bug #28737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nrc opened this issue Sep 29, 2015 · 2 comments
Closed

Intermittent borrow checker bug #28737

nrc opened this issue Sep 29, 2015 · 2 comments
Labels
A-borrow-checker Area: The borrow checker T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nrc
Copy link
Member

nrc commented Sep 29, 2015

Yay for non-determinism:

../src/librustc/middle/expr_use_visitor.rs:283:9: 287:10 error: cannot infer an appropriate lifetime for lifetime parameter `'tcx` due to conflicting requirements
../src/librustc/middle/expr_use_visitor.rs:283         ExprUseVisitor {
../src/librustc/middle/expr_use_visitor.rs:284             typer: typer,
../src/librustc/middle/expr_use_visitor.rs:285             mc: mc::MemCategorizationContext::new(typer),
../src/librustc/middle/expr_use_visitor.rs:286             delegate: delegate,
../src/librustc/middle/expr_use_visitor.rs:287         }
../src/librustc/middle/expr_use_visitor.rs:279:5: 288:6 help: consider using an explicit lifetime parameter as shown: fn new(delegate: &'d mut Delegate<'tcx>, typer: &'t infer::InferCtxt<'a, 'a>)
 -> ExprUseVisitor<'d, 't, 'a, 'a>
../src/librustc/middle/expr_use_visitor.rs:279     pub fn new(delegate: &'d mut Delegate<'tcx>,
../src/librustc/middle/expr_use_visitor.rs:280                typer: &'t infer::InferCtxt<'a, 'tcx>)
../src/librustc/middle/expr_use_visitor.rs:281                -> ExprUseVisitor<'d,'t,'a,'tcx>
../src/librustc/middle/expr_use_visitor.rs:282     {
../src/librustc/middle/expr_use_visitor.rs:283         ExprUseVisitor {
../src/librustc/middle/expr_use_visitor.rs:284             typer: typer,
                                               ...
error: aborting due to previous error

See #28702. I've come across this a few times - sometimes adding let result = ...; result fixes this, some times removing it fixes it. Utterly gross.

cc @nikomatsakis

@nrc
Copy link
Member Author

nrc commented Sep 29, 2015

This is the only place I've ever seen it manifest, I've seen it a couple of times and others have reported on irc.

@nrc nrc added A-borrow-checker Area: The borrow checker T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 29, 2015
@nikomatsakis
Copy link
Contributor

This was (mostly) fixed by #27892 but remains in stage0. I'm going to go ahead and close, though there is still some amount of non-determinism in region inference that remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants