From 91b3e9cac0125e35d65169fb7e06166a078296c7 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 7 Aug 2015 09:27:27 -0400 Subject: [PATCH] Fallout in libs -- misc missing bounds uncovered by WF checks. --- src/libcore/iter.rs | 2 +- src/libcore/marker.rs | 2 +- src/libcore/num/mod.rs | 4 ++-- src/libcore/str/mod.rs | 3 ++- src/libgraphviz/lib.rs | 2 +- src/librand/distributions/range.rs | 3 ++- src/librustc/middle/astencode.rs | 2 +- src/librustc/middle/expr_use_visitor.rs | 2 +- src/librustc_data_structures/unify/mod.rs | 2 +- src/libserialize/serialize.rs | 2 +- src/libstd/sync/mutex.rs | 2 +- src/libstd/thread/local.rs | 2 +- src/libstd/thread/scoped_tls.rs | 2 +- 13 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 3382095b456..d19f3b6d27a 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2623,7 +2623,7 @@ impl Iterator for Unfold where F: FnMut(&mut St) -> Option { /// two `Step` objects. #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits")] -pub trait Step: PartialOrd { +pub trait Step: PartialOrd+Sized { /// Steps `self` if possible. fn step(&self, by: &Self) -> Option; diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index c0956753c98..32f367e12f0 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -56,7 +56,7 @@ pub trait Sized { /// Types that can be "unsized" to a dynamically sized type. #[unstable(feature = "unsize")] #[lang="unsize"] -pub trait Unsize { +pub trait Unsize { // Empty. } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index ad891bf8fa6..7507e5782d6 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -19,7 +19,7 @@ use char::CharExt; use cmp::{Eq, PartialOrd}; use fmt; use intrinsics; -use marker::Copy; +use marker::{Copy, Sized}; use mem::size_of; use option::Option::{self, Some, None}; use result::Result::{self, Ok, Err}; @@ -1264,7 +1264,7 @@ pub enum FpCategory { #[doc(hidden)] #[unstable(feature = "core_float", reason = "stable interface is via `impl f{32,64}` in later crates")] -pub trait Float { +pub trait Float: Sized { /// Returns the NaN value. fn nan() -> Self; /// Returns the infinite value. diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 3c9338c2cd2..d5bceb3ba62 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -25,6 +25,7 @@ use default::Default; use fmt; use iter::ExactSizeIterator; use iter::{Map, Iterator, DoubleEndedIterator}; +use marker::Sized; use mem; use ops::{Fn, FnMut, FnOnce}; use option::Option::{self, None, Some}; @@ -37,7 +38,7 @@ pub mod pattern; /// A trait to abstract the idea of creating a new instance of a type from a /// string. #[stable(feature = "rust1", since = "1.0.0")] -pub trait FromStr { +pub trait FromStr: Sized { /// The associated error which can be returned from parsing. #[stable(feature = "rust1", since = "1.0.0")] type Err; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index f6f3438f467..a0b571b65ab 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -561,7 +561,7 @@ pub type Edges<'a,E> = Cow<'a,[E]>; /// `Cow<[T]>` to leave implementers the freedom to create /// entirely new vectors or to pass back slices into internally owned /// vectors. -pub trait GraphWalk<'a, N, E> { +pub trait GraphWalk<'a, N: Clone, E: Clone> { /// Returns all the nodes in this graph. fn nodes(&'a self) -> Nodes<'a, N>; /// Returns all of the edges in this graph. diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index e196708368a..26f92ee3b1c 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -12,6 +12,7 @@ // this is surprisingly complicated to be both generic & correct +use core::marker::Sized; use Rng; use distributions::{Sample, IndependentSample}; @@ -57,7 +58,7 @@ impl IndependentSample for Range { /// uniformly between two values. This should not be used directly, /// and is only to facilitate `Range`. #[doc(hidden)] -pub trait SampleRange { +pub trait SampleRange: Sized { /// Construct the `Range` object that `sample_range` /// requires. This should not ever be called directly, only via /// `Range::new`, which will check that `low < high`, so this diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 5c3b0a1c2d2..c064b31173f 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1061,7 +1061,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext, } } -trait doc_decoder_helpers { +trait doc_decoder_helpers: Sized { fn as_int(&self) -> isize; fn opt_child(&self, tag: c::astencode_tag) -> Option; } diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 3755b4c57c3..a97fe84e6ac 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -239,7 +239,7 @@ impl OverloadedCallType { // supplies types from the tree. After type checking is complete, you // can just use the tcx as the typer. -pub struct ExprUseVisitor<'d,'t,'a: 't, 'tcx:'a> { +pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { typer: &'t infer::InferCtxt<'a, 'tcx>, mc: mc::MemCategorizationContext<'t, 'a, 'tcx>, delegate: &'d mut (Delegate<'tcx>+'d), diff --git a/src/librustc_data_structures/unify/mod.rs b/src/librustc_data_structures/unify/mod.rs index 7582b7ff61d..4d79b1a64c1 100644 --- a/src/librustc_data_structures/unify/mod.rs +++ b/src/librustc_data_structures/unify/mod.rs @@ -272,7 +272,7 @@ impl<'tcx,K> UnificationTable impl<'tcx,K,V> UnificationTable where K: UnifyKey>, - V: Clone+PartialEq, + V: Clone+PartialEq+Debug, { pub fn unify_var_var(&mut self, a_id: K, diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index af138734610..5e96ec6ab0d 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -194,7 +194,7 @@ pub trait Encodable { fn encode(&self, s: &mut S) -> Result<(), S::Error>; } -pub trait Decodable { +pub trait Decodable: Sized { fn decode(d: &mut D) -> Result; } diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 4b62434d068..773bd7f5606 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -369,7 +369,7 @@ mod tests { use sync::{Arc, Mutex, StaticMutex, Condvar}; use thread; - struct Packet(Arc<(Mutex, Condvar)>); + struct Packet(Arc<(Mutex, Condvar)>); unsafe impl Send for Packet {} unsafe impl Sync for Packet {} diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 3bf170b5fe2..a228cbfd85b 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -60,7 +60,7 @@ pub use self::imp::Key as __KeyInner; /// }); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -pub struct LocalKey { +pub struct LocalKey { // The key itself may be tagged with #[thread_local], and this `Key` is // stored as a `static`, and it's not valid for a static to reference the // address of another thread_local static. For this reason we kinda wonkily diff --git a/src/libstd/thread/scoped_tls.rs b/src/libstd/thread/scoped_tls.rs index 303ab0f9f01..810e3bb62f7 100644 --- a/src/libstd/thread/scoped_tls.rs +++ b/src/libstd/thread/scoped_tls.rs @@ -55,7 +55,7 @@ pub use self::imp::KeyInner as __KeyInner; #[unstable(feature = "scoped_tls", reason = "scoped TLS has yet to have wide enough use to fully consider \ stabilizing its interface")] -pub struct ScopedKey { inner: fn() -> &'static imp::KeyInner } +pub struct ScopedKey { inner: fn() -> &'static imp::KeyInner } /// Declare a new scoped thread local storage key. ///