]>
git.proxmox.com Git - rustc.git/blob - src/librustc_typeck/variance/mod.rs
1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Module for inferring the variance of type and lifetime
12 //! parameters. See README.md for details.
15 use rustc
::ty
::TyCtxt
;
17 /// Defines the `TermsContext` basically houses an arena where we can
21 /// Code to gather up constraints.
24 /// Code to solve constraints and write out the results.
27 /// Code for transforming variances.
30 pub fn infer_variance
<'a
, 'tcx
>(tcx
: TyCtxt
<'a
, 'tcx
, 'tcx
>) {
31 let mut arena
= arena
::TypedArena
::new();
32 let terms_cx
= terms
::determine_parameters_to_be_inferred(tcx
, &mut arena
);
33 let constraints_cx
= constraints
::add_constraints_from_crate(terms_cx
);
34 solve
::solve_constraints(constraints_cx
);
35 tcx
.variance_computed
.set(true);