]> git.proxmox.com Git - rustc.git/blame - src/librustc_typeck/variance/mod.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / librustc_typeck / variance / mod.rs
CommitLineData
7453a54e
SL
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.
4//
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.
10
11//! Module for inferring the variance of type and lifetime
12//! parameters. See README.md for details.
13
14use arena;
54a0048b 15use rustc::ty::TyCtxt;
7453a54e
SL
16
17/// Defines the `TermsContext` basically houses an arena where we can
18/// allocate terms.
19mod terms;
20
21/// Code to gather up constraints.
22mod constraints;
23
24/// Code to solve constraints and write out the results.
25mod solve;
26
27/// Code for transforming variances.
28mod xform;
29
a7813a04 30pub fn infer_variance<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
7453a54e
SL
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);
36}