Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebank

address some FIXME whose associated issues were marked as closed

part of #44366
This commit is contained in:
kennytm
2018-03-22 17:51:25 +08:00
14 changed files with 40 additions and 77 deletions

View File

@@ -1351,7 +1351,7 @@ fn test_copy_from_slice_dst_shorter() {
const MAX_LEN: usize = 80; const MAX_LEN: usize = 80;
static DROP_COUNTS: [AtomicUsize; MAX_LEN] = [ static DROP_COUNTS: [AtomicUsize; MAX_LEN] = [
// FIXME #5244: AtomicUsize is not Copy. // FIXME(RFC 1109): AtomicUsize is not Copy.
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),

View File

@@ -382,7 +382,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U>
} }
} }
// FIXME (#23442): replace the above impls for &/&mut with the following more general one: // FIXME (#45742): replace the above impls for &/&mut with the following more general one:
// // As lifts over Deref // // As lifts over Deref
// impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> { // impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> {
// fn as_ref(&self) -> &U { // fn as_ref(&self) -> &U {
@@ -399,7 +399,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsMut<U> for &'a mut T where T: AsMut<U>
} }
} }
// FIXME (#23442): replace the above impl for &mut with the following more general one: // FIXME (#45742): replace the above impl for &mut with the following more general one:
// // AsMut lifts over DerefMut // // AsMut lifts over DerefMut
// impl<D: ?Sized + Deref, U: ?Sized> AsMut<U> for D where D::Target: AsMut<U> { // impl<D: ?Sized + Deref, U: ?Sized> AsMut<U> for D where D::Target: AsMut<U> {
// fn as_mut(&mut self) -> &mut U { // fn as_mut(&mut self) -> &mut U {

View File

@@ -1872,7 +1872,7 @@ impl<I: Iterator> Iterator for Peekable<I> {
#[inline] #[inline]
fn nth(&mut self, n: usize) -> Option<I::Item> { fn nth(&mut self, n: usize) -> Option<I::Item> {
// FIXME(#6393): merge these when borrow-checking gets better. // FIXME(#43234): merge these when borrow-checking gets better.
if n == 0 { if n == 0 {
match self.peeked.take() { match self.peeked.take() {
Some(v) => v, Some(v) => v,

View File

@@ -117,10 +117,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// Evaluate the initializer, if present. // Evaluate the initializer, if present.
if let Some(init) = initializer { if let Some(init) = initializer {
unpack!(block = this.in_opt_scope( unpack!(block = this.in_opt_scope(
opt_destruction_scope.map(|de|(de, source_info)), block, move |this| { opt_destruction_scope.map(|de|(de, source_info)), block, |this| {
let scope = (init_scope, source_info); let scope = (init_scope, source_info);
this.in_scope(scope, lint_level, block, move |this| { this.in_scope(scope, lint_level, block, |this| {
// FIXME #30046 ^~~~
this.expr_into_pattern(block, pattern, init) this.expr_into_pattern(block, pattern, init)
}) })
})); }));

View File

@@ -177,7 +177,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
}); });
} }
DropStyle::Conditional => { DropStyle::Conditional => {
let unwind = self.unwind; // FIXME(#6393) let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ; let succ = self.succ;
let drop_bb = self.complete_drop(Some(DropFlagMode::Deep), succ, unwind); let drop_bb = self.complete_drop(Some(DropFlagMode::Deep), succ, unwind);
self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto { self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
@@ -268,7 +268,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
// Clear the "master" drop flag at the end. This is needed // Clear the "master" drop flag at the end. This is needed
// because the "master" drop protects the ADT's discriminant, // because the "master" drop protects the ADT's discriminant,
// which is invalidated after the ADT is dropped. // which is invalidated after the ADT is dropped.
let (succ, unwind) = (self.succ, self.unwind); // FIXME(#6393) let (succ, unwind) = (self.succ, self.unwind); // FIXME(#43234)
( (
self.drop_flag_reset_block(DropFlagMode::Shallow, succ, unwind), self.drop_flag_reset_block(DropFlagMode::Shallow, succ, unwind),
unwind.map(|unwind| { unwind.map(|unwind| {
@@ -344,7 +344,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
let interior = self.place.clone().deref(); let interior = self.place.clone().deref();
let interior_path = self.elaborator.deref_subpath(self.path); let interior_path = self.elaborator.deref_subpath(self.path);
let succ = self.succ; // FIXME(#6393) let succ = self.succ; // FIXME(#43234)
let unwind = self.unwind; let unwind = self.unwind;
let succ = self.box_free_block(ty, succ, unwind); let succ = self.box_free_block(ty, succ, unwind);
let unwind_succ = self.unwind.map(|unwind| { let unwind_succ = self.unwind.map(|unwind| {
@@ -717,7 +717,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
ptr_based) ptr_based)
}); });
let succ = self.succ; // FIXME(#6393) let succ = self.succ; // FIXME(#43234)
let loop_block = self.drop_loop( let loop_block = self.drop_loop(
succ, succ,
cur, cur,
@@ -798,7 +798,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.open_drop_for_adt(def, substs) self.open_drop_for_adt(def, substs)
} }
ty::TyDynamic(..) => { ty::TyDynamic(..) => {
let unwind = self.unwind; // FIXME(#6393) let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ; let succ = self.succ;
self.complete_drop(Some(DropFlagMode::Deep), succ, unwind) self.complete_drop(Some(DropFlagMode::Deep), succ, unwind)
} }
@@ -849,7 +849,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
fn elaborated_drop_block<'a>(&mut self) -> BasicBlock { fn elaborated_drop_block<'a>(&mut self) -> BasicBlock {
debug!("elaborated_drop_block({:?})", self); debug!("elaborated_drop_block({:?})", self);
let unwind = self.unwind; // FIXME(#6393) let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ; let succ = self.succ;
let blk = self.drop_block(succ, unwind); let blk = self.drop_block(succ, unwind);
self.elaborate_drop(blk); self.elaborate_drop(blk);
@@ -882,7 +882,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
args: vec![Operand::Move(self.place.clone())], args: vec![Operand::Move(self.place.clone())],
destination: Some((unit_temp, target)), destination: Some((unit_temp, target)),
cleanup: None cleanup: None
}; // FIXME(#6393) }; // FIXME(#43234)
let free_block = self.new_block(unwind, call); let free_block = self.new_block(unwind, call);
let block_start = Location { block: free_block, statement_index: 0 }; let block_start = Location { block: free_block, statement_index: 0 };

View File

@@ -1025,28 +1025,9 @@ fn import_path_to_string(names: &[SpannedIdent],
if names.is_empty() { if names.is_empty() {
import_directive_subclass_to_string(subclass) import_directive_subclass_to_string(subclass)
} else { } else {
// FIXME: Remove this entire logic after #48116 is fixed. format!("{}::{}",
//
// Note that this code looks a little wonky, it's currently here to
// hopefully help debug #48116, but otherwise isn't intended to
// cause any problems.
let x = format!(
"{}::{}",
names_to_string(names), names_to_string(names),
import_directive_subclass_to_string(subclass), import_directive_subclass_to_string(subclass))
);
if names.is_empty() || x.starts_with("::") {
span_bug!(
span,
"invalid name `{}` at {:?}; global = {}, names = {:?}, subclass = {:?}",
x,
span,
global,
names,
subclass
);
}
return x
} }
} }
} }

View File

@@ -15,7 +15,6 @@
//! paths etc in all kinds of annoying scenarios. //! paths etc in all kinds of annoying scenarios.
use rustc::hir; use rustc::hir;
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
use rustc::ty::TyCtxt; use rustc::ty::TyCtxt;
use syntax::ast; use syntax::ast;
@@ -34,8 +33,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
tcx.dep_graph.with_ignore(|| { tcx.dep_graph.with_ignore(|| {
let mut visitor = SymbolNamesTest { tcx: tcx }; let mut visitor = SymbolNamesTest { tcx: tcx };
// FIXME(#37712) could use ItemLikeVisitor if trait items were item-like tcx.hir.krate().visit_all_item_likes(&mut visitor);
tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
}) })
} }
@@ -66,23 +64,16 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> {
} }
} }
impl<'a, 'tcx> Visitor<'tcx> for SymbolNamesTest<'a, 'tcx> { impl<'a, 'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'a, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::None
}
fn visit_item(&mut self, item: &'tcx hir::Item) { fn visit_item(&mut self, item: &'tcx hir::Item) {
self.process_attrs(item.id); self.process_attrs(item.id);
intravisit::walk_item(self, item);
} }
fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
self.process_attrs(ti.id); self.process_attrs(trait_item.id);
intravisit::walk_trait_item(self, ti)
} }
fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
self.process_attrs(ii.id); self.process_attrs(impl_item.id);
intravisit::walk_impl_item(self, ii)
} }
} }

View File

@@ -2884,7 +2884,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let origin = self.misc(call_span); let origin = self.misc(call_span);
let ures = self.at(&origin, self.param_env).sup(ret_ty, formal_ret); let ures = self.at(&origin, self.param_env).sup(ret_ty, formal_ret);
// FIXME(#15760) can't use try! here, FromError doesn't default // FIXME(#27336) can't use ? here, Try::from_error doesn't default
// to identity so the resulting type is not constrained. // to identity so the resulting type is not constrained.
match ures { match ures {
Ok(ok) => { Ok(ok) => {
@@ -2892,19 +2892,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// we can. We don't care if some things turn // we can. We don't care if some things turn
// out unconstrained or ambiguous, as we're // out unconstrained or ambiguous, as we're
// just trying to get hints here. // just trying to get hints here.
let result = self.save_and_restore_in_snapshot_flag(|_| { self.save_and_restore_in_snapshot_flag(|_| {
let mut fulfill = FulfillmentContext::new(); let mut fulfill = FulfillmentContext::new();
let ok = ok; // FIXME(#30046)
for obligation in ok.obligations { for obligation in ok.obligations {
fulfill.register_predicate_obligation(self, obligation); fulfill.register_predicate_obligation(self, obligation);
} }
fulfill.select_where_possible(self) fulfill.select_where_possible(self)
}); }).map_err(|_| ())?;
match result {
Ok(()) => { }
Err(_) => return Err(()),
}
} }
Err(_) => return Err(()), Err(_) => return Err(()),
} }

View File

@@ -169,7 +169,6 @@ mod tests {
macro_rules! test_checked_next_power_of_two { macro_rules! test_checked_next_power_of_two {
($test_name:ident, $T:ident) => ( ($test_name:ident, $T:ident) => (
#[cfg_attr(target_os = "emscripten", ignore)] // FIXME(#39119)
fn $test_name() { fn $test_name() {
#![test] #![test]
assert_eq!((0 as $T).checked_next_power_of_two(), Some(1)); assert_eq!((0 as $T).checked_next_power_of_two(), Some(1));

View File

@@ -298,7 +298,6 @@ pub fn str_lit(lit: &str, diag: Option<(Span, &Handler)>) -> String {
debug!("parse_str_lit: given {}", escape_default(lit)); debug!("parse_str_lit: given {}", escape_default(lit));
let mut res = String::with_capacity(lit.len()); let mut res = String::with_capacity(lit.len());
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
let error = |i| format!("lexer should have rejected {} at {}", lit, i); let error = |i| format!("lexer should have rejected {} at {}", lit, i);
/// Eat everything up to a non-whitespace /// Eat everything up to a non-whitespace
@@ -503,7 +502,6 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
pub fn byte_str_lit(lit: &str) -> Lrc<Vec<u8>> { pub fn byte_str_lit(lit: &str) -> Lrc<Vec<u8>> {
let mut res = Vec::with_capacity(lit.len()); let mut res = Vec::with_capacity(lit.len());
// FIXME #8372: This could be a for-loop if it didn't borrow the iterator
let error = |i| format!("lexer should have rejected {} at {}", lit, i); let error = |i| format!("lexer should have rejected {} at {}", lit, i);
/// Eat everything up to a non-whitespace /// Eat everything up to a non-whitespace

View File

@@ -628,8 +628,15 @@ fn path_node(ids: Vec<Ident>) -> ast::Path {
} }
fn path_name_i(idents: &[Ident]) -> String { fn path_name_i(idents: &[Ident]) -> String {
// FIXME: Bad copies (#2543 -- same for everything else that says "bad") let mut path_name = "".to_string();
idents.iter().map(|i| i.to_string()).collect::<Vec<String>>().join("::") let mut idents_iter = idents.iter().peekable();
while let Some(ident) = idents_iter.next() {
path_name.push_str(&ident.name.as_str());
if let Some(_) = idents_iter.peek() {
path_name.push_str("::")
}
}
path_name
} }
fn mk_tests(cx: &TestCtxt) -> P<ast::Item> { fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
@@ -682,7 +689,6 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
// gensym information. // gensym information.
let span = ignored_span(cx, test.span); let span = ignored_span(cx, test.span);
let path = test.path.clone();
let ecx = &cx.ext_cx; let ecx = &cx.ext_cx;
let self_id = ecx.ident_of("self"); let self_id = ecx.ident_of("self");
let test_id = ecx.ident_of("test"); let test_id = ecx.ident_of("test");
@@ -694,10 +700,11 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
// creates $name: $expr // creates $name: $expr
let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr); let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr);
debug!("encoding {}", path_name_i(&path[..]));
// path to the #[test] function: "foo::bar::baz" // path to the #[test] function: "foo::bar::baz"
let path_string = path_name_i(&path[..]); let path_string = path_name_i(&test.path[..]);
debug!("encoding {}", path_string);
let name_expr = ecx.expr_str(span, Symbol::intern(&path_string)); let name_expr = ecx.expr_str(span, Symbol::intern(&path_string));
// self::test::StaticTestName($name_expr) // self::test::StaticTestName($name_expr)
@@ -744,7 +751,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
diag.bug("expected to find top-level re-export name, but found None"); diag.bug("expected to find top-level re-export name, but found None");
} }
}; };
visible_path.extend(path); visible_path.extend_from_slice(&test.path[..]);
// Rather than directly give the test function to the test // Rather than directly give the test function to the test
// harness, we create a wrapper like one of the following: // harness, we create a wrapper like one of the following:

View File

@@ -10,7 +10,6 @@
// Test that a field can have the same name in different variants // Test that a field can have the same name in different variants
// of an enum // of an enum
// FIXME #27889
pub enum Foo { pub enum Foo {
X { foo: u32 }, X { foo: u32 },

View File

@@ -45,7 +45,7 @@ struct Array<T> {
f32: [T; 32], f32: [T; 32],
} }
// FIXME(#7622): merge with `Array` once `[T; N]: Clone` where `T: Clone` // FIXME(#44580): merge with `Array` once `[T; N]: Clone` where `T: Clone`
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
struct CopyArray<T: Copy> { struct CopyArray<T: Copy> {
f00: [T; 00], f00: [T; 00],

View File

@@ -2358,11 +2358,6 @@ impl<'test> TestCx<'test> {
} }
fn run_rmake_test(&self) { fn run_rmake_test(&self) {
// FIXME(#11094): we should fix these tests
if self.config.host != self.config.target {
return;
}
let cwd = env::current_dir().unwrap(); let cwd = env::current_dir().unwrap();
let src_root = self.config let src_root = self.config
.src_base .src_base