Skip to content

Commit

Permalink
Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnay
Browse files Browse the repository at this point in the history
address some FIXME whose associated issues were marked as closed

part of #44366
  • Loading branch information
bors committed Oct 5, 2017
2 parents 4531131 + 559adb7 commit 417c738
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/liballoc/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
}
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
}
}

// FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone).
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
}
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> {
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Eq: PartialEq<Self> {
// FIXME #13101: this method is used solely by #[deriving] to
// assert that every component of a type implements #[deriving]
// this method is used solely by #[deriving] to assert
// that every component of a type implements #[deriving]
// itself, the current deriving infrastructure means doing this
// assertion without using a method on this trait is nearly
// impossible.
Expand Down
1 change: 0 additions & 1 deletion src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#![allow(deprecated)]

// FIXME: #6220 Implement floating point formatting

use fmt;
use ops::{Div, Rem, Sub};
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ use nonzero::NonZero;

use cmp::Ordering::{self, Less, Equal, Greater};

// FIXME #19649: intrinsic docs don't render, so these have no docs :(

#[stable(feature = "rust1", since = "1.0.0")]
pub use intrinsics::copy_nonoverlapping;

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for Split<'a, T, P> where P: FnMut(&T
}
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
fn clone(&self) -> Split<'a, T, P> {
Expand Down Expand Up @@ -2093,7 +2093,7 @@ pub struct Windows<'a, T:'a> {
size: usize
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Windows<'a, T> {
fn clone(&self) -> Windows<'a, T> {
Expand Down Expand Up @@ -2195,7 +2195,7 @@ pub struct Chunks<'a, T:'a> {
size: usize
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Chunks<'a, T> {
fn clone(&self) -> Chunks<'a, T> {
Expand Down
7 changes: 5 additions & 2 deletions src/libcore/tests/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod sip;

use std::hash::{Hash, Hasher};
use std::default::Default;
use std::rc::Rc;

struct MyHasher {
hash: u64,
Expand Down Expand Up @@ -64,12 +65,14 @@ fn test_writer_hasher() {
assert_eq!(hash(& s), 97 + 0xFF);
let s: Box<str> = String::from("a").into_boxed_str();
assert_eq!(hash(& s), 97 + 0xFF);
let s: Rc<&str> = Rc::new("a");
assert_eq!(hash(&s), 97 + 0xFF);
let cs: &[u8] = &[1, 2, 3];
assert_eq!(hash(& cs), 9);
let cs: Box<[u8]> = Box::new([1, 2, 3]);
assert_eq!(hash(& cs), 9);

// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>
let cs: Rc<[u8]> = Rc::new([1, 2, 3]);
assert_eq!(hash(& cs), 9);

let ptr = 5_usize as *const i32;
assert_eq!(hash(&ptr), 5);
Expand Down
11 changes: 8 additions & 3 deletions src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,9 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
}
}

// FIXME: #5516 should be graphemes not codepoints
// FIXME(https://github.com/rust-lang-nursery/getopts/issues/7)
// should be graphemes not codepoints
//
// here we just need to indent the start of the description
let rowlen = row.chars().count();
if rowlen < 24 {
Expand All @@ -749,14 +751,17 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
desc_normalized_whitespace.push(' ');
}

// FIXME: #5516 should be graphemes not codepoints
// FIXME(https://github.com/rust-lang-nursery/getopts/issues/7)
// should be graphemes not codepoints
let mut desc_rows = Vec::new();
each_split_within(&desc_normalized_whitespace[..], 54, |substr| {
desc_rows.push(substr.to_owned());
true
});

// FIXME: #5516 should be graphemes not codepoints
// FIXME(https://github.com/rust-lang-nursery/getopts/issues/7)
// should be graphemes not codepoints
//
// wrapped description
row.push_str(&desc_rows.join(&desc_sep[..]));

Expand Down
3 changes: 2 additions & 1 deletion src/librand/isaac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ impl Clone for Isaac64Rng {
}

impl Rng for Isaac64Rng {
// FIXME #7771: having next_u32 like this should be unnecessary
// FIXME(https://github.com/rust-lang/rfcs/issues/628)
// having next_u32 like this should be unnecessary
#[inline]
fn next_u32(&mut self) -> u32 {
self.next_u64() as u32
Expand Down
3 changes: 2 additions & 1 deletion src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ pub trait Rng: Sized {
///
/// This rarely needs to be called directly, prefer `r.gen()` to
/// `r.next_u32()`.
// FIXME #7771: Should be implemented in terms of next_u64
// FIXME(https://github.com/rust-lang/rfcs/issues/628)
// Should be implemented in terms of next_u64
fn next_u32(&mut self) -> u32;

/// Return the next random u64.
Expand Down
26 changes: 0 additions & 26 deletions src/libcore/benches/mem.rs → src/librustc/benches/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

use test::Bencher;

// FIXME #13642 (these benchmarks should be in another place)
// Completely miscellaneous language-construct benchmarks.
// Static/dynamic method dispatch

struct Struct {
Expand Down Expand Up @@ -44,27 +42,3 @@ fn trait_static_method_call(b: &mut Bencher) {
s.method()
});
}

// Overhead of various match forms

#[bench]
fn match_option_some(b: &mut Bencher) {
let x = Some(10);
b.iter(|| {
match x {
Some(y) => y,
None => 11
}
});
}

#[bench]
fn match_vec_pattern(b: &mut Bencher) {
let x = [1,2,3,4,5,6];
b.iter(|| {
match x {
[1,2,3,..] => 10,
_ => 11,
}
});
}
19 changes: 19 additions & 0 deletions src/librustc/benches/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(warnings)]

#![feature(slice_patterns)]
#![feature(test)]

extern crate test;

mod dispatch;
mod pattern;
35 changes: 35 additions & 0 deletions src/librustc/benches/pattern.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use test::Bencher;

// Overhead of various match forms

#[bench]
fn option_some(b: &mut Bencher) {
let x = Some(10);
b.iter(|| {
match x {
Some(y) => y,
None => 11
}
});
}

#[bench]
fn vec_pattern(b: &mut Bencher) {
let x = [1,2,3,4,5,6];
b.iter(|| {
match x {
[1,2,3,..] => 10,
_ => 11,
}
});
}
2 changes: 0 additions & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,6 @@ impl Stmt_ {
}
}

// FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct Local {
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
inner: table::Iter<'a, K, V>,
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Clone for Iter<'a, K, V> {
fn clone(&self) -> Iter<'a, K, V> {
Expand Down Expand Up @@ -1414,7 +1414,7 @@ pub struct Keys<'a, K: 'a, V: 'a> {
inner: Iter<'a, K, V>,
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Clone for Keys<'a, K, V> {
fn clone(&self) -> Keys<'a, K, V> {
Expand Down Expand Up @@ -1443,7 +1443,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
inner: Iter<'a, K, V>,
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K, V> Clone for Values<'a, K, V> {
fn clone(&self) -> Values<'a, K, V> {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/collections/hash/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ struct RawBuckets<'a, K, V> {
marker: marker::PhantomData<&'a ()>,
}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for RawBuckets<'a, K, V> {
fn clone(&self) -> RawBuckets<'a, K, V> {
RawBuckets {
Expand Down Expand Up @@ -976,7 +976,7 @@ pub struct Iter<'a, K: 'a, V: 'a> {
unsafe impl<'a, K: Sync, V: Sync> Sync for Iter<'a, K, V> {}
unsafe impl<'a, K: Sync, V: Sync> Send for Iter<'a, K, V> {}

// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for Iter<'a, K, V> {
fn clone(&self) -> Iter<'a, K, V> {
Iter {
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,6 @@ pub enum MacStmtStyle {
NoBraces,
}

// FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct Local {
Expand Down

0 comments on commit 417c738

Please sign in to comment.