Skip to content

Commit

Permalink
Rollup merge of rust-lang#49117 - nivkner:fixme_fixup3, r=estebank
Browse files Browse the repository at this point in the history
address some FIXME whose associated issues were marked as closed

part of rust-lang#44366
  • Loading branch information
kennytm committed Mar 22, 2018
2 parents 245f4c4 + 66d120c commit 8d3f3f0
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/liballoc/tests/slice.rs
Expand Up @@ -1351,7 +1351,7 @@ fn test_copy_from_slice_dst_shorter() {
const MAX_LEN: usize = 80;

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),
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/convert.rs
Expand Up @@ -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
// impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> {
// fn as_ref(&self) -> &U {
Expand All @@ -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
// impl<D: ?Sized + Deref, U: ?Sized> AsMut<U> for D where D::Target: AsMut<U> {
// fn as_mut(&mut self) -> &mut U {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Expand Up @@ -1872,7 +1872,7 @@ impl<I: Iterator> Iterator for Peekable<I> {

#[inline]
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 {
match self.peeked.take() {
Some(v) => v,
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_mir/build/block.rs
Expand Up @@ -117,10 +117,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// Evaluate the initializer, if present.
if let Some(init) = initializer {
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);
this.in_scope(scope, lint_level, block, move |this| {
// FIXME #30046 ^~~~
this.in_scope(scope, lint_level, block, |this| {
this.expr_into_pattern(block, pattern, init)
})
}));
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_mir/util/elaborate_drops.rs
Expand Up @@ -177,7 +177,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
});
}
DropStyle::Conditional => {
let unwind = self.unwind; // FIXME(#6393)
let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ;
let drop_bb = self.complete_drop(Some(DropFlagMode::Deep), succ, unwind);
self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
Expand Down Expand Up @@ -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
// because the "master" drop protects the ADT's discriminant,
// 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),
unwind.map(|unwind| {
Expand Down Expand Up @@ -344,7 +344,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
let interior = self.place.clone().deref();
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 succ = self.box_free_block(ty, succ, unwind);
let unwind_succ = self.unwind.map(|unwind| {
Expand Down Expand Up @@ -717,7 +717,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
ptr_based)
});

let succ = self.succ; // FIXME(#6393)
let succ = self.succ; // FIXME(#43234)
let loop_block = self.drop_loop(
succ,
cur,
Expand Down Expand Up @@ -798,7 +798,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.open_drop_for_adt(def, substs)
}
ty::TyDynamic(..) => {
let unwind = self.unwind; // FIXME(#6393)
let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ;
self.complete_drop(Some(DropFlagMode::Deep), succ, unwind)
}
Expand Down Expand Up @@ -849,7 +849,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>

fn elaborated_drop_block<'a>(&mut self) -> BasicBlock {
debug!("elaborated_drop_block({:?})", self);
let unwind = self.unwind; // FIXME(#6393)
let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ;
let blk = self.drop_block(succ, unwind);
self.elaborate_drop(blk);
Expand Down Expand Up @@ -882,7 +882,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
args: vec![Operand::Move(self.place.clone())],
destination: Some((unit_temp, target)),
cleanup: None
}; // FIXME(#6393)
}; // FIXME(#43234)
let free_block = self.new_block(unwind, call);

let block_start = Location { block: free_block, statement_index: 0 };
Expand Down
25 changes: 3 additions & 22 deletions src/librustc_resolve/resolve_imports.rs
Expand Up @@ -1025,28 +1025,9 @@ fn import_path_to_string(names: &[SpannedIdent],
if names.is_empty() {
import_directive_subclass_to_string(subclass)
} else {
// FIXME: Remove this entire logic after #48116 is fixed.
//
// 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),
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
format!("{}::{}",
names_to_string(names),
import_directive_subclass_to_string(subclass))
}
}
}
Expand Down
21 changes: 6 additions & 15 deletions src/librustc_trans_utils/symbol_names_test.rs
Expand Up @@ -15,7 +15,6 @@
//! paths etc in all kinds of annoying scenarios.

use rustc::hir;
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
use rustc::ty::TyCtxt;
use syntax::ast;

Expand All @@ -34,8 +33,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {

tcx.dep_graph.with_ignore(|| {
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.as_deep_visitor());
tcx.hir.krate().visit_all_item_likes(&mut visitor);
})
}

Expand Down Expand Up @@ -66,23 +64,16 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> {
}
}

impl<'a, 'tcx> Visitor<'tcx> for SymbolNamesTest<'a, 'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::None
}

impl<'a, 'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
self.process_attrs(item.id);
intravisit::walk_item(self, item);
}

fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) {
self.process_attrs(ti.id);
intravisit::walk_trait_item(self, ti)
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
self.process_attrs(trait_item.id);
}

fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
self.process_attrs(ii.id);
intravisit::walk_impl_item(self, ii)
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
self.process_attrs(impl_item.id);
}
}
12 changes: 3 additions & 9 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -2884,27 +2884,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let origin = self.misc(call_span);
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.
match ures {
Ok(ok) => {
// Process any obligations locally as much as
// we can. We don't care if some things turn
// out unconstrained or ambiguous, as we're
// 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 ok = ok; // FIXME(#30046)
for obligation in ok.obligations {
fulfill.register_predicate_obligation(self, obligation);
}
fulfill.select_where_possible(self)
});

match result {
Ok(()) => { }
Err(_) => return Err(()),
}
}).map_err(|_| ())?;
}
Err(_) => return Err(()),
}
Expand Down
1 change: 0 additions & 1 deletion src/libstd/num.rs
Expand Up @@ -169,7 +169,6 @@ mod tests {

macro_rules! test_checked_next_power_of_two {
($test_name:ident, $T:ident) => (
#[cfg_attr(target_os = "emscripten", ignore)] // FIXME(#39119)
fn $test_name() {
#![test]
assert_eq!((0 as $T).checked_next_power_of_two(), Some(1));
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/parse/mod.rs
Expand Up @@ -298,7 +298,6 @@ pub fn str_lit(lit: &str, diag: Option<(Span, &Handler)>) -> String {
debug!("parse_str_lit: given {}", escape_default(lit));
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);

/// Eat everything up to a non-whitespace
Expand Down Expand Up @@ -503,7 +502,6 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
pub fn byte_str_lit(lit: &str) -> Lrc<Vec<u8>> {
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);

/// Eat everything up to a non-whitespace
Expand Down
21 changes: 14 additions & 7 deletions src/libsyntax/test.rs
Expand Up @@ -628,8 +628,15 @@ fn path_node(ids: Vec<Ident>) -> ast::Path {
}

fn path_name_i(idents: &[Ident]) -> String {
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
idents.iter().map(|i| i.to_string()).collect::<Vec<String>>().join("::")
let mut path_name = "".to_string();
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> {
Expand Down Expand Up @@ -682,7 +689,6 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
// gensym information.

let span = ignored_span(cx, test.span);
let path = test.path.clone();
let ecx = &cx.ext_cx;
let self_id = ecx.ident_of("self");
let test_id = ecx.ident_of("test");
Expand All @@ -694,10 +700,11 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
// creates $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"
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));

// self::test::StaticTestName($name_expr)
Expand Down Expand Up @@ -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");
}
};
visible_path.extend(path);
visible_path.extend_from_slice(&test.path[..]);

// Rather than directly give the test function to the test
// harness, we create a wrapper like one of the following:
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-27889.rs
Expand Up @@ -10,7 +10,6 @@

// Test that a field can have the same name in different variants
// of an enum
// FIXME #27889

pub enum Foo {
X { foo: u32 },
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-28561.rs
Expand Up @@ -45,7 +45,7 @@ struct Array<T> {
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)]
struct CopyArray<T: Copy> {
f00: [T; 00],
Expand Down
5 changes: 0 additions & 5 deletions src/tools/compiletest/src/runtest.rs
Expand Up @@ -2358,11 +2358,6 @@ impl<'test> TestCx<'test> {
}

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 src_root = self.config
.src_base
Expand Down

0 comments on commit 8d3f3f0

Please sign in to comment.