-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Move FulfillmentContext into InferCtxt and remove Typer + ClosureTyper #26677
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6947948
Move FufillmentContext into InferContext
jroesch 64f1a59
Update all uses of FulfillmentContext
jroesch 0f13a3f
Use fresh FulfillmentContexts in select locations
jroesch fb295a6
Remove NormalizingClosureTyper
jroesch e2d7e90
Remove Typer + ClosureTyper impls for ParameterEnv
jroesch 05c57e0
Remove Typer + ClosureTyper impls for BlockS
jroesch 9faae6a
Remove Typer and ClosureTyper
jroesch 7a8f83a
Clean up patch
jroesch ce089e5
Address nits
jroesch c64bda3
Update librustc_driver/test.rs
jroesch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Init}; | |
use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode}; | ||
use middle::expr_use_visitor::WriteAndRead; | ||
use middle::expr_use_visitor as euv; | ||
use middle::mem_categorization::{cmt, Typer}; | ||
use middle::infer; | ||
use middle::mem_categorization::{cmt}; | ||
use middle::pat_util::*; | ||
use middle::ty::*; | ||
use middle::ty; | ||
|
@@ -1111,7 +1112,9 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt, | |
match p.node { | ||
ast::PatIdent(ast::BindByValue(_), _, ref sub) => { | ||
let pat_ty = tcx.node_id_to_type(p.id); | ||
if cx.param_env.type_moves_by_default(pat_ty, pat.span) { | ||
//FIXME: (@jroesch) this code should be floated up as well | ||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(cx.param_env.clone()), false); | ||
if infcx.type_moves_by_default(pat_ty, pat.span) { | ||
check_move(p, sub.as_ref().map(|p| &**p)); | ||
} | ||
} | ||
|
@@ -1139,8 +1142,9 @@ fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>, | |
let mut checker = MutationChecker { | ||
cx: cx, | ||
}; | ||
let mut visitor = ExprUseVisitor::new(&mut checker, | ||
&checker.cx.param_env); | ||
|
||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(checker.cx.param_env.clone()), false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line longer than 100 chars. |
||
let mut visitor = ExprUseVisitor::new(&mut checker, &infcx); | ||
visitor.walk_expr(guard); | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// is the public starting point. | ||
|
||
use middle::expr_use_visitor as euv; | ||
use middle::infer; | ||
use middle::mem_categorization as mc; | ||
use middle::ty::ParameterEnvironment; | ||
use middle::ty; | ||
|
@@ -38,9 +39,11 @@ impl<'a, 'tcx, 'v> visit::Visitor<'v> for RvalueContext<'a, 'tcx> { | |
s: Span, | ||
fn_id: ast::NodeId) { | ||
{ | ||
// FIXME (@jroesch) change this to be an inference context | ||
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id); | ||
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, Some(param_env.clone()), false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line longer than 100 chars. |
||
let mut delegate = RvalueContextDelegate { tcx: self.tcx, param_env: ¶m_env }; | ||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, ¶m_env); | ||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, &infcx); | ||
euv.walk_fn(fd, b); | ||
} | ||
visit::walk_fn(self, fk, fd, b, s) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line longer than 100 chars.