about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-10 17:36:47 -0800
committerGitHub <noreply@github.com>2016-11-10 17:36:47 -0800
commitde46bea66640d4e72833ab27a8658a0f117e74bb (patch)
tree73f1a68b35bd7e6874eeee0b4e3781254e05472d
parent1473007618e6ab85a994f86348acdaf125b7914f (diff)
parentc2f1e5d16455057f86c1e3051e77009d90b167fc (diff)
Auto merge of #37104 - luqmana:fixmes, r=eddyb
Clean up some FIXMEs.

Remove some assorted FIXMEs in the codebase.
-rw-r--r--src/librustc/infer/mod.rs1
-rw-r--r--src/librustc/middle/mem_categorization.rs4
-rw-r--r--src/librustc_trans/adt.rs2
-rw-r--r--src/librustc_trans/common.rs2
-rw-r--r--src/librustc_trans/context.rs16
-rw-r--r--src/librustc_trans/type_.rs25
-rw-r--r--src/librustc_trans/type_of.rs2
7 files changed, 11 insertions, 41 deletions
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index ebafd206e26..8f4a12e0397 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -184,7 +184,6 @@ pub enum TypeOrigin {
     MethodCompatCheck(Span),
 
     // Checking that this expression can be assigned where it needs to be
-    // FIXME(eddyb) #11161 is the original Expr required?
     ExprAssignable(Span),
 
     // Relating trait type parameters to those found in impl etc
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index e3ed13e1e40..fedf8c2ec74 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -945,9 +945,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
                 let ref_ty = self.overloaded_method_return_ty(method_ty);
                 base_cmt = self.cat_rvalue_node(elt.id(), elt.span(), ref_ty);
 
-                // FIXME(#20649) -- why are we using the `self_ty` as the element type...?
-                let self_ty = method_ty.fn_sig().input(0);
-                (self.tcx().no_late_bound_regions(&self_ty).unwrap(),
+                (ref_ty.builtin_deref(false, ty::NoPreference).unwrap().ty,
                  ElementKind::OtherElement)
             }
             None => {
diff --git a/src/librustc_trans/adt.rs b/src/librustc_trans/adt.rs
index 4d3361c1873..d028dd7e7b5 100644
--- a/src/librustc_trans/adt.rs
+++ b/src/librustc_trans/adt.rs
@@ -245,8 +245,6 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             // So we start with the discriminant, pad it up to the alignment with
             // more of its own type, then use alignment-sized ints to get the rest
             // of the size.
-            //
-            // FIXME #10604: this breaks when vector types are present.
             let size = size.bytes();
             let align = align.abi();
             let discr_ty = Type::from_integer(cx, discr);
diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs
index 464b261b08e..d238cf7bb45 100644
--- a/src/librustc_trans/common.rs
+++ b/src/librustc_trans/common.rs
@@ -815,7 +815,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
 pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
     let len = s.len();
     let cs = consts::ptrcast(C_cstr(cx, s, false), Type::i8p(cx));
-    C_named_struct(cx.tn().find_type("str_slice").unwrap(), &[cs, C_uint(cx, len)])
+    C_named_struct(cx.str_slice_type(), &[cs, C_uint(cx, len)])
 }
 
 pub fn C_struct(cx: &CrateContext, elts: &[ValueRef], packed: bool) -> ValueRef {
diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs
index 264d4940c17..3930bcbdd9a 100644
--- a/src/librustc_trans/context.rs
+++ b/src/librustc_trans/context.rs
@@ -25,7 +25,7 @@ use monomorphize::Instance;
 
 use partitioning::CodegenUnit;
 use trans_item::TransItem;
-use type_::{Type, TypeNames};
+use type_::Type;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TyCtxt};
 use session::config::NoDebugInfo;
@@ -87,7 +87,6 @@ pub struct LocalCrateContext<'tcx> {
     llmod: ModuleRef,
     llcx: ContextRef,
     previous_work_product: Option<WorkProduct>,
-    tn: TypeNames, // FIXME: This seems to be largely unused.
     codegen_unit: CodegenUnit<'tcx>,
     needs_unwind_cleanup_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>,
     fn_pointer_shims: RefCell<FxHashMap<Ty<'tcx>, ValueRef>>,
@@ -137,6 +136,7 @@ pub struct LocalCrateContext<'tcx> {
     type_hashcodes: RefCell<FxHashMap<Ty<'tcx>, String>>,
     int_type: Type,
     opaque_vec_type: Type,
+    str_slice_type: Type,
     builder: BuilderRef_res,
 
     /// Holds the LLVM values for closure IDs.
@@ -611,7 +611,6 @@ impl<'tcx> LocalCrateContext<'tcx> {
                 llcx: llcx,
                 previous_work_product: previous_work_product,
                 codegen_unit: codegen_unit,
-                tn: TypeNames::new(),
                 needs_unwind_cleanup_cache: RefCell::new(FxHashMap()),
                 fn_pointer_shims: RefCell::new(FxHashMap()),
                 drop_glues: RefCell::new(FxHashMap()),
@@ -631,6 +630,7 @@ impl<'tcx> LocalCrateContext<'tcx> {
                 type_hashcodes: RefCell::new(FxHashMap()),
                 int_type: Type::from_ref(ptr::null_mut()),
                 opaque_vec_type: Type::from_ref(ptr::null_mut()),
+                str_slice_type: Type::from_ref(ptr::null_mut()),
                 builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
                 closure_vals: RefCell::new(FxHashMap()),
                 dbg_cx: dbg_cx,
@@ -662,7 +662,7 @@ impl<'tcx> LocalCrateContext<'tcx> {
 
             local_ccx.int_type = int_type;
             local_ccx.opaque_vec_type = opaque_vec_type;
-            local_ccx.tn.associate_type("str_slice", &str_slice_ty);
+            local_ccx.str_slice_type = str_slice_ty;
 
             if shared.tcx.sess.count_llvm_insns() {
                 base::init_insn_ctxt()
@@ -778,10 +778,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
         unsafe { llvm::LLVMRustGetModuleDataLayout(self.llmod()) }
     }
 
-    pub fn tn<'a>(&'a self) -> &'a TypeNames {
-        &self.local().tn
-    }
-
     pub fn export_map<'a>(&'a self) -> &'a ExportMap {
         &self.shared.export_map
     }
@@ -885,6 +881,10 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
         self.local().opaque_vec_type
     }
 
+    pub fn str_slice_type(&self) -> Type {
+        self.local().str_slice_type
+    }
+
     pub fn closure_vals<'a>(&'a self) -> &'a RefCell<FxHashMap<Instance<'tcx>, ValueRef>> {
         &self.local().closure_vals
     }
diff --git a/src/librustc_trans/type_.rs b/src/librustc_trans/type_.rs
index 2a6f79d3ed5..2b2776acab8 100644
--- a/src/librustc_trans/type_.rs
+++ b/src/librustc_trans/type_.rs
@@ -15,7 +15,6 @@ use llvm::{TypeRef, Bool, False, True, TypeKind};
 use llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
 
 use context::CrateContext;
-use util::nodemap::FxHashMap;
 
 use syntax::ast;
 use rustc::ty::layout;
@@ -24,7 +23,6 @@ use std::ffi::CString;
 use std::fmt;
 use std::mem;
 use std::ptr;
-use std::cell::RefCell;
 
 use libc::c_uint;
 
@@ -321,26 +319,3 @@ impl Type {
         }
     }
 }
-
-/* Memory-managed object interface to type handles. */
-
-pub struct TypeNames {
-    named_types: RefCell<FxHashMap<String, TypeRef>>,
-}
-
-impl TypeNames {
-    pub fn new() -> TypeNames {
-        TypeNames {
-            named_types: RefCell::new(FxHashMap())
-        }
-    }
-
-    pub fn associate_type(&self, s: &str, t: &Type) {
-        assert!(self.named_types.borrow_mut().insert(s.to_string(),
-                                                     t.to_ref()).is_none());
-    }
-
-    pub fn find_type(&self, s: &str) -> Option<Type> {
-        self.named_types.borrow().get(s).map(|x| Type::from_ref(*x))
-    }
-}
diff --git a/src/librustc_trans/type_of.rs b/src/librustc_trans/type_of.rs
index 132b0a910b9..dc794d5946a 100644
--- a/src/librustc_trans/type_of.rs
+++ b/src/librustc_trans/type_of.rs
@@ -238,7 +238,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
               if let ty::TyStr = ty.sty {
                   // This means we get a nicer name in the output (str is always
                   // unsized).
-                  cx.tn().find_type("str_slice").unwrap()
+                  cx.str_slice_type()
               } else {
                   let ptr_ty = in_memory_type_of(cx, ty).ptr_to();
                   let info_ty = unsized_info_ty(cx, ty);