rustc: Fix a number of stability lint holes
There are a number of holes that the stability lint did not previously cover, including: * Types * Bounds on type parameters on functions and impls * Where clauses * Imports * Patterns (structs and enums) These holes have all been fixed by overriding the `visit_path` function on the AST visitor instead of a few specialized cases. This change also necessitated a few stability changes: * The `collections::fmt` module is now stable (it was already supposed to be). * The `thread_local:👿:Key` type is now stable (it was already supposed to be). * The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable. These are required via the `panic!` macro. * The `std::old_io::stdio::{println, println_args}` functions are now stable. These are required by the `print!` and `println!` macros. * The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to make bounds with these traits stable. Note that manual implementations of these traits are still gated by default, this stability only allows bounds such as `F: FnOnce()`. Additionally, the compiler now has special logic to ignore its own generated `__test` module for the `--test` harness in terms of stability. Closes #8962 Closes #16360 Closes #20327 [breaking-change]
This commit is contained in:
parent
446bc899b2
commit
bbbb571fee
35 changed files with 187 additions and 127 deletions
|
@ -401,7 +401,7 @@
|
||||||
//! them with the same character. For example, the `{` character is escaped with
|
//! them with the same character. For example, the `{` character is escaped with
|
||||||
//! `{{` and the `}` character is escaped with `}}`.
|
//! `{{` and the `}` character is escaped with `}}`.
|
||||||
|
|
||||||
#![unstable(feature = "std_misc")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
pub use core::fmt::{Formatter, Result, Writer, rt};
|
pub use core::fmt::{Formatter, Result, Writer, rt};
|
||||||
pub use core::fmt::{Show, String, Octal, Binary};
|
pub use core::fmt::{Show, String, Octal, Binary};
|
||||||
|
|
|
@ -268,6 +268,7 @@ pub trait Debug {
|
||||||
fn fmt(&self, &mut Formatter) -> Result;
|
fn fmt(&self, &mut Formatter) -> Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<T: Show + ?Sized> Debug for T {
|
impl<T: Show + ?Sized> Debug for T {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result { Show::fmt(self, f) }
|
fn fmt(&self, f: &mut Formatter) -> Result { Show::fmt(self, f) }
|
||||||
|
@ -295,6 +296,7 @@ pub trait Display {
|
||||||
fn fmt(&self, &mut Formatter) -> Result;
|
fn fmt(&self, &mut Formatter) -> Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<T: String + ?Sized> Display for T {
|
impl<T: String + ?Sized> Display for T {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result { String::fmt(self, f) }
|
fn fmt(&self, f: &mut Formatter) -> Result { String::fmt(self, f) }
|
||||||
|
|
|
@ -1119,8 +1119,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
|
||||||
|
|
||||||
/// A version of the call operator that takes an immutable receiver.
|
/// A version of the call operator that takes an immutable receiver.
|
||||||
#[lang="fn"]
|
#[lang="fn"]
|
||||||
#[unstable(feature = "core",
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
reason = "uncertain about variadic generics, input versus associated types")]
|
|
||||||
#[rustc_paren_sugar]
|
#[rustc_paren_sugar]
|
||||||
pub trait Fn<Args> {
|
pub trait Fn<Args> {
|
||||||
type Output;
|
type Output;
|
||||||
|
@ -1131,8 +1130,7 @@ pub trait Fn<Args> {
|
||||||
|
|
||||||
/// A version of the call operator that takes a mutable receiver.
|
/// A version of the call operator that takes a mutable receiver.
|
||||||
#[lang="fn_mut"]
|
#[lang="fn_mut"]
|
||||||
#[unstable(feature = "core",
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
reason = "uncertain about variadic generics, input versus associated types")]
|
|
||||||
#[rustc_paren_sugar]
|
#[rustc_paren_sugar]
|
||||||
pub trait FnMut<Args> {
|
pub trait FnMut<Args> {
|
||||||
type Output;
|
type Output;
|
||||||
|
@ -1143,8 +1141,7 @@ pub trait FnMut<Args> {
|
||||||
|
|
||||||
/// A version of the call operator that takes a by-value receiver.
|
/// A version of the call operator that takes a by-value receiver.
|
||||||
#[lang="fn_once"]
|
#[lang="fn_once"]
|
||||||
#[unstable(feature = "core",
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
reason = "uncertain about variadic generics, input versus associated types")]
|
|
||||||
#[rustc_paren_sugar]
|
#[rustc_paren_sugar]
|
||||||
pub trait FnOnce<Args> {
|
pub trait FnOnce<Args> {
|
||||||
type Output;
|
type Output;
|
||||||
|
|
|
@ -34,7 +34,7 @@ use ptr::PtrExt;
|
||||||
use raw::{Repr, Slice};
|
use raw::{Repr, Slice};
|
||||||
use result::Result::{self, Ok, Err};
|
use result::Result::{self, Ok, Err};
|
||||||
use slice::{self, SliceExt};
|
use slice::{self, SliceExt};
|
||||||
use uint;
|
use usize;
|
||||||
|
|
||||||
macro_rules! delegate_iter {
|
macro_rules! delegate_iter {
|
||||||
(exact $te:ty : $ti:ty) => {
|
(exact $te:ty : $ti:ty) => {
|
||||||
|
@ -783,7 +783,7 @@ impl TwoWaySearcher {
|
||||||
byteset: byteset,
|
byteset: byteset,
|
||||||
|
|
||||||
position: 0,
|
position: 0,
|
||||||
memory: uint::MAX // Dummy value to signify that the period is long
|
memory: usize::MAX // Dummy value to signify that the period is long
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ impl Searcher {
|
||||||
Naive(NaiveSearcher::new())
|
Naive(NaiveSearcher::new())
|
||||||
} else {
|
} else {
|
||||||
let searcher = TwoWaySearcher::new(needle);
|
let searcher = TwoWaySearcher::new(needle);
|
||||||
if searcher.memory == uint::MAX { // If the period is long
|
if searcher.memory == usize::MAX { // If the period is long
|
||||||
TwoWayLong(searcher)
|
TwoWayLong(searcher)
|
||||||
} else {
|
} else {
|
||||||
TwoWay(searcher)
|
TwoWay(searcher)
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl fmt::Display for Error {
|
||||||
pub mod reader {
|
pub mod reader {
|
||||||
use std::char;
|
use std::char;
|
||||||
|
|
||||||
use std::int;
|
use std::isize;
|
||||||
use std::old_io::extensions::u64_from_be_bytes;
|
use std::old_io::extensions::u64_from_be_bytes;
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
use std::num::Int;
|
use std::num::Int;
|
||||||
|
@ -440,7 +440,7 @@ pub mod reader {
|
||||||
fn read_u8 (&mut self) -> DecodeResult<u8 > { Ok(doc_as_u8 (try!(self.next_doc(EsU8 )))) }
|
fn read_u8 (&mut self) -> DecodeResult<u8 > { Ok(doc_as_u8 (try!(self.next_doc(EsU8 )))) }
|
||||||
fn read_uint(&mut self) -> DecodeResult<uint> {
|
fn read_uint(&mut self) -> DecodeResult<uint> {
|
||||||
let v = doc_as_u64(try!(self.next_doc(EsUint)));
|
let v = doc_as_u64(try!(self.next_doc(EsUint)));
|
||||||
if v > (::std::uint::MAX as u64) {
|
if v > (::std::usize::MAX as u64) {
|
||||||
Err(IntTooBig(v as uint))
|
Err(IntTooBig(v as uint))
|
||||||
} else {
|
} else {
|
||||||
Ok(v as uint)
|
Ok(v as uint)
|
||||||
|
@ -461,7 +461,7 @@ pub mod reader {
|
||||||
}
|
}
|
||||||
fn read_int(&mut self) -> DecodeResult<int> {
|
fn read_int(&mut self) -> DecodeResult<int> {
|
||||||
let v = doc_as_u64(try!(self.next_doc(EsInt))) as i64;
|
let v = doc_as_u64(try!(self.next_doc(EsInt))) as i64;
|
||||||
if v > (int::MAX as i64) || v < (int::MIN as i64) {
|
if v > (isize::MAX as i64) || v < (isize::MIN as i64) {
|
||||||
debug!("FIXME \\#6122: Removing this makes this function miscompile");
|
debug!("FIXME \\#6122: Removing this makes this function miscompile");
|
||||||
Err(IntTooBig(v as uint))
|
Err(IntTooBig(v as uint))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1768,6 +1768,11 @@ impl LintPass for Stability {
|
||||||
stability::check_expr(cx.tcx, e,
|
stability::check_expr(cx.tcx, e,
|
||||||
&mut |id, sp, stab| self.lint(cx, id, sp, stab));
|
&mut |id, sp, stab| self.lint(cx, id, sp, stab));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn check_path(&mut self, cx: &Context, path: &ast::Path, id: ast::NodeId) {
|
||||||
|
stability::check_path(cx.tcx, path, id,
|
||||||
|
&mut |id, sp, stab| self.lint(cx, id, sp, stab));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
|
|
|
@ -20,7 +20,7 @@ use middle::cfg;
|
||||||
use middle::cfg::CFGIndex;
|
use middle::cfg::CFGIndex;
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
use std::old_io;
|
use std::old_io;
|
||||||
use std::uint;
|
use std::usize;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util::IdRange;
|
use syntax::ast_util::IdRange;
|
||||||
|
@ -48,7 +48,7 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
||||||
bits_per_id: uint,
|
bits_per_id: uint,
|
||||||
|
|
||||||
/// number of words we will use to store bits_per_id.
|
/// number of words we will use to store bits_per_id.
|
||||||
/// equal to bits_per_id/uint::BITS rounded up.
|
/// equal to bits_per_id/usize::BITS rounded up.
|
||||||
words_per_id: uint,
|
words_per_id: uint,
|
||||||
|
|
||||||
// mapping from node to cfg node index
|
// mapping from node to cfg node index
|
||||||
|
@ -193,7 +193,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||||
oper: O,
|
oper: O,
|
||||||
id_range: IdRange,
|
id_range: IdRange,
|
||||||
bits_per_id: uint) -> DataFlowContext<'a, 'tcx, O> {
|
bits_per_id: uint) -> DataFlowContext<'a, 'tcx, O> {
|
||||||
let words_per_id = (bits_per_id + uint::BITS - 1) / uint::BITS;
|
let words_per_id = (bits_per_id + usize::BITS - 1) / usize::BITS;
|
||||||
let num_nodes = cfg.graph.all_nodes().len();
|
let num_nodes = cfg.graph.all_nodes().len();
|
||||||
|
|
||||||
debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
|
debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
|
||||||
|
@ -202,7 +202,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||||
analysis_name, id_range, bits_per_id, words_per_id,
|
analysis_name, id_range, bits_per_id, words_per_id,
|
||||||
num_nodes);
|
num_nodes);
|
||||||
|
|
||||||
let entry = if oper.initial_value() { uint::MAX } else {0};
|
let entry = if oper.initial_value() { usize::MAX } else {0};
|
||||||
|
|
||||||
let gens: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
|
let gens: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
|
||||||
let kills: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
|
let kills: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
|
||||||
|
@ -351,13 +351,13 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||||
|
|
||||||
for (word_index, &word) in words.iter().enumerate() {
|
for (word_index, &word) in words.iter().enumerate() {
|
||||||
if word != 0 {
|
if word != 0 {
|
||||||
let base_index = word_index * uint::BITS;
|
let base_index = word_index * usize::BITS;
|
||||||
for offset in 0..uint::BITS {
|
for offset in 0..usize::BITS {
|
||||||
let bit = 1 << offset;
|
let bit = 1 << offset;
|
||||||
if (word & bit) != 0 {
|
if (word & bit) != 0 {
|
||||||
// NB: we round up the total number of bits
|
// NB: we round up the total number of bits
|
||||||
// that we store in any given bit set so that
|
// that we store in any given bit set so that
|
||||||
// it is an even multiple of uint::BITS. This
|
// it is an even multiple of usize::BITS. This
|
||||||
// means that there may be some stray bits at
|
// means that there may be some stray bits at
|
||||||
// the end that do not correspond to any
|
// the end that do not correspond to any
|
||||||
// actual value. So before we callback, check
|
// actual value. So before we callback, check
|
||||||
|
@ -500,7 +500,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self, bits: &mut [uint]) {
|
fn reset(&mut self, bits: &mut [uint]) {
|
||||||
let e = if self.dfcx.oper.initial_value() {uint::MAX} else {0};
|
let e = if self.dfcx.oper.initial_value() {usize::MAX} else {0};
|
||||||
for b in bits {
|
for b in bits {
|
||||||
*b = e;
|
*b = e;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ fn bits_to_string(words: &[uint]) -> String {
|
||||||
|
|
||||||
for &word in words {
|
for &word in words {
|
||||||
let mut v = word;
|
let mut v = word;
|
||||||
for _ in 0..uint::BYTES {
|
for _ in 0..usize::BYTES {
|
||||||
result.push(sep);
|
result.push(sep);
|
||||||
result.push_str(&format!("{:02x}", v & 0xFF)[]);
|
result.push_str(&format!("{:02x}", v & 0xFF)[]);
|
||||||
v >>= 8;
|
v >>= 8;
|
||||||
|
@ -581,8 +581,8 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
|
||||||
fn set_bit(words: &mut [uint], bit: uint) -> bool {
|
fn set_bit(words: &mut [uint], bit: uint) -> bool {
|
||||||
debug!("set_bit: words={} bit={}",
|
debug!("set_bit: words={} bit={}",
|
||||||
mut_bits_to_string(words), bit_str(bit));
|
mut_bits_to_string(words), bit_str(bit));
|
||||||
let word = bit / uint::BITS;
|
let word = bit / usize::BITS;
|
||||||
let bit_in_word = bit % uint::BITS;
|
let bit_in_word = bit % usize::BITS;
|
||||||
let bit_mask = 1 << bit_in_word;
|
let bit_mask = 1 << bit_in_word;
|
||||||
debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word);
|
debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word);
|
||||||
let oldv = words[word];
|
let oldv = words[word];
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#![allow(dead_code)] // still WIP
|
#![allow(dead_code)] // still WIP
|
||||||
|
|
||||||
use std::fmt::{Formatter, Error, Debug};
|
use std::fmt::{Formatter, Error, Debug};
|
||||||
use std::uint;
|
use std::usize;
|
||||||
use std::collections::BitvSet;
|
use std::collections::BitvSet;
|
||||||
|
|
||||||
pub struct Graph<N,E> {
|
pub struct Graph<N,E> {
|
||||||
|
@ -64,12 +64,12 @@ impl<E: Debug> Debug for Edge<E> {
|
||||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||||
pub struct NodeIndex(pub uint);
|
pub struct NodeIndex(pub uint);
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
|
pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX);
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Debug)]
|
#[derive(Copy, PartialEq, Debug)]
|
||||||
pub struct EdgeIndex(pub uint);
|
pub struct EdgeIndex(pub uint);
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
|
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX);
|
||||||
|
|
||||||
// Use a private field here to guarantee no more instances are created:
|
// Use a private field here to guarantee no more instances are created:
|
||||||
#[derive(Copy, Debug)]
|
#[derive(Copy, Debug)]
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
use session::Session;
|
use session::Session;
|
||||||
use lint;
|
use lint;
|
||||||
|
use middle::def;
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
use middle::privacy::PublicItems;
|
use middle::privacy::PublicItems;
|
||||||
use metadata::csearch;
|
use metadata::csearch;
|
||||||
|
@ -277,6 +278,11 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
|
||||||
|
|
||||||
impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
|
impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
|
||||||
fn visit_item(&mut self, item: &ast::Item) {
|
fn visit_item(&mut self, item: &ast::Item) {
|
||||||
|
// When compiling with --test we don't enforce stability on the
|
||||||
|
// compiler-generated test module, demarcated with `DUMMY_SP` plus the
|
||||||
|
// name `__test`
|
||||||
|
if item.span == DUMMY_SP && item.ident.as_str() == "__test" { return }
|
||||||
|
|
||||||
check_item(self.tcx, item,
|
check_item(self.tcx, item,
|
||||||
&mut |id, sp, stab| self.check(id, sp, stab));
|
&mut |id, sp, stab| self.check(id, sp, stab));
|
||||||
visit::walk_item(self, item);
|
visit::walk_item(self, item);
|
||||||
|
@ -287,6 +293,12 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
|
||||||
&mut |id, sp, stab| self.check(id, sp, stab));
|
&mut |id, sp, stab| self.check(id, sp, stab));
|
||||||
visit::walk_expr(self, ex);
|
visit::walk_expr(self, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId) {
|
||||||
|
check_path(self.tcx, path, id,
|
||||||
|
&mut |id, sp, stab| self.check(id, sp, stab));
|
||||||
|
visit::walk_path(self, path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper for discovering nodes to check for stability
|
/// Helper for discovering nodes to check for stability
|
||||||
|
@ -304,18 +316,6 @@ pub fn check_item(tcx: &ty::ctxt, item: &ast::Item,
|
||||||
let id = ast::DefId { krate: cnum, node: ast::CRATE_NODE_ID };
|
let id = ast::DefId { krate: cnum, node: ast::CRATE_NODE_ID };
|
||||||
maybe_do_stability_check(tcx, id, item.span, cb);
|
maybe_do_stability_check(tcx, id, item.span, cb);
|
||||||
}
|
}
|
||||||
ast::ItemTrait(_, _, ref supertraits, _) => {
|
|
||||||
for t in &**supertraits {
|
|
||||||
if let ast::TraitTyParamBound(ref t, _) = *t {
|
|
||||||
let id = ty::trait_ref_to_def_id(tcx, &t.trait_ref);
|
|
||||||
maybe_do_stability_check(tcx, id, t.trait_ref.path.span, cb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast::ItemImpl(_, _, _, Some(ref t), _, _) => {
|
|
||||||
let id = ty::trait_ref_to_def_id(tcx, t);
|
|
||||||
maybe_do_stability_check(tcx, id, t.path.span, cb);
|
|
||||||
}
|
|
||||||
_ => (/* pass */)
|
_ => (/* pass */)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,15 +325,8 @@ pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
|
||||||
cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
|
cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
|
||||||
if is_internal(tcx, e.span) { return; }
|
if is_internal(tcx, e.span) { return; }
|
||||||
|
|
||||||
let mut span = e.span;
|
let span;
|
||||||
|
|
||||||
let id = match e.node {
|
let id = match e.node {
|
||||||
ast::ExprPath(..) | ast::ExprQPath(..) | ast::ExprStruct(..) => {
|
|
||||||
match tcx.def_map.borrow().get(&e.id) {
|
|
||||||
Some(&def) => def.def_id(),
|
|
||||||
None => return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast::ExprMethodCall(i, _, _) => {
|
ast::ExprMethodCall(i, _, _) => {
|
||||||
span = i.span;
|
span = i.span;
|
||||||
let method_call = ty::MethodCall::expr(e.id);
|
let method_call = ty::MethodCall::expr(e.id);
|
||||||
|
@ -369,6 +362,16 @@ pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
|
||||||
maybe_do_stability_check(tcx, id, span, cb);
|
maybe_do_stability_check(tcx, id, span, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn check_path(tcx: &ty::ctxt, path: &ast::Path, id: ast::NodeId,
|
||||||
|
cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
|
||||||
|
let did = match tcx.def_map.borrow().get(&id) {
|
||||||
|
Some(&def::DefPrimTy(..)) => return,
|
||||||
|
Some(def) => def.def_id(),
|
||||||
|
None => return
|
||||||
|
};
|
||||||
|
maybe_do_stability_check(tcx, did, path.span, cb)
|
||||||
|
}
|
||||||
|
|
||||||
fn maybe_do_stability_check(tcx: &ty::ctxt, id: ast::DefId, span: Span,
|
fn maybe_do_stability_check(tcx: &ty::ctxt, id: ast::DefId, span: Span,
|
||||||
cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
|
cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
|
||||||
if !is_staged_api(tcx, id) { return }
|
if !is_staged_api(tcx, id) { return }
|
||||||
|
|
|
@ -24,7 +24,7 @@ use rustc::util::nodemap::{FnvHashMap, NodeSet};
|
||||||
use rustc::util::ppaux::Repr;
|
use rustc::util::ppaux::Repr;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::uint;
|
use std::usize;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util;
|
use syntax::ast_util;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
|
@ -92,7 +92,7 @@ impl Clone for MovePathIndex {
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
static InvalidMovePathIndex: MovePathIndex =
|
static InvalidMovePathIndex: MovePathIndex =
|
||||||
MovePathIndex(uint::MAX);
|
MovePathIndex(usize::MAX);
|
||||||
|
|
||||||
/// Index into `MoveData.moves`, used like a pointer
|
/// Index into `MoveData.moves`, used like a pointer
|
||||||
#[derive(Copy, PartialEq)]
|
#[derive(Copy, PartialEq)]
|
||||||
|
@ -106,7 +106,7 @@ impl MoveIndex {
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
static InvalidMoveIndex: MoveIndex =
|
static InvalidMoveIndex: MoveIndex =
|
||||||
MoveIndex(uint::MAX);
|
MoveIndex(usize::MAX);
|
||||||
|
|
||||||
pub struct MovePath<'tcx> {
|
pub struct MovePath<'tcx> {
|
||||||
/// Loan path corresponding to this move path
|
/// Loan path corresponding to this move path
|
||||||
|
|
|
@ -101,7 +101,7 @@ use std::cell::{Cell, RefCell};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::rc::{Rc, Weak};
|
use std::rc::{Rc, Weak};
|
||||||
use std::uint;
|
use std::usize;
|
||||||
|
|
||||||
// NB: This module needs to be declared first so diagnostics are
|
// NB: This module needs to be declared first so diagnostics are
|
||||||
// registered before they are used.
|
// registered before they are used.
|
||||||
|
@ -4366,7 +4366,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
for rib in this.value_ribs.iter().rev() {
|
for rib in this.value_ribs.iter().rev() {
|
||||||
for (&k, _) in &rib.bindings {
|
for (&k, _) in &rib.bindings {
|
||||||
maybes.push(token::get_name(k));
|
maybes.push(token::get_name(k));
|
||||||
values.push(uint::MAX);
|
values.push(usize::MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4380,7 +4380,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if values.len() > 0 &&
|
if values.len() > 0 &&
|
||||||
values[smallest] != uint::MAX &&
|
values[smallest] != usize::MAX &&
|
||||||
values[smallest] < name.len() + 2 &&
|
values[smallest] < name.len() + 2 &&
|
||||||
values[smallest] <= max_distance &&
|
values[smallest] <= max_distance &&
|
||||||
name != &maybes[smallest][] {
|
name != &maybes[smallest][] {
|
||||||
|
|
|
@ -79,6 +79,7 @@ This API is completely unstable and subject to change.
|
||||||
#![feature(collections)]
|
#![feature(collections)]
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
|
#![feature(std_misc)]
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
|
|
@ -12,7 +12,7 @@ use std::collections::HashSet;
|
||||||
use rustc::util::nodemap::NodeSet;
|
use rustc::util::nodemap::NodeSet;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::uint;
|
use std::usize;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util;
|
use syntax::ast_util;
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ pub fn unindent(s: &str) -> String {
|
||||||
let lines = s.lines_any().collect::<Vec<&str> >();
|
let lines = s.lines_any().collect::<Vec<&str> >();
|
||||||
let mut saw_first_line = false;
|
let mut saw_first_line = false;
|
||||||
let mut saw_second_line = false;
|
let mut saw_second_line = false;
|
||||||
let min_indent = lines.iter().fold(uint::MAX, |min_indent, line| {
|
let min_indent = lines.iter().fold(usize::MAX, |min_indent, line| {
|
||||||
|
|
||||||
// After we see the first non-whitespace line, look at
|
// After we see the first non-whitespace line, look at
|
||||||
// the line we have. If it is not whitespace, and therefore
|
// the line we have. If it is not whitespace, and therefore
|
||||||
|
@ -322,7 +322,7 @@ pub fn unindent(s: &str) -> String {
|
||||||
!line.chars().all(|c| c.is_whitespace());
|
!line.chars().all(|c| c.is_whitespace());
|
||||||
|
|
||||||
let min_indent = if ignore_previous_indents {
|
let min_indent = if ignore_previous_indents {
|
||||||
uint::MAX
|
usize::MAX
|
||||||
} else {
|
} else {
|
||||||
min_indent
|
min_indent
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
//! Implementations of serialization for structures found in libcollections
|
//! Implementations of serialization for structures found in libcollections
|
||||||
|
|
||||||
use std::uint;
|
use std::usize;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::collections::hash_state::HashState;
|
use std::collections::hash_state::HashState;
|
||||||
|
@ -148,7 +148,7 @@ impl<
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> {
|
||||||
let bits = try!(d.read_uint());
|
let bits = try!(d.read_uint());
|
||||||
let mut set = EnumSet::new();
|
let mut set = EnumSet::new();
|
||||||
for bit in 0..uint::BITS {
|
for bit in 0..usize::BITS {
|
||||||
if bits & (1 << bit) != 0 {
|
if bits & (1 << bit) != 0 {
|
||||||
set.insert(CLike::from_usize(1 << bit));
|
set.insert(CLike::from_usize(1 << bit));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ Core encoding and decoding interfaces.
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(io)]
|
#![feature(io)]
|
||||||
#![feature(path)]
|
#![feature(path)]
|
||||||
|
#![feature(hash)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(slicing_syntax)]
|
#![feature(slicing_syntax)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
|
|
|
@ -164,6 +164,7 @@ pub use core::cell;
|
||||||
pub use core::clone;
|
pub use core::clone;
|
||||||
#[cfg(not(test))] pub use core::cmp;
|
#[cfg(not(test))] pub use core::cmp;
|
||||||
pub use core::default;
|
pub use core::default;
|
||||||
|
#[allow(deprecated)]
|
||||||
pub use core::finally;
|
pub use core::finally;
|
||||||
pub use core::hash;
|
pub use core::hash;
|
||||||
pub use core::intrinsics;
|
pub use core::intrinsics;
|
||||||
|
@ -306,8 +307,8 @@ mod std {
|
||||||
pub use marker; // used for tls!
|
pub use marker; // used for tls!
|
||||||
pub use ops; // used for bitflags!
|
pub use ops; // used for bitflags!
|
||||||
|
|
||||||
// The test runner calls ::std::os::args() but really wants realstd
|
// The test runner calls ::std::env::args() but really wants realstd
|
||||||
#[cfg(test)] pub use realstd::os as os;
|
#[cfg(test)] pub use realstd::env as env;
|
||||||
// The test runner requires std::slice::Vector, so re-export std::slice just for it.
|
// The test runner requires std::slice::Vector, so re-export std::slice just for it.
|
||||||
//
|
//
|
||||||
// It is also used in vec![]
|
// It is also used in vec![]
|
||||||
|
|
|
@ -66,6 +66,7 @@ impl Writer for Vec<u8> {
|
||||||
#[deprecated(since = "1.0.0",
|
#[deprecated(since = "1.0.0",
|
||||||
reason = "use the Vec<u8> Writer implementation directly")]
|
reason = "use the Vec<u8> Writer implementation directly")]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub struct MemWriter {
|
pub struct MemWriter {
|
||||||
buf: Vec<u8>,
|
buf: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ use char::CharExt;
|
||||||
use default::Default;
|
use default::Default;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use fmt;
|
use fmt;
|
||||||
use int;
|
use isize;
|
||||||
use iter::{Iterator, IteratorExt};
|
use iter::{Iterator, IteratorExt};
|
||||||
use marker::Sized;
|
use marker::Sized;
|
||||||
use mem::transmute;
|
use mem::transmute;
|
||||||
|
@ -265,7 +265,7 @@ use slice::SliceExt;
|
||||||
use str::StrExt;
|
use str::StrExt;
|
||||||
use str;
|
use str;
|
||||||
use string::String;
|
use string::String;
|
||||||
use uint;
|
use usize;
|
||||||
use unicode;
|
use unicode;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
|
@ -711,28 +711,28 @@ pub trait Reader {
|
||||||
///
|
///
|
||||||
/// The number of bytes returned is system-dependent.
|
/// The number of bytes returned is system-dependent.
|
||||||
fn read_le_uint(&mut self) -> IoResult<uint> {
|
fn read_le_uint(&mut self) -> IoResult<uint> {
|
||||||
self.read_le_uint_n(uint::BYTES).map(|i| i as uint)
|
self.read_le_uint_n(usize::BYTES).map(|i| i as uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads a little-endian integer.
|
/// Reads a little-endian integer.
|
||||||
///
|
///
|
||||||
/// The number of bytes returned is system-dependent.
|
/// The number of bytes returned is system-dependent.
|
||||||
fn read_le_int(&mut self) -> IoResult<int> {
|
fn read_le_int(&mut self) -> IoResult<int> {
|
||||||
self.read_le_int_n(int::BYTES).map(|i| i as int)
|
self.read_le_int_n(isize::BYTES).map(|i| i as int)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads a big-endian unsigned integer.
|
/// Reads a big-endian unsigned integer.
|
||||||
///
|
///
|
||||||
/// The number of bytes returned is system-dependent.
|
/// The number of bytes returned is system-dependent.
|
||||||
fn read_be_uint(&mut self) -> IoResult<uint> {
|
fn read_be_uint(&mut self) -> IoResult<uint> {
|
||||||
self.read_be_uint_n(uint::BYTES).map(|i| i as uint)
|
self.read_be_uint_n(usize::BYTES).map(|i| i as uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads a big-endian integer.
|
/// Reads a big-endian integer.
|
||||||
///
|
///
|
||||||
/// The number of bytes returned is system-dependent.
|
/// The number of bytes returned is system-dependent.
|
||||||
fn read_be_int(&mut self) -> IoResult<int> {
|
fn read_be_int(&mut self) -> IoResult<int> {
|
||||||
self.read_be_int_n(int::BYTES).map(|i| i as int)
|
self.read_be_int_n(isize::BYTES).map(|i| i as int)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads a big-endian `u64`.
|
/// Reads a big-endian `u64`.
|
||||||
|
@ -1095,25 +1095,25 @@ pub trait Writer {
|
||||||
/// Write a little-endian uint (number of bytes depends on system).
|
/// Write a little-endian uint (number of bytes depends on system).
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_le_uint(&mut self, n: uint) -> IoResult<()> {
|
fn write_le_uint(&mut self, n: uint) -> IoResult<()> {
|
||||||
extensions::u64_to_le_bytes(n as u64, uint::BYTES, |v| self.write_all(v))
|
extensions::u64_to_le_bytes(n as u64, usize::BYTES, |v| self.write_all(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a little-endian int (number of bytes depends on system).
|
/// Write a little-endian int (number of bytes depends on system).
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_le_int(&mut self, n: int) -> IoResult<()> {
|
fn write_le_int(&mut self, n: int) -> IoResult<()> {
|
||||||
extensions::u64_to_le_bytes(n as u64, int::BYTES, |v| self.write_all(v))
|
extensions::u64_to_le_bytes(n as u64, isize::BYTES, |v| self.write_all(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a big-endian uint (number of bytes depends on system).
|
/// Write a big-endian uint (number of bytes depends on system).
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_be_uint(&mut self, n: uint) -> IoResult<()> {
|
fn write_be_uint(&mut self, n: uint) -> IoResult<()> {
|
||||||
extensions::u64_to_be_bytes(n as u64, uint::BYTES, |v| self.write_all(v))
|
extensions::u64_to_be_bytes(n as u64, usize::BYTES, |v| self.write_all(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a big-endian int (number of bytes depends on system).
|
/// Write a big-endian int (number of bytes depends on system).
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_be_int(&mut self, n: int) -> IoResult<()> {
|
fn write_be_int(&mut self, n: int) -> IoResult<()> {
|
||||||
extensions::u64_to_be_bytes(n as u64, int::BYTES, |v| self.write_all(v))
|
extensions::u64_to_be_bytes(n as u64, isize::BYTES, |v| self.write_all(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a big-endian u64 (8 bytes).
|
/// Write a big-endian u64 (8 bytes).
|
||||||
|
@ -1843,7 +1843,7 @@ mod tests {
|
||||||
use self::BadReaderBehavior::*;
|
use self::BadReaderBehavior::*;
|
||||||
use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer};
|
use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer};
|
||||||
use prelude::v1::{Ok, Vec, Buffer, SliceExt};
|
use prelude::v1::{Ok, Vec, Buffer, SliceExt};
|
||||||
use uint;
|
use usize;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
enum BadReaderBehavior {
|
enum BadReaderBehavior {
|
||||||
|
@ -1890,24 +1890,24 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_read_at_least() {
|
fn test_read_at_least() {
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![GoodBehavior(uint::MAX)]);
|
vec![GoodBehavior(usize::MAX)]);
|
||||||
let buf = &mut [0u8; 5];
|
let buf = &mut [0u8; 5];
|
||||||
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
||||||
assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least
|
assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least
|
||||||
assert!(r.read_at_least(0, buf).is_ok());
|
assert!(r.read_at_least(0, buf).is_ok());
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(50), GoodBehavior(uint::MAX)]);
|
vec![BadBehavior(50), GoodBehavior(usize::MAX)]);
|
||||||
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(1), GoodBehavior(1),
|
vec![BadBehavior(1), GoodBehavior(1),
|
||||||
BadBehavior(50), GoodBehavior(uint::MAX)]);
|
BadBehavior(50), GoodBehavior(usize::MAX)]);
|
||||||
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
||||||
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
assert!(r.read_at_least(1, buf).unwrap() >= 1);
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(uint::MAX)]);
|
vec![BadBehavior(usize::MAX)]);
|
||||||
assert_eq!(r.read_at_least(1, buf).unwrap_err().kind, NoProgress);
|
assert_eq!(r.read_at_least(1, buf).unwrap_err().kind, NoProgress);
|
||||||
|
|
||||||
let mut r = MemReader::new(b"hello, world!".to_vec());
|
let mut r = MemReader::new(b"hello, world!".to_vec());
|
||||||
|
@ -1918,23 +1918,23 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_push_at_least() {
|
fn test_push_at_least() {
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![GoodBehavior(uint::MAX)]);
|
vec![GoodBehavior(usize::MAX)]);
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
||||||
assert!(r.push_at_least(0, 5, &mut buf).is_ok());
|
assert!(r.push_at_least(0, 5, &mut buf).is_ok());
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(50), GoodBehavior(uint::MAX)]);
|
vec![BadBehavior(50), GoodBehavior(usize::MAX)]);
|
||||||
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(1), GoodBehavior(1),
|
vec![BadBehavior(1), GoodBehavior(1),
|
||||||
BadBehavior(50), GoodBehavior(uint::MAX)]);
|
BadBehavior(50), GoodBehavior(usize::MAX)]);
|
||||||
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
||||||
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
|
||||||
|
|
||||||
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
|
||||||
vec![BadBehavior(uint::MAX)]);
|
vec![BadBehavior(usize::MAX)]);
|
||||||
assert_eq!(r.push_at_least(1, 5, &mut buf).unwrap_err().kind, NoProgress);
|
assert_eq!(r.push_at_least(1, 5, &mut buf).unwrap_err().kind, NoProgress);
|
||||||
|
|
||||||
let mut r = MemReader::new(b"hello, world!".to_vec());
|
let mut r = MemReader::new(b"hello, world!".to_vec());
|
||||||
|
|
|
@ -48,7 +48,7 @@ use str::StrExt;
|
||||||
use string::String;
|
use string::String;
|
||||||
use sys::{fs, tty};
|
use sys::{fs, tty};
|
||||||
use sync::{Arc, Mutex, MutexGuard, Once, ONCE_INIT};
|
use sync::{Arc, Mutex, MutexGuard, Once, ONCE_INIT};
|
||||||
use uint;
|
use usize;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
// And so begins the tale of acquiring a uv handle to a stdio stream on all
|
// And so begins the tale of acquiring a uv handle to a stdio stream on all
|
||||||
|
@ -383,12 +383,14 @@ pub fn println(s: &str) {
|
||||||
|
|
||||||
/// Similar to `print`, but takes a `fmt::Arguments` structure to be compatible
|
/// Similar to `print`, but takes a `fmt::Arguments` structure to be compatible
|
||||||
/// with the `format_args!` macro.
|
/// with the `format_args!` macro.
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn print_args(fmt: fmt::Arguments) {
|
pub fn print_args(fmt: fmt::Arguments) {
|
||||||
with_task_stdout(|io| write!(io, "{}", fmt))
|
with_task_stdout(|io| write!(io, "{}", fmt))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Similar to `println`, but takes a `fmt::Arguments` structure to be
|
/// Similar to `println`, but takes a `fmt::Arguments` structure to be
|
||||||
/// compatible with the `format_args!` macro.
|
/// compatible with the `format_args!` macro.
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn println_args(fmt: fmt::Arguments) {
|
pub fn println_args(fmt: fmt::Arguments) {
|
||||||
with_task_stdout(|io| writeln!(io, "{}", fmt))
|
with_task_stdout(|io| writeln!(io, "{}", fmt))
|
||||||
}
|
}
|
||||||
|
@ -510,7 +512,7 @@ impl Writer for StdWriter {
|
||||||
//
|
//
|
||||||
// [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
|
// [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
|
||||||
// [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html
|
// [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html
|
||||||
let max_size = if cfg!(windows) {8192} else {uint::MAX};
|
let max_size = if cfg!(windows) {8192} else {usize::MAX};
|
||||||
for chunk in buf.chunks(max_size) {
|
for chunk in buf.chunks(max_size) {
|
||||||
try!(match self.inner {
|
try!(match self.inner {
|
||||||
TTY(ref mut tty) => tty.write(chunk),
|
TTY(ref mut tty) => tty.write(chunk),
|
||||||
|
|
|
@ -317,6 +317,7 @@ pub unsafe fn pipe() -> IoResult<Pipe> {
|
||||||
#[cfg(not(target_os="ios"))]
|
#[cfg(not(target_os="ios"))]
|
||||||
#[deprecated(since = "1.0.0", reason = "this function will be removed, use the constants directly")]
|
#[deprecated(since = "1.0.0", reason = "this function will be removed, use the constants directly")]
|
||||||
#[unstable(feature = "os")]
|
#[unstable(feature = "os")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn dll_filename(base: &str) -> String {
|
pub fn dll_filename(base: &str) -> String {
|
||||||
format!("{}{}{}", consts::DLL_PREFIX, base, consts::DLL_SUFFIX)
|
format!("{}{}{}", consts::DLL_PREFIX, base, consts::DLL_SUFFIX)
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,6 +494,7 @@ pub extern fn rust_begin_unwind(msg: fmt::Arguments,
|
||||||
/// on (e.g.) the inlining of other functions as possible), by moving
|
/// on (e.g.) the inlining of other functions as possible), by moving
|
||||||
/// the actual formatting into this shared place.
|
/// the actual formatting into this shared place.
|
||||||
#[inline(never)] #[cold]
|
#[inline(never)] #[cold]
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
||||||
use fmt::Writer;
|
use fmt::Writer;
|
||||||
|
|
||||||
|
@ -509,6 +510,7 @@ pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) -
|
||||||
|
|
||||||
/// This is the entry point of unwinding for panic!() and assert!().
|
/// This is the entry point of unwinding for panic!() and assert!().
|
||||||
#[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible
|
#[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) -> ! {
|
pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) -> ! {
|
||||||
// Note that this should be the only allocation performed in this code path.
|
// Note that this should be the only allocation performed in this code path.
|
||||||
// Currently this means that panic!() on OOM will invoke this code path,
|
// Currently this means that panic!() on OOM will invoke this code path,
|
||||||
|
|
|
@ -61,7 +61,7 @@ use core::cell::Cell;
|
||||||
use core::marker;
|
use core::marker;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::uint;
|
use core::usize;
|
||||||
|
|
||||||
use sync::mpsc::{Receiver, RecvError};
|
use sync::mpsc::{Receiver, RecvError};
|
||||||
use sync::mpsc::blocking::{self, SignalToken};
|
use sync::mpsc::blocking::{self, SignalToken};
|
||||||
|
@ -228,7 +228,7 @@ impl Select {
|
||||||
// A rewrite should focus on avoiding a yield loop, and for now this
|
// A rewrite should focus on avoiding a yield loop, and for now this
|
||||||
// implementation is tying us over to a more efficient "don't
|
// implementation is tying us over to a more efficient "don't
|
||||||
// iterate over everything every time" implementation.
|
// iterate over everything every time" implementation.
|
||||||
let mut ready_id = uint::MAX;
|
let mut ready_id = usize::MAX;
|
||||||
for handle in self.iter() {
|
for handle in self.iter() {
|
||||||
if (*handle).packet.abort_selection() {
|
if (*handle).packet.abort_selection() {
|
||||||
ready_id = (*handle).id;
|
ready_id = (*handle).id;
|
||||||
|
@ -236,7 +236,7 @@ impl Select {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We must have found a ready receiver
|
// We must have found a ready receiver
|
||||||
assert!(ready_id != uint::MAX);
|
assert!(ready_id != usize::MAX);
|
||||||
return ready_id;
|
return ready_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub use self::Failure::*;
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::int;
|
use core::isize;
|
||||||
|
|
||||||
use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
|
use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
|
||||||
use sync::mpsc::blocking::{self, SignalToken};
|
use sync::mpsc::blocking::{self, SignalToken};
|
||||||
|
@ -33,17 +33,17 @@ use sync::mpsc::select::StartResult;
|
||||||
use sync::{Mutex, MutexGuard};
|
use sync::{Mutex, MutexGuard};
|
||||||
use thread::Thread;
|
use thread::Thread;
|
||||||
|
|
||||||
const DISCONNECTED: int = int::MIN;
|
const DISCONNECTED: isize = isize::MIN;
|
||||||
const FUDGE: int = 1024;
|
const FUDGE: isize = 1024;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
const MAX_STEALS: int = 5;
|
const MAX_STEALS: isize = 5;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
const MAX_STEALS: int = 1 << 20;
|
const MAX_STEALS: isize = 1 << 20;
|
||||||
|
|
||||||
pub struct Packet<T> {
|
pub struct Packet<T> {
|
||||||
queue: mpsc::Queue<T>,
|
queue: mpsc::Queue<T>,
|
||||||
cnt: AtomicIsize, // How many items are on this channel
|
cnt: AtomicIsize, // How many items are on this channel
|
||||||
steals: int, // How many times has a port received without blocking?
|
steals: isize, // How many times has a port received without blocking?
|
||||||
to_wake: AtomicUsize, // SignalToken for wake up
|
to_wake: AtomicUsize, // SignalToken for wake up
|
||||||
|
|
||||||
// The number of channels which are currently using this packet.
|
// The number of channels which are currently using this packet.
|
||||||
|
|
|
@ -25,7 +25,7 @@ use self::Message::*;
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::int;
|
use core::isize;
|
||||||
use thread::Thread;
|
use thread::Thread;
|
||||||
|
|
||||||
use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool};
|
use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool};
|
||||||
|
@ -33,11 +33,11 @@ use sync::mpsc::Receiver;
|
||||||
use sync::mpsc::blocking::{self, SignalToken};
|
use sync::mpsc::blocking::{self, SignalToken};
|
||||||
use sync::mpsc::spsc_queue as spsc;
|
use sync::mpsc::spsc_queue as spsc;
|
||||||
|
|
||||||
const DISCONNECTED: int = int::MIN;
|
const DISCONNECTED: isize = isize::MIN;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
const MAX_STEALS: int = 5;
|
const MAX_STEALS: isize = 5;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
const MAX_STEALS: int = 1 << 20;
|
const MAX_STEALS: isize = 1 << 20;
|
||||||
|
|
||||||
pub struct Packet<T> {
|
pub struct Packet<T> {
|
||||||
queue: spsc::Queue<Message<T>>, // internal queue for all message
|
queue: spsc::Queue<Message<T>>, // internal queue for all message
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//! This primitive is meant to be used to run one-time initialization. An
|
//! This primitive is meant to be used to run one-time initialization. An
|
||||||
//! example use case would be for initializing an FFI library.
|
//! example use case would be for initializing an FFI library.
|
||||||
|
|
||||||
use int;
|
use isize;
|
||||||
use marker::Sync;
|
use marker::Sync;
|
||||||
use mem::drop;
|
use mem::drop;
|
||||||
use ops::FnOnce;
|
use ops::FnOnce;
|
||||||
|
@ -99,9 +99,9 @@ impl Once {
|
||||||
|
|
||||||
let prev = self.cnt.fetch_add(1, Ordering::SeqCst);
|
let prev = self.cnt.fetch_add(1, Ordering::SeqCst);
|
||||||
if prev < 0 {
|
if prev < 0 {
|
||||||
// Make sure we never overflow, we'll never have int::MIN
|
// Make sure we never overflow, we'll never have isize::MIN
|
||||||
// simultaneous calls to `call_once` to make this value go back to 0
|
// simultaneous calls to `call_once` to make this value go back to 0
|
||||||
self.cnt.store(int::MIN, Ordering::SeqCst);
|
self.cnt.store(isize::MIN, Ordering::SeqCst);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ impl Once {
|
||||||
let guard = self.mutex.lock();
|
let guard = self.mutex.lock();
|
||||||
if self.cnt.load(Ordering::SeqCst) > 0 {
|
if self.cnt.load(Ordering::SeqCst) > 0 {
|
||||||
f();
|
f();
|
||||||
let prev = self.cnt.swap(int::MIN, Ordering::SeqCst);
|
let prev = self.cnt.swap(isize::MIN, Ordering::SeqCst);
|
||||||
self.lock_cnt.store(prev, Ordering::SeqCst);
|
self.lock_cnt.store(prev, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
|
|
@ -12,7 +12,7 @@ use core::prelude::*;
|
||||||
|
|
||||||
use boxed::Box;
|
use boxed::Box;
|
||||||
use mem;
|
use mem;
|
||||||
use uint;
|
use usize;
|
||||||
use libc;
|
use libc;
|
||||||
use thunk::Thunk;
|
use thunk::Thunk;
|
||||||
use sys_common::stack;
|
use sys_common::stack;
|
||||||
|
@ -25,7 +25,7 @@ use sys::{thread, stack_overflow};
|
||||||
#[no_stack_check]
|
#[no_stack_check]
|
||||||
pub fn start_thread(main: *mut libc::c_void) -> thread::rust_thread_return {
|
pub fn start_thread(main: *mut libc::c_void) -> thread::rust_thread_return {
|
||||||
unsafe {
|
unsafe {
|
||||||
stack::record_os_managed_stack_bounds(0, uint::MAX);
|
stack::record_os_managed_stack_bounds(0, usize::MAX);
|
||||||
let handler = stack_overflow::Handler::new();
|
let handler = stack_overflow::Handler::new();
|
||||||
let f: Box<Thunk> = mem::transmute(main);
|
let f: Box<Thunk> = mem::transmute(main);
|
||||||
f.invoke(());
|
f.invoke(());
|
||||||
|
|
|
@ -179,20 +179,20 @@ mod select {
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "linux"))]
|
target_os = "linux"))]
|
||||||
mod select {
|
mod select {
|
||||||
use uint;
|
use usize;
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
pub const FD_SETSIZE: uint = 1024;
|
pub const FD_SETSIZE: usize = 1024;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct fd_set {
|
pub struct fd_set {
|
||||||
// FIXME: shouldn't this be a c_ulong?
|
// FIXME: shouldn't this be a c_ulong?
|
||||||
fds_bits: [libc::uintptr_t; (FD_SETSIZE / uint::BITS)]
|
fds_bits: [libc::uintptr_t; (FD_SETSIZE / usize::BITS)]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fd_set(set: &mut fd_set, fd: i32) {
|
pub fn fd_set(set: &mut fd_set, fd: i32) {
|
||||||
let fd = fd as uint;
|
let fd = fd as uint;
|
||||||
set.fds_bits[fd / uint::BITS] |= 1 << (fd % uint::BITS);
|
set.fds_bits[fd / usize::BITS] |= 1 << (fd % usize::BITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,6 +335,7 @@ mod imp {
|
||||||
use ptr;
|
use ptr;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub struct Key<T> {
|
pub struct Key<T> {
|
||||||
// Place the inner bits in an `UnsafeCell` to currently get around the
|
// Place the inner bits in an `UnsafeCell` to currently get around the
|
||||||
// "only Sync statics" restriction. This allows any type to be placed in
|
// "only Sync statics" restriction. This allows any type to be placed in
|
||||||
|
@ -342,11 +343,14 @@ mod imp {
|
||||||
//
|
//
|
||||||
// Note that all access requires `T: 'static` so it can't be a type with
|
// Note that all access requires `T: 'static` so it can't be a type with
|
||||||
// any borrowed pointers still.
|
// any borrowed pointers still.
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub inner: UnsafeCell<T>,
|
pub inner: UnsafeCell<T>,
|
||||||
|
|
||||||
// Metadata to keep track of the state of the destructor. Remember that
|
// Metadata to keep track of the state of the destructor. Remember that
|
||||||
// these variables are thread-local, not global.
|
// these variables are thread-local, not global.
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub dtor_registered: UnsafeCell<bool>, // should be Cell
|
pub dtor_registered: UnsafeCell<bool>, // should be Cell
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub dtor_running: UnsafeCell<bool>, // should be Cell
|
pub dtor_running: UnsafeCell<bool>, // should be Cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,12 +472,15 @@ mod imp {
|
||||||
use sys_common::thread_local::StaticKey as OsStaticKey;
|
use sys_common::thread_local::StaticKey as OsStaticKey;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub struct Key<T> {
|
pub struct Key<T> {
|
||||||
// Statically allocated initialization expression, using an `UnsafeCell`
|
// Statically allocated initialization expression, using an `UnsafeCell`
|
||||||
// for the same reasons as above.
|
// for the same reasons as above.
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub inner: UnsafeCell<T>,
|
pub inner: UnsafeCell<T>,
|
||||||
|
|
||||||
// OS-TLS key that we'll use to key off.
|
// OS-TLS key that we'll use to key off.
|
||||||
|
#[stable(since = "1.0.0", feature = "rust1")]
|
||||||
pub os: OsStaticKey,
|
pub os: OsStaticKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,40 +436,28 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
|
||||||
let sp = ignored_span(cx, DUMMY_SP);
|
let sp = ignored_span(cx, DUMMY_SP);
|
||||||
let ecx = &cx.ext_cx;
|
let ecx = &cx.ext_cx;
|
||||||
|
|
||||||
// std::slice::AsSlice
|
|
||||||
let as_slice_path = ecx.path(sp, vec![token::str_to_ident("std"),
|
|
||||||
token::str_to_ident("slice"),
|
|
||||||
token::str_to_ident("AsSlice")]);
|
|
||||||
// test::test_main_static
|
// test::test_main_static
|
||||||
let test_main_path = ecx.path(sp, vec![token::str_to_ident("test"),
|
let test_main_path = ecx.path(sp, vec![token::str_to_ident("test"),
|
||||||
token::str_to_ident("test_main_static")]);
|
token::str_to_ident("test_main_static")]);
|
||||||
// ::std::os::args
|
// ::std::env::args
|
||||||
let os_args_path = ecx.path_global(sp, vec![token::str_to_ident("std"),
|
let os_args_path = ecx.path_global(sp, vec![token::str_to_ident("std"),
|
||||||
token::str_to_ident("os"),
|
token::str_to_ident("env"),
|
||||||
token::str_to_ident("args")]);
|
token::str_to_ident("args")]);
|
||||||
// use std::slice::AsSlice
|
// ::std::env::args()
|
||||||
let as_slice_path = P(nospan(ast::ViewPathSimple(token::str_to_ident("AsSlice"),
|
|
||||||
as_slice_path)));
|
|
||||||
let use_as_slice = ecx.item_use(sp, ast::Inherited, as_slice_path);
|
|
||||||
let use_as_slice = ecx.stmt_item(sp, use_as_slice);
|
|
||||||
// ::std::os::args()
|
|
||||||
let os_args_path_expr = ecx.expr_path(os_args_path);
|
let os_args_path_expr = ecx.expr_path(os_args_path);
|
||||||
let call_os_args = ecx.expr_call(sp, os_args_path_expr, vec![]);
|
let call_os_args = ecx.expr_call(sp, os_args_path_expr, vec![]);
|
||||||
// ::std::os::args().as_slice()
|
|
||||||
let call_as_slice = ecx.expr_method_call(sp, call_os_args,
|
|
||||||
token::str_to_ident("as_slice"), vec![]);
|
|
||||||
// test::test_main_static(...)
|
// test::test_main_static(...)
|
||||||
let test_main_path_expr = ecx.expr_path(test_main_path);
|
let test_main_path_expr = ecx.expr_path(test_main_path);
|
||||||
let tests_ident_expr = ecx.expr_ident(sp, token::str_to_ident("TESTS"));
|
let tests_ident_expr = ecx.expr_ident(sp, token::str_to_ident("TESTS"));
|
||||||
let call_test_main = ecx.expr_call(sp, test_main_path_expr,
|
let call_test_main = ecx.expr_call(sp, test_main_path_expr,
|
||||||
vec![call_as_slice, tests_ident_expr]);
|
vec![call_os_args, tests_ident_expr]);
|
||||||
let call_test_main = ecx.stmt_expr(call_test_main);
|
let call_test_main = ecx.stmt_expr(call_test_main);
|
||||||
// #![main]
|
// #![main]
|
||||||
let main_meta = ecx.meta_word(sp, token::intern_and_get_ident("main"));
|
let main_meta = ecx.meta_word(sp, token::intern_and_get_ident("main"));
|
||||||
let main_attr = ecx.attribute(sp, main_meta);
|
let main_attr = ecx.attribute(sp, main_meta);
|
||||||
// pub fn main() { ... }
|
// pub fn main() { ... }
|
||||||
let main_ret_ty = ecx.ty(sp, ast::TyTup(vec![]));
|
let main_ret_ty = ecx.ty(sp, ast::TyTup(vec![]));
|
||||||
let main_body = ecx.block_all(sp, vec![use_as_slice, call_test_main], None);
|
let main_body = ecx.block_all(sp, vec![call_test_main], None);
|
||||||
let main = ast::ItemFn(ecx.fn_decl(vec![], main_ret_ty),
|
let main = ast::ItemFn(ecx.fn_decl(vec![], main_ret_ty),
|
||||||
ast::Unsafety::Normal, ::abi::Rust, empty_generics(), main_body);
|
ast::Unsafety::Normal, ::abi::Rust, empty_generics(), main_body);
|
||||||
let main = P(ast::Item {
|
let main = P(ast::Item {
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
html_playground_url = "http://play.rust-lang.org/")]
|
html_playground_url = "http://play.rust-lang.org/")]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
|
#![feature(core)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(collections)]
|
#![feature(collections)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#![feature(hash)]
|
#![feature(hash)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(io)]
|
#![feature(io)]
|
||||||
|
#![feature(os)]
|
||||||
#![feature(path)]
|
#![feature(path)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
|
@ -265,7 +266,8 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn> ) {
|
||||||
// a ~[TestDescAndFn] is used in order to effect ownership-transfer
|
// a ~[TestDescAndFn] is used in order to effect ownership-transfer
|
||||||
// semantics into parallel test runners, which in turn requires a ~[]
|
// semantics into parallel test runners, which in turn requires a ~[]
|
||||||
// rather than a &[].
|
// rather than a &[].
|
||||||
pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) {
|
pub fn test_main_static(args: env::Args, tests: &[TestDescAndFn]) {
|
||||||
|
let args = args.map(|s| s.into_string().unwrap()).collect::<Vec<_>>();
|
||||||
let owned_tests = tests.iter().map(|t| {
|
let owned_tests = tests.iter().map(|t| {
|
||||||
match t.testfn {
|
match t.testfn {
|
||||||
StaticTestFn(f) => TestDescAndFn { testfn: StaticTestFn(f), desc: t.desc.clone() },
|
StaticTestFn(f) => TestDescAndFn { testfn: StaticTestFn(f), desc: t.desc.clone() },
|
||||||
|
@ -273,7 +275,7 @@ pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) {
|
||||||
_ => panic!("non-static tests passed to test::test_main_static")
|
_ => panic!("non-static tests passed to test::test_main_static")
|
||||||
}
|
}
|
||||||
}).collect();
|
}).collect();
|
||||||
test_main(args, owned_tests)
|
test_main(&args, owned_tests)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(simd)]
|
#![feature(simd, core)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::simd::f32x4;
|
use std::simd::f32x4;
|
||||||
|
|
|
@ -98,12 +98,10 @@ mod cross_crate {
|
||||||
// Eventually, we will want to lint the contents of the
|
// Eventually, we will want to lint the contents of the
|
||||||
// macro in the module *defining* it. Also, stability levels
|
// macro in the module *defining* it. Also, stability levels
|
||||||
// on macros themselves are not yet linted.
|
// on macros themselves are not yet linted.
|
||||||
macro_test!();
|
|
||||||
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
||||||
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
|
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
|
||||||
//~^ WARNING use of unstable library feature
|
//~^ WARNING use of unstable library feature
|
||||||
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
||||||
macro_test_arg_nested!(deprecated_text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_method_param<F: Trait>(foo: F) {
|
fn test_method_param<F: Trait>(foo: F) {
|
||||||
|
@ -139,7 +137,7 @@ mod cross_crate {
|
||||||
|
|
||||||
mod inheritance {
|
mod inheritance {
|
||||||
extern crate inherited_stability; //~ WARNING: use of unstable library feature
|
extern crate inherited_stability; //~ WARNING: use of unstable library feature
|
||||||
use self::inherited_stability::*;
|
use self::inherited_stability::*; //~ WARNING: use of unstable library feature
|
||||||
|
|
||||||
fn test_inheritance() {
|
fn test_inheritance() {
|
||||||
unstable(); //~ WARNING use of unstable library feature
|
unstable(); //~ WARNING use of unstable library feature
|
||||||
|
|
23
src/test/compile-fail/lint-stability2.rs
Normal file
23
src/test/compile-fail/lint-stability2.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright 2015 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.
|
||||||
|
|
||||||
|
// aux-build:lint_stability.rs
|
||||||
|
// error-pattern: use of deprecated item
|
||||||
|
|
||||||
|
#![deny(deprecated)]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate lint_stability;
|
||||||
|
|
||||||
|
use lint_stability::*;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
macro_test!();
|
||||||
|
}
|
25
src/test/compile-fail/lint-stability3.rs
Normal file
25
src/test/compile-fail/lint-stability3.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2015 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.
|
||||||
|
|
||||||
|
// aux-build:lint_stability.rs
|
||||||
|
// error-pattern: use of deprecated item
|
||||||
|
|
||||||
|
#![deny(deprecated)]
|
||||||
|
#![allow(warnings)]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate lint_stability;
|
||||||
|
|
||||||
|
use lint_stability::*;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
macro_test_arg_nested!(deprecated_text);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue