]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc/middle/astconv_util.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / librustc / middle / astconv_util.rs
index 8b1bdc31beb01bf916aed85ab623a9907edd9cc5..2a27732b9532cdb83014ab3d6faac6e44ce859cf 100644 (file)
  * Almost certainly this could (and should) be refactored out of existence.
  */
 
-use middle::def::Def;
-use middle::ty::{self, Ty};
+use hir::def::Def;
+use ty::{Ty, TyCtxt};
 
 use syntax::codemap::Span;
-use rustc_front::hir as ast;
+use hir as ast;
 
-pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
+pub fn prohibit_type_params(tcx: &TyCtxt, segments: &[ast::PathSegment]) {
     for segment in segments {
         for typ in segment.parameters.types() {
             span_err!(tcx.sess, typ.span, E0109,
@@ -39,13 +39,13 @@ pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
     }
 }
 
-pub fn prohibit_projection(tcx: &ty::ctxt, span: Span)
+pub fn prohibit_projection(tcx: &TyCtxt, span: Span)
 {
     span_err!(tcx.sess, span, E0229,
               "associated type bindings are not allowed here");
 }
 
-pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
+pub fn prim_ty_to_ty<'tcx>(tcx: &TyCtxt<'tcx>,
                            segments: &[ast::PathSegment],
                            nty: ast::PrimTy)
                            -> Ty<'tcx> {
@@ -62,13 +62,12 @@ pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
 
 /// If a type in the AST is a primitive type, return the ty::Ty corresponding
 /// to it.
-pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
+pub fn ast_ty_to_prim_ty<'tcx>(tcx: &TyCtxt<'tcx>, ast_ty: &ast::Ty)
                                -> Option<Ty<'tcx>> {
     if let ast::TyPath(None, ref path) = ast_ty.node {
         let def = match tcx.def_map.borrow().get(&ast_ty.id) {
             None => {
-                tcx.sess.span_bug(ast_ty.span,
-                                  &format!("unbound path {:?}", path))
+                span_bug!(ast_ty.span, "unbound path {:?}", path)
             }
             Some(d) => d.full_def()
         };