librustc: Forbid external crates, imports, and/or items from being
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
This commit is contained in:
parent
85fd37f876
commit
7f928d150e
86 changed files with 579 additions and 433 deletions
|
@ -537,11 +537,12 @@ extern crate core;
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::raw::Slice;
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn dot_product(a: *const u32, a_len: u32,
|
pub extern fn dot_product(a: *const u32, a_len: u32,
|
||||||
b: *const u32, b_len: u32) -> u32 {
|
b: *const u32, b_len: u32) -> u32 {
|
||||||
|
use core::raw::Slice;
|
||||||
|
|
||||||
// Convert the provided arrays into Rust slices.
|
// Convert the provided arrays into Rust slices.
|
||||||
// The core::raw module guarantees that the Slice
|
// The core::raw module guarantees that the Slice
|
||||||
// structure has the same memory layout as a &[T]
|
// structure has the same memory layout as a &[T]
|
||||||
|
|
|
@ -68,12 +68,11 @@ use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::iter::Take;
|
use core::iter::Take;
|
||||||
use core::iter;
|
use core::iter;
|
||||||
use core::ops::Index;
|
|
||||||
use core::slice;
|
use core::slice;
|
||||||
use core::uint;
|
use core::uint;
|
||||||
use std::hash;
|
use std::hash;
|
||||||
|
|
||||||
use {Collection, Mutable, Set, MutableSet, MutableSeq};
|
use {Mutable, Set, MutableSet, MutableSeq};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use alloc::boxed::Box;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::fmt::Show;
|
use core::fmt::Show;
|
||||||
|
|
||||||
use {Collection, MutableSeq};
|
use MutableSeq;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
#[allow(missing_doc)]
|
#[allow(missing_doc)]
|
||||||
|
|
|
@ -31,7 +31,7 @@ use core::mem;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use std::hash::{Writer, Hash};
|
use std::hash::{Writer, Hash};
|
||||||
|
|
||||||
use {Collection, Mutable, Deque, MutableSeq};
|
use {Mutable, Deque, MutableSeq};
|
||||||
|
|
||||||
/// A doubly-linked list.
|
/// A doubly-linked list.
|
||||||
pub struct DList<T> {
|
pub struct DList<T> {
|
||||||
|
|
|
@ -22,9 +22,12 @@
|
||||||
html_playground_url = "http://play.rust-lang.org/")]
|
html_playground_url = "http://play.rust-lang.org/")]
|
||||||
|
|
||||||
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
|
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
|
||||||
#![feature(unsafe_destructor)]
|
#![feature(unsafe_destructor, import_shadowing)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#[phase(plugin, link)] extern crate core;
|
#[phase(plugin, link)] extern crate core;
|
||||||
extern crate unicode;
|
extern crate unicode;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
@ -36,11 +39,11 @@ extern crate alloc;
|
||||||
#[cfg(test)] #[phase(plugin, link)] extern crate std;
|
#[cfg(test)] #[phase(plugin, link)] extern crate std;
|
||||||
#[cfg(test)] #[phase(plugin, link)] extern crate log;
|
#[cfg(test)] #[phase(plugin, link)] extern crate log;
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::Option;
|
||||||
|
|
||||||
pub use core::collections::Collection;
|
|
||||||
pub use bitv::{Bitv, BitvSet};
|
pub use bitv::{Bitv, BitvSet};
|
||||||
pub use btree::BTree;
|
pub use btree::BTree;
|
||||||
|
pub use core::prelude::Collection;
|
||||||
pub use dlist::DList;
|
pub use dlist::DList;
|
||||||
pub use enum_set::EnumSet;
|
pub use enum_set::EnumSet;
|
||||||
pub use priority_queue::PriorityQueue;
|
pub use priority_queue::PriorityQueue;
|
||||||
|
|
|
@ -154,7 +154,7 @@ use core::default::Default;
|
||||||
use core::mem::{zeroed, replace, swap};
|
use core::mem::{zeroed, replace, swap};
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
|
|
||||||
use {Collection, Mutable, MutableSeq};
|
use {Mutable, MutableSeq};
|
||||||
use slice;
|
use slice;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,10 @@ use core::prelude::*;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::iter::RandomAccessIterator;
|
|
||||||
use core::iter;
|
use core::iter;
|
||||||
use std::hash::{Writer, Hash};
|
use std::hash::{Writer, Hash};
|
||||||
|
|
||||||
use {Deque, Collection, Mutable, MutableSeq};
|
use {Deque, Mutable, MutableSeq};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
static INITIAL_CAPACITY: uint = 8u; // 2^3
|
static INITIAL_CAPACITY: uint = 8u; // 2^3
|
||||||
|
|
|
@ -86,23 +86,22 @@ for &x in numbers.iter() {
|
||||||
|
|
||||||
#![doc(primitive = "slice")]
|
#![doc(primitive = "slice")]
|
||||||
|
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::mem::size_of;
|
use core::mem::size_of;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::prelude::{Clone, Collection, Greater, Iterator, Less, None, Option};
|
||||||
|
use core::prelude::{Ord, Ordering, RawPtr, Some, range};
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::iter::{range_step, MultiplicativeIterator};
|
use core::iter::{range_step, MultiplicativeIterator};
|
||||||
|
|
||||||
use {Collection, MutableSeq};
|
use MutableSeq;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
|
|
||||||
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutablePartialEqSlice};
|
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutablePartialEqSlice};
|
||||||
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
|
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
|
||||||
pub use core::slice::{MutSplits, MutChunks};
|
pub use core::slice::{MutSplits, MutChunks, Splits};
|
||||||
pub use core::slice::{bytes, MutableCloneableSlice};
|
pub use core::slice::{bytes, ref_slice, MutableCloneableSlice};
|
||||||
pub use core::slice::{BinarySearchResult, Found, NotFound};
|
pub use core::slice::{Found, NotFound};
|
||||||
|
|
||||||
// Functional utilities
|
// Functional utilities
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use core::iter;
|
||||||
use core::iter::{Enumerate, FilterMap};
|
use core::iter::{Enumerate, FilterMap};
|
||||||
use core::mem::replace;
|
use core::mem::replace;
|
||||||
|
|
||||||
use {Collection, Mutable, Map, MutableMap, MutableSeq};
|
use {Mutable, Map, MutableMap, MutableSeq};
|
||||||
use {vec, slice};
|
use {vec, slice};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
use hash;
|
use hash;
|
||||||
|
|
|
@ -69,15 +69,17 @@ is the same as `&[u8]`.
|
||||||
|
|
||||||
#![doc(primitive = "str")]
|
#![doc(primitive = "str")]
|
||||||
|
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::iter::AdditiveIterator;
|
use core::iter::AdditiveIterator;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::prelude::{Char, Clone, Collection, Eq, Equiv, ImmutableSlice};
|
||||||
|
use core::prelude::{Iterator, MutableSlice, None, Option, Ord, Ordering};
|
||||||
|
use core::prelude::{PartialEq, PartialOrd, Result, Slice, Some, Tuple2};
|
||||||
|
use core::prelude::{range};
|
||||||
|
|
||||||
use {Collection, Deque, MutableSeq};
|
use {Deque, MutableSeq};
|
||||||
use hash;
|
use hash;
|
||||||
use ringbuf::RingBuf;
|
use ringbuf::RingBuf;
|
||||||
use string::String;
|
use string::String;
|
||||||
|
|
|
@ -20,9 +20,8 @@ use core::mem;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
|
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
|
||||||
use RawSlice = core::raw::Slice;
|
use RawSlice = core::raw::Slice;
|
||||||
use core::slice::Slice;
|
|
||||||
|
|
||||||
use {Collection, Mutable, MutableSeq};
|
use {Mutable, MutableSeq};
|
||||||
use hash;
|
use hash;
|
||||||
use str;
|
use str;
|
||||||
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
|
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
|
||||||
|
|
|
@ -40,7 +40,7 @@ use core::mem::{replace, swap};
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use std::hash::{Writer, Hash};
|
use std::hash::{Writer, Hash};
|
||||||
|
|
||||||
use {Collection, Mutable, Set, MutableSet, MutableMap, Map, MutableSeq};
|
use {Mutable, Set, MutableSet, MutableMap, Map, MutableSeq};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
/// This is implemented as an AA tree, which is a simplified variation of
|
/// This is implemented as an AA tree, which is a simplified variation of
|
||||||
|
|
|
@ -23,7 +23,7 @@ use core::uint;
|
||||||
use core::iter;
|
use core::iter;
|
||||||
use std::hash::{Writer, Hash};
|
use std::hash::{Writer, Hash};
|
||||||
|
|
||||||
use {Collection, Mutable, Map, MutableMap, Set, MutableSet};
|
use {Mutable, Map, MutableMap, Set, MutableSet};
|
||||||
use slice::{Items, MutItems};
|
use slice::{Items, MutItems};
|
||||||
use slice;
|
use slice;
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,15 @@ use core::prelude::*;
|
||||||
|
|
||||||
use alloc::heap::{allocate, reallocate, deallocate};
|
use alloc::heap::{allocate, reallocate, deallocate};
|
||||||
use RawSlice = core::raw::Slice;
|
use RawSlice = core::raw::Slice;
|
||||||
use core::slice::Slice;
|
|
||||||
use core::cmp::max;
|
use core::cmp::max;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::num::{CheckedMul, CheckedAdd};
|
|
||||||
use core::num;
|
use core::num;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::uint;
|
use core::uint;
|
||||||
|
|
||||||
use {Collection, Mutable, MutableSeq};
|
use {Mutable, MutableSeq};
|
||||||
use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector};
|
use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector};
|
||||||
use slice::{Items, MutItems};
|
use slice::{Items, MutItems};
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,10 @@
|
||||||
|
|
||||||
use any;
|
use any;
|
||||||
use cell::{Cell, Ref, RefMut};
|
use cell::{Cell, Ref, RefMut};
|
||||||
use char::Char;
|
|
||||||
use collections::Collection;
|
use collections::Collection;
|
||||||
use iter::{Iterator, range};
|
use iter::{Iterator, range};
|
||||||
use kinds::Copy;
|
use kinds::Copy;
|
||||||
use mem;
|
use mem;
|
||||||
use num::Float;
|
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use ops::Deref;
|
use ops::Deref;
|
||||||
use result::{Ok, Err};
|
use result::{Ok, Err};
|
||||||
|
@ -342,8 +340,12 @@ impl<'a> Formatter<'a> {
|
||||||
///
|
///
|
||||||
/// This function will correctly account for the flags provided as well as
|
/// This function will correctly account for the flags provided as well as
|
||||||
/// the minimum width. It will not take precision into account.
|
/// the minimum width. It will not take precision into account.
|
||||||
pub fn pad_integral(&mut self, is_positive: bool, prefix: &str,
|
pub fn pad_integral(&mut self,
|
||||||
buf: &[u8]) -> Result {
|
is_positive: bool,
|
||||||
|
prefix: &str,
|
||||||
|
buf: &[u8])
|
||||||
|
-> Result {
|
||||||
|
use char::Char;
|
||||||
use fmt::rt::{FlagAlternate, FlagSignPlus, FlagSignAwareZeroPad};
|
use fmt::rt::{FlagAlternate, FlagSignPlus, FlagSignAwareZeroPad};
|
||||||
|
|
||||||
let mut width = buf.len();
|
let mut width = buf.len();
|
||||||
|
@ -456,6 +458,7 @@ impl<'a> Formatter<'a> {
|
||||||
padding: uint,
|
padding: uint,
|
||||||
default: rt::Alignment,
|
default: rt::Alignment,
|
||||||
f: |&mut Formatter| -> Result) -> Result {
|
f: |&mut Formatter| -> Result) -> Result {
|
||||||
|
use char::Char;
|
||||||
let align = match self.align {
|
let align = match self.align {
|
||||||
rt::AlignUnknown => default,
|
rt::AlignUnknown => default,
|
||||||
rt::AlignLeft | rt::AlignRight => self.align
|
rt::AlignLeft | rt::AlignRight => self.align
|
||||||
|
@ -539,6 +542,8 @@ impl<'a, T: str::Str> String for T {
|
||||||
|
|
||||||
impl Char for char {
|
impl Char for char {
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||||
|
use char::Char;
|
||||||
|
|
||||||
let mut utf8 = [0u8, ..4];
|
let mut utf8 = [0u8, ..4];
|
||||||
let amt = self.encode_utf8(utf8);
|
let amt = self.encode_utf8(utf8);
|
||||||
let s: &str = unsafe { mem::transmute(utf8.slice_to(amt)) };
|
let s: &str = unsafe { mem::transmute(utf8.slice_to(amt)) };
|
||||||
|
@ -571,7 +576,7 @@ impl<'a, T> Pointer for &'a mut T {
|
||||||
macro_rules! floating(($ty:ident) => {
|
macro_rules! floating(($ty:ident) => {
|
||||||
impl Float for $ty {
|
impl Float for $ty {
|
||||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||||
use num::Signed;
|
use num::{Float, Signed};
|
||||||
|
|
||||||
let digits = match fmt.precision {
|
let digits = match fmt.precision {
|
||||||
Some(i) => float::DigExact(i),
|
Some(i) => float::DigExact(i),
|
||||||
|
@ -592,7 +597,7 @@ macro_rules! floating(($ty:ident) => {
|
||||||
|
|
||||||
impl LowerExp for $ty {
|
impl LowerExp for $ty {
|
||||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||||
use num::Signed;
|
use num::{Float, Signed};
|
||||||
|
|
||||||
let digits = match fmt.precision {
|
let digits = match fmt.precision {
|
||||||
Some(i) => float::DigExact(i),
|
Some(i) => float::DigExact(i),
|
||||||
|
@ -613,7 +618,7 @@ macro_rules! floating(($ty:ident) => {
|
||||||
|
|
||||||
impl UpperExp for $ty {
|
impl UpperExp for $ty {
|
||||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||||
use num::Signed;
|
use num::{Float, Signed};
|
||||||
|
|
||||||
let digits = match fmt.precision {
|
let digits = match fmt.precision {
|
||||||
Some(i) => float::DigExact(i),
|
Some(i) => float::DigExact(i),
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
#![license = "MIT/ASL2"]
|
#![license = "MIT/ASL2"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![feature(macro_rules, globs)]
|
#![feature(macro_rules, globs, import_shadowing)]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
use std::char;
|
use std::char;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
|
@ -88,8 +88,12 @@
|
||||||
html_root_url = "http://doc.rust-lang.org/master/",
|
html_root_url = "http://doc.rust-lang.org/master/",
|
||||||
html_playground_url = "http://play.rust-lang.org/")]
|
html_playground_url = "http://play.rust-lang.org/")]
|
||||||
#![feature(globs, phase)]
|
#![feature(globs, phase)]
|
||||||
|
#![feature(import_shadowing)]
|
||||||
#![deny(missing_doc)]
|
#![deny(missing_doc)]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#[cfg(test)] extern crate debug;
|
#[cfg(test)] extern crate debug;
|
||||||
#[cfg(test)] #[phase(plugin, link)] extern crate log;
|
#[cfg(test)] #[phase(plugin, link)] extern crate log;
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ pub use funcs::bsd43::{shutdown};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
|
#[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
|
#[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
|
#[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS, FILE_ATTRIBUTE_NORMAL};
|
#[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
|
#[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
|
#[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
|
||||||
#[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
|
#[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
|
||||||
|
@ -255,10 +255,10 @@ pub use funcs::bsd43::{shutdown};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, QueryPerformanceFrequency};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceFrequency};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, SetEndOfFile, CreateFileW};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{SetEndOfFile, CreateFileW};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
|
||||||
#[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
|
#[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
|
||||||
|
|
|
@ -24,7 +24,6 @@ that do not need to record state.
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
use core::num;
|
use core::num;
|
||||||
use core::num::CheckedAdd;
|
|
||||||
|
|
||||||
use {Rng, Rand};
|
use {Rng, Rand};
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,11 @@ use distributions::{Sample, IndependentSample};
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use std::rand;
|
|
||||||
/// use std::rand::distributions::{IndependentSample, Range};
|
/// use std::rand::distributions::{IndependentSample, Range};
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let between = Range::new(10u, 10000u);
|
/// let between = Range::new(10u, 10000u);
|
||||||
/// let mut rng = rand::task_rng();
|
/// let mut rng = std::rand::task_rng();
|
||||||
/// let mut sum = 0;
|
/// let mut sum = 0;
|
||||||
/// for _ in range(0u, 1000) {
|
/// for _ in range(0u, 1000) {
|
||||||
/// sum += between.ind_sample(&mut rng);
|
/// sum += between.ind_sample(&mut rng);
|
||||||
|
|
|
@ -28,13 +28,16 @@
|
||||||
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
||||||
html_root_url = "http://doc.rust-lang.org/master/")]
|
html_root_url = "http://doc.rust-lang.org/master/")]
|
||||||
|
|
||||||
#![feature(intrinsics, phase)]
|
#![feature(import_shadowing, intrinsics, phase)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
// This library defines the builtin functions, so it would be a shame for
|
// This library defines the builtin functions, so it would be a shame for
|
||||||
// LLVM to optimize these function calls to themselves!
|
// LLVM to optimize these function calls to themselves!
|
||||||
#![no_builtins]
|
#![no_builtins]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#[cfg(test)] extern crate native;
|
#[cfg(test)] extern crate native;
|
||||||
#[cfg(test)] extern crate test;
|
#[cfg(test)] extern crate test;
|
||||||
#[cfg(test)] extern crate debug;
|
#[cfg(test)] extern crate debug;
|
||||||
|
|
|
@ -68,6 +68,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
||||||
|
|
||||||
("rustc_diagnostic_macros", Active),
|
("rustc_diagnostic_macros", Active),
|
||||||
("unboxed_closures", Active),
|
("unboxed_closures", Active),
|
||||||
|
("import_shadowing", Active),
|
||||||
|
|
||||||
// if you change this list without updating src/doc/rust.md, cmr will be sad
|
// if you change this list without updating src/doc/rust.md, cmr will be sad
|
||||||
|
|
||||||
|
@ -98,7 +99,8 @@ pub struct Features {
|
||||||
pub default_type_params: Cell<bool>,
|
pub default_type_params: Cell<bool>,
|
||||||
pub issue_5723_bootstrap: Cell<bool>,
|
pub issue_5723_bootstrap: Cell<bool>,
|
||||||
pub overloaded_calls: Cell<bool>,
|
pub overloaded_calls: Cell<bool>,
|
||||||
pub rustc_diagnostic_macros: Cell<bool>
|
pub rustc_diagnostic_macros: Cell<bool>,
|
||||||
|
pub import_shadowing: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Features {
|
impl Features {
|
||||||
|
@ -107,7 +109,8 @@ impl Features {
|
||||||
default_type_params: Cell::new(false),
|
default_type_params: Cell::new(false),
|
||||||
issue_5723_bootstrap: Cell::new(false),
|
issue_5723_bootstrap: Cell::new(false),
|
||||||
overloaded_calls: Cell::new(false),
|
overloaded_calls: Cell::new(false),
|
||||||
rustc_diagnostic_macros: Cell::new(false)
|
rustc_diagnostic_macros: Cell::new(false),
|
||||||
|
import_shadowing: Cell::new(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,4 +442,6 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) {
|
||||||
sess.features.issue_5723_bootstrap.set(cx.has_feature("issue_5723_bootstrap"));
|
sess.features.issue_5723_bootstrap.set(cx.has_feature("issue_5723_bootstrap"));
|
||||||
sess.features.overloaded_calls.set(cx.has_feature("overloaded_calls"));
|
sess.features.overloaded_calls.set(cx.has_feature("overloaded_calls"));
|
||||||
sess.features.rustc_diagnostic_macros.set(cx.has_feature("rustc_diagnostic_macros"));
|
sess.features.rustc_diagnostic_macros.set(cx.has_feature("rustc_diagnostic_macros"));
|
||||||
|
sess.features.import_shadowing.set(cx.has_feature("import_shadowing"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ use syntax::fold::Folder;
|
||||||
use syntax::fold;
|
use syntax::fold;
|
||||||
use syntax::owned_slice::OwnedSlice;
|
use syntax::owned_slice::OwnedSlice;
|
||||||
use syntax::parse::token::InternedString;
|
use syntax::parse::token::InternedString;
|
||||||
|
use syntax::parse::token::special_idents;
|
||||||
use syntax::parse::token;
|
use syntax::parse::token;
|
||||||
use syntax::util::small_vector::SmallVector;
|
use syntax::util::small_vector::SmallVector;
|
||||||
|
|
||||||
|
@ -197,7 +198,19 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
|
||||||
ast::DUMMY_NODE_ID));
|
ast::DUMMY_NODE_ID));
|
||||||
let vi2 = ast::ViewItem {
|
let vi2 = ast::ViewItem {
|
||||||
node: ast::ViewItemUse(vp),
|
node: ast::ViewItemUse(vp),
|
||||||
attrs: Vec::new(),
|
attrs: vec!(ast::Attribute {
|
||||||
|
span: DUMMY_SP,
|
||||||
|
node: ast::Attribute_ {
|
||||||
|
id: attr::mk_attr_id(),
|
||||||
|
style: ast::AttrOuter,
|
||||||
|
value: box(GC) ast::MetaItem {
|
||||||
|
span: DUMMY_SP,
|
||||||
|
node: ast::MetaWord(token::get_name(
|
||||||
|
special_idents::prelude_import.name)),
|
||||||
|
},
|
||||||
|
is_sugared_doc: false,
|
||||||
|
},
|
||||||
|
}),
|
||||||
vis: ast::Inherited,
|
vis: ast::Inherited,
|
||||||
span: DUMMY_SP,
|
span: DUMMY_SP,
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,6 +34,7 @@ This API is completely unstable and subject to change.
|
||||||
|
|
||||||
#![allow(unknown_features)] // NOTE: Remove after next snapshot
|
#![allow(unknown_features)] // NOTE: Remove after next snapshot
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
|
#![feature(import_shadowing)]
|
||||||
|
|
||||||
extern crate arena;
|
extern crate arena;
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
|
|
|
@ -581,6 +581,9 @@ impl LintPass for UnusedAttribute {
|
||||||
"thread_local",
|
"thread_local",
|
||||||
"no_debug",
|
"no_debug",
|
||||||
|
|
||||||
|
// used in resolve
|
||||||
|
"prelude_import",
|
||||||
|
|
||||||
// not used anywhere (!?) but apparently we want to keep them around
|
// not used anywhere (!?) but apparently we want to keep them around
|
||||||
"comment",
|
"comment",
|
||||||
"desc",
|
"desc",
|
||||||
|
|
|
@ -42,7 +42,6 @@ use syntax::ast_map::{PathElem, PathElems};
|
||||||
use syntax::ast_map;
|
use syntax::ast_map;
|
||||||
use syntax::ast_util::*;
|
use syntax::ast_util::*;
|
||||||
use syntax::ast_util;
|
use syntax::ast_util;
|
||||||
use syntax::ast_util::PostExpansionMethod;
|
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use syntax::diagnostic::SpanHandler;
|
use syntax::diagnostic::SpanHandler;
|
||||||
|
|
|
@ -47,8 +47,8 @@ use rbml::io::SeekableMemWriter;
|
||||||
use rbml::{reader, writer};
|
use rbml::{reader, writer};
|
||||||
use rbml;
|
use rbml;
|
||||||
use serialize;
|
use serialize;
|
||||||
use serialize::{Encoder, Encodable, EncoderHelpers, DecoderHelpers};
|
use serialize::{Decodable, Decoder, DecoderHelpers, Encodable};
|
||||||
use serialize::{Decoder, Decodable};
|
use serialize::{EncoderHelpers};
|
||||||
|
|
||||||
#[cfg(test)] use syntax::parse;
|
#[cfg(test)] use syntax::parse;
|
||||||
#[cfg(test)] use syntax::print::pprust;
|
#[cfg(test)] use syntax::print::pprust;
|
||||||
|
@ -620,6 +620,8 @@ fn encode_method_callee(ecx: &e::EncodeContext,
|
||||||
rbml_w: &mut Encoder,
|
rbml_w: &mut Encoder,
|
||||||
adjustment: typeck::ExprAdjustment,
|
adjustment: typeck::ExprAdjustment,
|
||||||
method: &MethodCallee) {
|
method: &MethodCallee) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
rbml_w.emit_struct("MethodCallee", 4, |rbml_w| {
|
rbml_w.emit_struct("MethodCallee", 4, |rbml_w| {
|
||||||
rbml_w.emit_struct_field("adjustment", 0u, |rbml_w| {
|
rbml_w.emit_struct_field("adjustment", 0u, |rbml_w| {
|
||||||
adjustment.encode(rbml_w)
|
adjustment.encode(rbml_w)
|
||||||
|
@ -695,6 +697,8 @@ fn encode_vtable_res_with_key(ecx: &e::EncodeContext,
|
||||||
rbml_w: &mut Encoder,
|
rbml_w: &mut Encoder,
|
||||||
adjustment: typeck::ExprAdjustment,
|
adjustment: typeck::ExprAdjustment,
|
||||||
dr: &typeck::vtable_res) {
|
dr: &typeck::vtable_res) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
rbml_w.emit_struct("VtableWithKey", 2, |rbml_w| {
|
rbml_w.emit_struct("VtableWithKey", 2, |rbml_w| {
|
||||||
rbml_w.emit_struct_field("adjustment", 0u, |rbml_w| {
|
rbml_w.emit_struct_field("adjustment", 0u, |rbml_w| {
|
||||||
adjustment.encode(rbml_w)
|
adjustment.encode(rbml_w)
|
||||||
|
@ -728,6 +732,8 @@ pub fn encode_vtable_param_res(ecx: &e::EncodeContext,
|
||||||
|
|
||||||
pub fn encode_unboxed_closure_kind(ebml_w: &mut Encoder,
|
pub fn encode_unboxed_closure_kind(ebml_w: &mut Encoder,
|
||||||
kind: ty::UnboxedClosureKind) {
|
kind: ty::UnboxedClosureKind) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
ebml_w.emit_enum("UnboxedClosureKind", |ebml_w| {
|
ebml_w.emit_enum("UnboxedClosureKind", |ebml_w| {
|
||||||
match kind {
|
match kind {
|
||||||
ty::FnUnboxedClosureKind => {
|
ty::FnUnboxedClosureKind => {
|
||||||
|
@ -755,6 +761,8 @@ pub fn encode_unboxed_closure_kind(ebml_w: &mut Encoder,
|
||||||
pub fn encode_vtable_origin(ecx: &e::EncodeContext,
|
pub fn encode_vtable_origin(ecx: &e::EncodeContext,
|
||||||
rbml_w: &mut Encoder,
|
rbml_w: &mut Encoder,
|
||||||
vtable_origin: &typeck::vtable_origin) {
|
vtable_origin: &typeck::vtable_origin) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
rbml_w.emit_enum("vtable_origin", |rbml_w| {
|
rbml_w.emit_enum("vtable_origin", |rbml_w| {
|
||||||
match *vtable_origin {
|
match *vtable_origin {
|
||||||
typeck::vtable_static(def_id, ref substs, ref vtable_res) => {
|
typeck::vtable_static(def_id, ref substs, ref vtable_res) => {
|
||||||
|
@ -985,6 +993,8 @@ impl<'a> rbml_writer_helpers for Encoder<'a> {
|
||||||
fn emit_polytype(&mut self,
|
fn emit_polytype(&mut self,
|
||||||
ecx: &e::EncodeContext,
|
ecx: &e::EncodeContext,
|
||||||
pty: ty::Polytype) {
|
pty: ty::Polytype) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
self.emit_struct("Polytype", 2, |this| {
|
self.emit_struct("Polytype", 2, |this| {
|
||||||
this.emit_struct_field("generics", 0, |this| {
|
this.emit_struct_field("generics", 0, |this| {
|
||||||
this.emit_struct("Generics", 2, |this| {
|
this.emit_struct("Generics", 2, |this| {
|
||||||
|
@ -1013,6 +1023,8 @@ impl<'a> rbml_writer_helpers for Encoder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment) {
|
fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment) {
|
||||||
|
use serialize::Encoder;
|
||||||
|
|
||||||
self.emit_enum("AutoAdjustment", |this| {
|
self.emit_enum("AutoAdjustment", |this| {
|
||||||
match *adj {
|
match *adj {
|
||||||
ty::AutoAddEnv(store) => {
|
ty::AutoAddEnv(store) => {
|
||||||
|
|
|
@ -21,10 +21,31 @@ use middle::subst::{ParamSpace, FnSpace, TypeSpace};
|
||||||
use middle::ty::{ExplicitSelfCategory, StaticExplicitSelfCategory};
|
use middle::ty::{ExplicitSelfCategory, StaticExplicitSelfCategory};
|
||||||
use util::nodemap::{NodeMap, DefIdSet, FnvHashMap};
|
use util::nodemap::{NodeMap, DefIdSet, FnvHashMap};
|
||||||
|
|
||||||
use syntax::ast::*;
|
use syntax::ast::{Arm, BindByRef, BindByValue, BindingMode, Block, Crate};
|
||||||
|
use syntax::ast::{DeclItem, DefId, Expr, ExprAgain, ExprBreak, ExprField};
|
||||||
|
use syntax::ast::{ExprFnBlock, ExprForLoop, ExprLoop, ExprMethodCall};
|
||||||
|
use syntax::ast::{ExprPath, ExprProc, ExprStruct, ExprUnboxedFn, FnDecl};
|
||||||
|
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic, Generics};
|
||||||
|
use syntax::ast::{Ident, ImplItem, Item, ItemEnum, ItemFn, ItemForeignMod};
|
||||||
|
use syntax::ast::{ItemImpl, ItemMac, ItemMod, ItemStatic, ItemStruct};
|
||||||
|
use syntax::ast::{ItemTrait, ItemTy, LOCAL_CRATE, Local, Method};
|
||||||
|
use syntax::ast::{MethodImplItem, Mod, Name, NamedField, NodeId};
|
||||||
|
use syntax::ast::{OtherRegionTyParamBound, P, Pat, PatEnum, PatIdent, PatLit};
|
||||||
|
use syntax::ast::{PatRange, PatStruct, Path, PathListIdent, PathListMod};
|
||||||
|
use syntax::ast::{PrimTy, Public, SelfExplicit, SelfStatic};
|
||||||
|
use syntax::ast::{StaticRegionTyParamBound, StmtDecl, StructField};
|
||||||
|
use syntax::ast::{StructVariantKind, TraitRef, TraitTyParamBound};
|
||||||
|
use syntax::ast::{TupleVariantKind, Ty, TyBool, TyChar, TyClosure, TyF32};
|
||||||
|
use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt};
|
||||||
|
use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyProc, TyRptr};
|
||||||
|
use syntax::ast::{TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint};
|
||||||
|
use syntax::ast::{UnboxedFnTyParamBound, UnnamedField, UnsafeFn, Variant};
|
||||||
|
use syntax::ast::{ViewItem, ViewItemExternCrate, ViewItemUse, ViewPathGlob};
|
||||||
|
use syntax::ast::{ViewPathList, ViewPathSimple, Visibility};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util::{local_def, PostExpansionMethod};
|
use syntax::ast_util::{PostExpansionMethod, local_def};
|
||||||
use syntax::ast_util::{walk_pat, trait_item_to_ty_method};
|
use syntax::ast_util::{trait_item_to_ty_method, walk_pat};
|
||||||
|
use syntax::attr::AttrMetaMethods;
|
||||||
use syntax::ext::mtwt;
|
use syntax::ext::mtwt;
|
||||||
use syntax::parse::token::special_names;
|
use syntax::parse::token::special_names;
|
||||||
use syntax::parse::token::special_idents;
|
use syntax::parse::token::special_idents;
|
||||||
|
@ -355,6 +376,7 @@ struct ImportDirective {
|
||||||
span: Span,
|
span: Span,
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
is_public: bool, // see note in ImportResolution about how to use this
|
is_public: bool, // see note in ImportResolution about how to use this
|
||||||
|
shadowable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ImportDirective {
|
impl ImportDirective {
|
||||||
|
@ -362,7 +384,8 @@ impl ImportDirective {
|
||||||
subclass: ImportDirectiveSubclass,
|
subclass: ImportDirectiveSubclass,
|
||||||
span: Span,
|
span: Span,
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
is_public: bool)
|
is_public: bool,
|
||||||
|
shadowable: bool)
|
||||||
-> ImportDirective {
|
-> ImportDirective {
|
||||||
ImportDirective {
|
ImportDirective {
|
||||||
module_path: module_path,
|
module_path: module_path,
|
||||||
|
@ -370,6 +393,7 @@ impl ImportDirective {
|
||||||
span: span,
|
span: span,
|
||||||
id: id,
|
id: id,
|
||||||
is_public: is_public,
|
is_public: is_public,
|
||||||
|
shadowable: shadowable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,13 +403,18 @@ impl ImportDirective {
|
||||||
struct Target {
|
struct Target {
|
||||||
target_module: Rc<Module>,
|
target_module: Rc<Module>,
|
||||||
bindings: Rc<NameBindings>,
|
bindings: Rc<NameBindings>,
|
||||||
|
shadowable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Target {
|
impl Target {
|
||||||
fn new(target_module: Rc<Module>, bindings: Rc<NameBindings>) -> Target {
|
fn new(target_module: Rc<Module>,
|
||||||
|
bindings: Rc<NameBindings>,
|
||||||
|
shadowable: bool)
|
||||||
|
-> Target {
|
||||||
Target {
|
Target {
|
||||||
target_module: target_module,
|
target_module: target_module,
|
||||||
bindings: bindings
|
bindings: bindings,
|
||||||
|
shadowable: shadowable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1018,6 +1047,10 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
let module_ = reduced_graph_parent.module();
|
let module_ = reduced_graph_parent.module();
|
||||||
|
|
||||||
|
self.check_for_conflicts_between_external_crates_and_items(&*module_,
|
||||||
|
name.name,
|
||||||
|
sp);
|
||||||
|
|
||||||
// Add or reuse the child.
|
// Add or reuse the child.
|
||||||
let child = module_.children.borrow().find_copy(&name.name);
|
let child = module_.children.borrow().find_copy(&name.name);
|
||||||
match child {
|
match child {
|
||||||
|
@ -1481,6 +1514,14 @@ impl<'a> Resolver<'a> {
|
||||||
// Build up the import directives.
|
// Build up the import directives.
|
||||||
let module_ = parent.module();
|
let module_ = parent.module();
|
||||||
let is_public = view_item.vis == ast::Public;
|
let is_public = view_item.vis == ast::Public;
|
||||||
|
let shadowable =
|
||||||
|
view_item.attrs
|
||||||
|
.iter()
|
||||||
|
.any(|attr| {
|
||||||
|
attr.name() == token::get_ident(
|
||||||
|
special_idents::prelude_import)
|
||||||
|
});
|
||||||
|
|
||||||
match view_path.node {
|
match view_path.node {
|
||||||
ViewPathSimple(binding, ref full_path, id) => {
|
ViewPathSimple(binding, ref full_path, id) => {
|
||||||
let source_ident =
|
let source_ident =
|
||||||
|
@ -1497,7 +1538,8 @@ impl<'a> Resolver<'a> {
|
||||||
subclass,
|
subclass,
|
||||||
view_path.span,
|
view_path.span,
|
||||||
id,
|
id,
|
||||||
is_public);
|
is_public,
|
||||||
|
shadowable);
|
||||||
}
|
}
|
||||||
ViewPathList(_, ref source_items, _) => {
|
ViewPathList(_, ref source_items, _) => {
|
||||||
// Make sure there's at most one `mod` import in the list.
|
// Make sure there's at most one `mod` import in the list.
|
||||||
|
@ -1542,7 +1584,9 @@ impl<'a> Resolver<'a> {
|
||||||
module_path,
|
module_path,
|
||||||
SingleImport(name, name),
|
SingleImport(name, name),
|
||||||
source_item.span,
|
source_item.span,
|
||||||
source_item.node.id(), is_public);
|
source_item.node.id(),
|
||||||
|
is_public,
|
||||||
|
shadowable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ViewPathGlob(_, id) => {
|
ViewPathGlob(_, id) => {
|
||||||
|
@ -1551,7 +1595,8 @@ impl<'a> Resolver<'a> {
|
||||||
GlobImport,
|
GlobImport,
|
||||||
view_path.span,
|
view_path.span,
|
||||||
id,
|
id,
|
||||||
is_public);
|
is_public,
|
||||||
|
shadowable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1571,6 +1616,10 @@ impl<'a> Resolver<'a> {
|
||||||
true));
|
true));
|
||||||
debug!("(build reduced graph for item) found extern `{}`",
|
debug!("(build reduced graph for item) found extern `{}`",
|
||||||
self.module_to_string(&*external_module));
|
self.module_to_string(&*external_module));
|
||||||
|
self.check_for_conflicts_between_external_crates(
|
||||||
|
&*parent.module(),
|
||||||
|
name.name,
|
||||||
|
view_item.span);
|
||||||
parent.module().external_module_children.borrow_mut()
|
parent.module().external_module_children.borrow_mut()
|
||||||
.insert(name.name, external_module.clone());
|
.insert(name.name, external_module.clone());
|
||||||
self.build_reduced_graph_for_external_crate(external_module);
|
self.build_reduced_graph_for_external_crate(external_module);
|
||||||
|
@ -1989,11 +2038,14 @@ impl<'a> Resolver<'a> {
|
||||||
subclass: ImportDirectiveSubclass,
|
subclass: ImportDirectiveSubclass,
|
||||||
span: Span,
|
span: Span,
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
is_public: bool) {
|
is_public: bool,
|
||||||
|
shadowable: bool) {
|
||||||
module_.imports.borrow_mut().push(ImportDirective::new(module_path,
|
module_.imports.borrow_mut().push(ImportDirective::new(module_path,
|
||||||
subclass,
|
subclass,
|
||||||
span, id,
|
span,
|
||||||
is_public));
|
id,
|
||||||
|
is_public,
|
||||||
|
shadowable));
|
||||||
self.unresolved_imports += 1;
|
self.unresolved_imports += 1;
|
||||||
// Bump the reference count on the name. Or, if this is a glob, set
|
// Bump the reference count on the name. Or, if this is a glob, set
|
||||||
// the appropriate flag.
|
// the appropriate flag.
|
||||||
|
@ -2241,8 +2293,7 @@ impl<'a> Resolver<'a> {
|
||||||
resolution_result =
|
resolution_result =
|
||||||
self.resolve_glob_import(&*module_,
|
self.resolve_glob_import(&*module_,
|
||||||
containing_module,
|
containing_module,
|
||||||
import_directive.id,
|
import_directive,
|
||||||
import_directive.is_public,
|
|
||||||
lp);
|
lp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2397,7 +2448,11 @@ impl<'a> Resolver<'a> {
|
||||||
None => {
|
None => {
|
||||||
return UnboundResult;
|
return UnboundResult;
|
||||||
}
|
}
|
||||||
Some(Target {target_module, bindings}) => {
|
Some(Target {
|
||||||
|
target_module,
|
||||||
|
bindings,
|
||||||
|
shadowable: _
|
||||||
|
}) => {
|
||||||
debug!("(resolving single import) found \
|
debug!("(resolving single import) found \
|
||||||
import in ns {:?}", namespace);
|
import in ns {:?}", namespace);
|
||||||
let id = import_resolution.id(namespace);
|
let id = import_resolution.id(namespace);
|
||||||
|
@ -2462,8 +2517,16 @@ impl<'a> Resolver<'a> {
|
||||||
match value_result {
|
match value_result {
|
||||||
BoundResult(ref target_module, ref name_bindings) => {
|
BoundResult(ref target_module, ref name_bindings) => {
|
||||||
debug!("(resolving single import) found value target");
|
debug!("(resolving single import) found value target");
|
||||||
import_resolution.value_target = Some(Target::new(target_module.clone(),
|
self.check_for_conflicting_import(
|
||||||
name_bindings.clone()));
|
&import_resolution.value_target,
|
||||||
|
directive.span,
|
||||||
|
target.name,
|
||||||
|
ValueNS);
|
||||||
|
|
||||||
|
import_resolution.value_target =
|
||||||
|
Some(Target::new(target_module.clone(),
|
||||||
|
name_bindings.clone(),
|
||||||
|
directive.shadowable));
|
||||||
import_resolution.value_id = directive.id;
|
import_resolution.value_id = directive.id;
|
||||||
import_resolution.is_public = directive.is_public;
|
import_resolution.is_public = directive.is_public;
|
||||||
value_used_public = name_bindings.defined_in_public_namespace(ValueNS);
|
value_used_public = name_bindings.defined_in_public_namespace(ValueNS);
|
||||||
|
@ -2477,8 +2540,16 @@ impl<'a> Resolver<'a> {
|
||||||
BoundResult(ref target_module, ref name_bindings) => {
|
BoundResult(ref target_module, ref name_bindings) => {
|
||||||
debug!("(resolving single import) found type target: {:?}",
|
debug!("(resolving single import) found type target: {:?}",
|
||||||
{ name_bindings.type_def.borrow().clone().unwrap().type_def });
|
{ name_bindings.type_def.borrow().clone().unwrap().type_def });
|
||||||
|
self.check_for_conflicting_import(
|
||||||
|
&import_resolution.type_target,
|
||||||
|
directive.span,
|
||||||
|
target.name,
|
||||||
|
TypeNS);
|
||||||
|
|
||||||
import_resolution.type_target =
|
import_resolution.type_target =
|
||||||
Some(Target::new(target_module.clone(), name_bindings.clone()));
|
Some(Target::new(target_module.clone(),
|
||||||
|
name_bindings.clone(),
|
||||||
|
directive.shadowable));
|
||||||
import_resolution.type_id = directive.id;
|
import_resolution.type_id = directive.id;
|
||||||
import_resolution.is_public = directive.is_public;
|
import_resolution.is_public = directive.is_public;
|
||||||
type_used_public = name_bindings.defined_in_public_namespace(TypeNS);
|
type_used_public = name_bindings.defined_in_public_namespace(TypeNS);
|
||||||
|
@ -2489,6 +2560,12 @@ impl<'a> Resolver<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.check_for_conflicts_between_imports_and_items(
|
||||||
|
module_,
|
||||||
|
import_resolution,
|
||||||
|
directive.span,
|
||||||
|
target.name);
|
||||||
|
|
||||||
if value_result.is_unbound() && type_result.is_unbound() {
|
if value_result.is_unbound() && type_result.is_unbound() {
|
||||||
let msg = format!("There is no `{}` in `{}`",
|
let msg = format!("There is no `{}` in `{}`",
|
||||||
token::get_ident(source),
|
token::get_ident(source),
|
||||||
|
@ -2540,10 +2617,12 @@ impl<'a> Resolver<'a> {
|
||||||
fn resolve_glob_import(&mut self,
|
fn resolve_glob_import(&mut self,
|
||||||
module_: &Module,
|
module_: &Module,
|
||||||
containing_module: Rc<Module>,
|
containing_module: Rc<Module>,
|
||||||
id: NodeId,
|
import_directive: &ImportDirective,
|
||||||
is_public: bool,
|
|
||||||
lp: LastPrivate)
|
lp: LastPrivate)
|
||||||
-> ResolveResult<()> {
|
-> ResolveResult<()> {
|
||||||
|
let id = import_directive.id;
|
||||||
|
let is_public = import_directive.is_public;
|
||||||
|
|
||||||
// This function works in a highly imperative manner; it eagerly adds
|
// This function works in a highly imperative manner; it eagerly adds
|
||||||
// everything it can to the list of import resolutions of the module
|
// everything it can to the list of import resolutions of the module
|
||||||
// node.
|
// node.
|
||||||
|
@ -2619,9 +2698,12 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
for (&name, name_bindings) in containing_module.children
|
for (&name, name_bindings) in containing_module.children
|
||||||
.borrow().iter() {
|
.borrow().iter() {
|
||||||
self.merge_import_resolution(module_, containing_module.clone(),
|
self.merge_import_resolution(module_,
|
||||||
id, is_public,
|
containing_module.clone(),
|
||||||
name, name_bindings.clone());
|
import_directive,
|
||||||
|
name,
|
||||||
|
name_bindings.clone());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add external module children from the containing module.
|
// Add external module children from the containing module.
|
||||||
|
@ -2629,9 +2711,11 @@ impl<'a> Resolver<'a> {
|
||||||
.borrow().iter() {
|
.borrow().iter() {
|
||||||
let name_bindings =
|
let name_bindings =
|
||||||
Rc::new(Resolver::create_name_bindings_from_module(module.clone()));
|
Rc::new(Resolver::create_name_bindings_from_module(module.clone()));
|
||||||
self.merge_import_resolution(module_, containing_module.clone(),
|
self.merge_import_resolution(module_,
|
||||||
id, is_public,
|
containing_module.clone(),
|
||||||
name, name_bindings);
|
import_directive,
|
||||||
|
name,
|
||||||
|
name_bindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the destination of this import
|
// Record the destination of this import
|
||||||
|
@ -2650,10 +2734,12 @@ impl<'a> Resolver<'a> {
|
||||||
fn merge_import_resolution(&mut self,
|
fn merge_import_resolution(&mut self,
|
||||||
module_: &Module,
|
module_: &Module,
|
||||||
containing_module: Rc<Module>,
|
containing_module: Rc<Module>,
|
||||||
id: NodeId,
|
import_directive: &ImportDirective,
|
||||||
is_public: bool,
|
|
||||||
name: Name,
|
name: Name,
|
||||||
name_bindings: Rc<NameBindings>) {
|
name_bindings: Rc<NameBindings>) {
|
||||||
|
let id = import_directive.id;
|
||||||
|
let is_public = import_directive.is_public;
|
||||||
|
|
||||||
let mut import_resolutions = module_.import_resolutions.borrow_mut();
|
let mut import_resolutions = module_.import_resolutions.borrow_mut();
|
||||||
let dest_import_resolution = import_resolutions.find_or_insert_with(name, |_| {
|
let dest_import_resolution = import_resolutions.find_or_insert_with(name, |_| {
|
||||||
// Create a new import resolution from this child.
|
// Create a new import resolution from this child.
|
||||||
|
@ -2670,16 +2756,169 @@ impl<'a> Resolver<'a> {
|
||||||
if name_bindings.defined_in_public_namespace(ValueNS) {
|
if name_bindings.defined_in_public_namespace(ValueNS) {
|
||||||
debug!("(resolving glob import) ... for value target");
|
debug!("(resolving glob import) ... for value target");
|
||||||
dest_import_resolution.value_target =
|
dest_import_resolution.value_target =
|
||||||
Some(Target::new(containing_module.clone(), name_bindings.clone()));
|
Some(Target::new(containing_module.clone(),
|
||||||
|
name_bindings.clone(),
|
||||||
|
import_directive.shadowable));
|
||||||
dest_import_resolution.value_id = id;
|
dest_import_resolution.value_id = id;
|
||||||
}
|
}
|
||||||
if name_bindings.defined_in_public_namespace(TypeNS) {
|
if name_bindings.defined_in_public_namespace(TypeNS) {
|
||||||
debug!("(resolving glob import) ... for type target");
|
debug!("(resolving glob import) ... for type target");
|
||||||
dest_import_resolution.type_target =
|
dest_import_resolution.type_target =
|
||||||
Some(Target::new(containing_module, name_bindings.clone()));
|
Some(Target::new(containing_module,
|
||||||
|
name_bindings.clone(),
|
||||||
|
import_directive.shadowable));
|
||||||
dest_import_resolution.type_id = id;
|
dest_import_resolution.type_id = id;
|
||||||
}
|
}
|
||||||
dest_import_resolution.is_public = is_public;
|
dest_import_resolution.is_public = is_public;
|
||||||
|
|
||||||
|
self.check_for_conflicts_between_imports_and_items(
|
||||||
|
module_,
|
||||||
|
dest_import_resolution,
|
||||||
|
import_directive.span,
|
||||||
|
name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks that imported names and items don't have the same name.
|
||||||
|
fn check_for_conflicting_import(&mut self,
|
||||||
|
target: &Option<Target>,
|
||||||
|
import_span: Span,
|
||||||
|
name: Name,
|
||||||
|
namespace: Namespace) {
|
||||||
|
if self.session.features.import_shadowing.get() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
match *target {
|
||||||
|
Some(ref target) if !target.shadowable => {
|
||||||
|
let msg = format!("a {} named `{}` has already been imported \
|
||||||
|
in this module",
|
||||||
|
match namespace {
|
||||||
|
TypeNS => "type",
|
||||||
|
ValueNS => "value",
|
||||||
|
},
|
||||||
|
token::get_name(name).get());
|
||||||
|
self.session.span_err(import_span, msg.as_slice());
|
||||||
|
}
|
||||||
|
Some(_) | None => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks that imported names and items don't have the same name.
|
||||||
|
fn check_for_conflicts_between_imports_and_items(&mut self,
|
||||||
|
module: &Module,
|
||||||
|
import_resolution:
|
||||||
|
&mut ImportResolution,
|
||||||
|
import_span: Span,
|
||||||
|
name: Name) {
|
||||||
|
if self.session.features.import_shadowing.get() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// First, check for conflicts between imports and `extern crate`s.
|
||||||
|
if module.external_module_children
|
||||||
|
.borrow()
|
||||||
|
.contains_key(&name) {
|
||||||
|
match import_resolution.type_target {
|
||||||
|
Some(ref target) if !target.shadowable => {
|
||||||
|
self.session.span_err(import_span,
|
||||||
|
"import conflicts with imported \
|
||||||
|
crate in this module");
|
||||||
|
}
|
||||||
|
Some(_) | None => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for item conflicts.
|
||||||
|
let children = module.children.borrow();
|
||||||
|
let name_bindings = match children.find(&name) {
|
||||||
|
None => {
|
||||||
|
// There can't be any conflicts.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Some(ref name_bindings) => (*name_bindings).clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
match import_resolution.value_target {
|
||||||
|
Some(ref target) if !target.shadowable => {
|
||||||
|
match *name_bindings.value_def.borrow() {
|
||||||
|
None => {}
|
||||||
|
Some(ref value) => {
|
||||||
|
self.session.span_err(import_span,
|
||||||
|
"import conflicts with value \
|
||||||
|
in this module");
|
||||||
|
match value.value_span {
|
||||||
|
None => {}
|
||||||
|
Some(span) => {
|
||||||
|
self.session
|
||||||
|
.span_note(span,
|
||||||
|
"note conflicting value here");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some(_) | None => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match import_resolution.type_target {
|
||||||
|
Some(ref target) if !target.shadowable => {
|
||||||
|
match *name_bindings.type_def.borrow() {
|
||||||
|
None => {}
|
||||||
|
Some(ref ty) => {
|
||||||
|
self.session.span_err(import_span,
|
||||||
|
"import conflicts with type in \
|
||||||
|
this module");
|
||||||
|
match ty.type_span {
|
||||||
|
None => {}
|
||||||
|
Some(span) => {
|
||||||
|
self.session
|
||||||
|
.span_note(span,
|
||||||
|
"note conflicting type here")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some(_) | None => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks that the names of external crates don't collide with other
|
||||||
|
/// external crates.
|
||||||
|
fn check_for_conflicts_between_external_crates(&self,
|
||||||
|
module: &Module,
|
||||||
|
name: Name,
|
||||||
|
span: Span) {
|
||||||
|
if self.session.features.import_shadowing.get() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if module.external_module_children.borrow().contains_key(&name) {
|
||||||
|
self.session
|
||||||
|
.span_err(span,
|
||||||
|
format!("an external crate named `{}` has already \
|
||||||
|
been imported into this module",
|
||||||
|
token::get_name(name).get()).as_slice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks that the names of items don't collide with external crates.
|
||||||
|
fn check_for_conflicts_between_external_crates_and_items(&self,
|
||||||
|
module: &Module,
|
||||||
|
name: Name,
|
||||||
|
span: Span) {
|
||||||
|
if self.session.features.import_shadowing.get() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if module.external_module_children.borrow().contains_key(&name) {
|
||||||
|
self.session
|
||||||
|
.span_err(span,
|
||||||
|
format!("the name `{}` conflicts with an external \
|
||||||
|
crate that has been imported into this \
|
||||||
|
module",
|
||||||
|
token::get_name(name).get()).as_slice());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolves the given module path from the given root `module_`.
|
/// Resolves the given module path from the given root `module_`.
|
||||||
|
@ -2947,7 +3186,9 @@ impl<'a> Resolver<'a> {
|
||||||
Some(name_bindings)
|
Some(name_bindings)
|
||||||
if name_bindings.defined_in_namespace(namespace) => {
|
if name_bindings.defined_in_namespace(namespace) => {
|
||||||
debug!("top name bindings succeeded");
|
debug!("top name bindings succeeded");
|
||||||
return Success((Target::new(module_.clone(), name_bindings.clone()),
|
return Success((Target::new(module_.clone(),
|
||||||
|
name_bindings.clone(),
|
||||||
|
false),
|
||||||
false));
|
false));
|
||||||
}
|
}
|
||||||
Some(_) | None => { /* Not found; continue. */ }
|
Some(_) | None => { /* Not found; continue. */ }
|
||||||
|
@ -2987,7 +3228,10 @@ impl<'a> Resolver<'a> {
|
||||||
let name_bindings =
|
let name_bindings =
|
||||||
Rc::new(Resolver::create_name_bindings_from_module(module));
|
Rc::new(Resolver::create_name_bindings_from_module(module));
|
||||||
debug!("lower name bindings succeeded");
|
debug!("lower name bindings succeeded");
|
||||||
return Success((Target::new(module_, name_bindings), false));
|
return Success((Target::new(module_,
|
||||||
|
name_bindings,
|
||||||
|
false),
|
||||||
|
false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3210,7 +3454,9 @@ impl<'a> Resolver<'a> {
|
||||||
Some(name_bindings)
|
Some(name_bindings)
|
||||||
if name_bindings.defined_in_namespace(namespace) => {
|
if name_bindings.defined_in_namespace(namespace) => {
|
||||||
debug!("(resolving name in module) found node as child");
|
debug!("(resolving name in module) found node as child");
|
||||||
return Success((Target::new(module_.clone(), name_bindings.clone()),
|
return Success((Target::new(module_.clone(),
|
||||||
|
name_bindings.clone(),
|
||||||
|
false),
|
||||||
false));
|
false));
|
||||||
}
|
}
|
||||||
Some(_) | None => {
|
Some(_) | None => {
|
||||||
|
@ -3261,7 +3507,10 @@ impl<'a> Resolver<'a> {
|
||||||
Some(module) => {
|
Some(module) => {
|
||||||
let name_bindings =
|
let name_bindings =
|
||||||
Rc::new(Resolver::create_name_bindings_from_module(module));
|
Rc::new(Resolver::create_name_bindings_from_module(module));
|
||||||
return Success((Target::new(module_, name_bindings), false));
|
return Success((Target::new(module_,
|
||||||
|
name_bindings,
|
||||||
|
false),
|
||||||
|
false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,8 @@ use middle::pat_util::*;
|
||||||
use middle::resolve::DefMap;
|
use middle::resolve::DefMap;
|
||||||
use middle::trans::adt;
|
use middle::trans::adt;
|
||||||
use middle::trans::base::*;
|
use middle::trans::base::*;
|
||||||
use middle::trans::build::*;
|
use middle::trans::build::{And, BitCast, Br, CondBr, GEPi, InBoundsGEP, Load};
|
||||||
|
use middle::trans::build::{Mul, Not, Store, Sub, Switch, add_comment};
|
||||||
use middle::trans::build;
|
use middle::trans::build;
|
||||||
use middle::trans::callee;
|
use middle::trans::callee;
|
||||||
use middle::trans::cleanup;
|
use middle::trans::cleanup;
|
||||||
|
|
|
@ -47,11 +47,17 @@ use middle::trans::builder::{Builder, noname};
|
||||||
use middle::trans::callee;
|
use middle::trans::callee;
|
||||||
use middle::trans::cleanup::{CleanupMethods, ScopeId};
|
use middle::trans::cleanup::{CleanupMethods, ScopeId};
|
||||||
use middle::trans::cleanup;
|
use middle::trans::cleanup;
|
||||||
use middle::trans::common::*;
|
use middle::trans::common::{Block, C_bool, C_bytes, C_i32, C_integral, C_nil};
|
||||||
|
use middle::trans::common::{C_null, C_struct, C_u64, C_u8, C_uint, C_undef};
|
||||||
|
use middle::trans::common::{CrateContext, ExternMap, FunctionContext};
|
||||||
|
use middle::trans::common::{NodeInfo, Result, SubstP, monomorphize_type};
|
||||||
|
use middle::trans::common::{node_id_type, param_substs, return_type_is_void};
|
||||||
|
use middle::trans::common::{tydesc_info, type_is_immediate};
|
||||||
|
use middle::trans::common::{type_is_zero_size, val_ty};
|
||||||
|
use middle::trans::common;
|
||||||
use middle::trans::consts;
|
use middle::trans::consts;
|
||||||
use middle::trans::controlflow;
|
use middle::trans::controlflow;
|
||||||
use middle::trans::datum;
|
use middle::trans::datum;
|
||||||
// use middle::trans::datum::{Datum, Lvalue, Rvalue, ByRef, ByValue};
|
|
||||||
use middle::trans::debuginfo;
|
use middle::trans::debuginfo;
|
||||||
use middle::trans::expr;
|
use middle::trans::expr;
|
||||||
use middle::trans::foreign;
|
use middle::trans::foreign;
|
||||||
|
@ -1074,7 +1080,7 @@ pub fn raw_block<'a>(
|
||||||
is_lpad: bool,
|
is_lpad: bool,
|
||||||
llbb: BasicBlockRef)
|
llbb: BasicBlockRef)
|
||||||
-> &'a Block<'a> {
|
-> &'a Block<'a> {
|
||||||
Block::new(llbb, is_lpad, None, fcx)
|
common::Block::new(llbb, is_lpad, None, fcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_cond<'a>(
|
pub fn with_cond<'a>(
|
||||||
|
|
|
@ -15,8 +15,8 @@ use std::cmp;
|
||||||
use llvm;
|
use llvm;
|
||||||
use llvm::{Integer, Pointer, Float, Double, Struct, Array};
|
use llvm::{Integer, Pointer, Float, Double, Struct, Array};
|
||||||
use llvm::{StructRetAttribute, ZExtAttribute};
|
use llvm::{StructRetAttribute, ZExtAttribute};
|
||||||
|
use middle::trans::cabi::{ArgType, FnType};
|
||||||
use middle::trans::context::CrateContext;
|
use middle::trans::context::CrateContext;
|
||||||
use middle::trans::cabi::*;
|
|
||||||
use middle::trans::type_::Type;
|
use middle::trans::type_::Type;
|
||||||
|
|
||||||
fn align_up_to(off: uint, a: uint) -> uint {
|
fn align_up_to(off: uint, a: uint) -> uint {
|
||||||
|
|
|
@ -8,13 +8,12 @@
|
||||||
// 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.
|
||||||
|
|
||||||
|
|
||||||
use syntax::abi::{OsWindows, OsMacos, OsiOS};
|
|
||||||
use llvm::*;
|
use llvm::*;
|
||||||
use super::cabi::*;
|
use middle::trans::cabi::{ArgType, FnType};
|
||||||
|
use middle::trans::type_::Type;
|
||||||
use super::common::*;
|
use super::common::*;
|
||||||
use super::machine::*;
|
use super::machine::*;
|
||||||
use middle::trans::type_::Type;
|
use syntax::abi::{OsWindows, OsMacos, OsiOS};
|
||||||
|
|
||||||
pub fn compute_abi_info(ccx: &CrateContext,
|
pub fn compute_abi_info(ccx: &CrateContext,
|
||||||
atys: &[Type],
|
atys: &[Type],
|
||||||
|
|
|
@ -17,7 +17,7 @@ use llvm;
|
||||||
use llvm::{Integer, Pointer, Float, Double};
|
use llvm::{Integer, Pointer, Float, Double};
|
||||||
use llvm::{Struct, Array, Attribute};
|
use llvm::{Struct, Array, Attribute};
|
||||||
use llvm::{StructRetAttribute, ByValAttribute, ZExtAttribute};
|
use llvm::{StructRetAttribute, ByValAttribute, ZExtAttribute};
|
||||||
use middle::trans::cabi::*;
|
use middle::trans::cabi::{ArgType, FnType};
|
||||||
use middle::trans::context::CrateContext;
|
use middle::trans::context::CrateContext;
|
||||||
use middle::trans::type_::Type;
|
use middle::trans::type_::Type;
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use llvm::*;
|
use llvm::*;
|
||||||
use super::cabi::*;
|
|
||||||
use super::common::*;
|
use super::common::*;
|
||||||
use super::machine::*;
|
use super::machine::*;
|
||||||
|
use middle::trans::cabi::{ArgType, FnType};
|
||||||
use middle::trans::type_::Type;
|
use middle::trans::type_::Type;
|
||||||
|
|
||||||
// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
|
// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
|
||||||
|
|
|
@ -37,7 +37,6 @@ use middle::trans::closure;
|
||||||
use middle::trans::common;
|
use middle::trans::common;
|
||||||
use middle::trans::common::*;
|
use middle::trans::common::*;
|
||||||
use middle::trans::datum::*;
|
use middle::trans::datum::*;
|
||||||
use middle::trans::datum::{Datum, KindOps};
|
|
||||||
use middle::trans::expr;
|
use middle::trans::expr;
|
||||||
use middle::trans::glue;
|
use middle::trans::glue;
|
||||||
use middle::trans::inline;
|
use middle::trans::inline;
|
||||||
|
|
|
@ -22,10 +22,10 @@ use middle::trans::cleanup;
|
||||||
use middle::trans::common::*;
|
use middle::trans::common::*;
|
||||||
use middle::trans::consts;
|
use middle::trans::consts;
|
||||||
use middle::trans::datum;
|
use middle::trans::datum;
|
||||||
use middle::trans::debuginfo;
|
|
||||||
use middle::trans::expr;
|
use middle::trans::expr;
|
||||||
use middle::trans::meth;
|
use middle::trans::meth;
|
||||||
use middle::trans::type_::Type;
|
use middle::trans::type_::Type;
|
||||||
|
use middle::trans;
|
||||||
use middle::ty;
|
use middle::ty;
|
||||||
use middle::typeck::MethodCall;
|
use middle::typeck::MethodCall;
|
||||||
use util::ppaux::Repr;
|
use util::ppaux::Repr;
|
||||||
|
@ -66,7 +66,8 @@ pub fn trans_stmt<'a>(cx: &'a Block<'a>,
|
||||||
ast::DeclLocal(ref local) => {
|
ast::DeclLocal(ref local) => {
|
||||||
bcx = init_local(bcx, &**local);
|
bcx = init_local(bcx, &**local);
|
||||||
if cx.sess().opts.debuginfo == FullDebugInfo {
|
if cx.sess().opts.debuginfo == FullDebugInfo {
|
||||||
debuginfo::create_local_var_metadata(bcx, &**local);
|
trans::debuginfo::create_local_var_metadata(bcx,
|
||||||
|
&**local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Inner items are visited by `trans_item`/`trans_meth`.
|
// Inner items are visited by `trans_item`/`trans_meth`.
|
||||||
|
@ -154,7 +155,7 @@ pub fn trans_if<'a>(bcx: &'a Block<'a>,
|
||||||
}
|
}
|
||||||
// if true { .. } [else { .. }]
|
// if true { .. } [else { .. }]
|
||||||
bcx = trans_block(bcx, &*thn, dest);
|
bcx = trans_block(bcx, &*thn, dest);
|
||||||
debuginfo::clear_source_location(bcx.fcx);
|
trans::debuginfo::clear_source_location(bcx.fcx);
|
||||||
} else {
|
} else {
|
||||||
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
|
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
|
||||||
trans.visit_block(&*thn, ());
|
trans.visit_block(&*thn, ());
|
||||||
|
@ -163,7 +164,7 @@ pub fn trans_if<'a>(bcx: &'a Block<'a>,
|
||||||
// if false { .. } else { .. }
|
// if false { .. } else { .. }
|
||||||
Some(elexpr) => {
|
Some(elexpr) => {
|
||||||
bcx = expr::trans_into(bcx, &*elexpr, dest);
|
bcx = expr::trans_into(bcx, &*elexpr, dest);
|
||||||
debuginfo::clear_source_location(bcx.fcx);
|
trans::debuginfo::clear_source_location(bcx.fcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if false { .. }
|
// if false { .. }
|
||||||
|
@ -177,7 +178,7 @@ pub fn trans_if<'a>(bcx: &'a Block<'a>,
|
||||||
let name = format!("then-block-{}-", thn.id);
|
let name = format!("then-block-{}-", thn.id);
|
||||||
let then_bcx_in = bcx.fcx.new_id_block(name.as_slice(), thn.id);
|
let then_bcx_in = bcx.fcx.new_id_block(name.as_slice(), thn.id);
|
||||||
let then_bcx_out = trans_block(then_bcx_in, &*thn, dest);
|
let then_bcx_out = trans_block(then_bcx_in, &*thn, dest);
|
||||||
debuginfo::clear_source_location(bcx.fcx);
|
trans::debuginfo::clear_source_location(bcx.fcx);
|
||||||
|
|
||||||
let next_bcx;
|
let next_bcx;
|
||||||
match els {
|
match els {
|
||||||
|
@ -198,7 +199,7 @@ pub fn trans_if<'a>(bcx: &'a Block<'a>,
|
||||||
|
|
||||||
// Clear the source location because it is still set to whatever has been translated
|
// Clear the source location because it is still set to whatever has been translated
|
||||||
// right before.
|
// right before.
|
||||||
debuginfo::clear_source_location(next_bcx.fcx);
|
trans::debuginfo::clear_source_location(next_bcx.fcx);
|
||||||
|
|
||||||
next_bcx
|
next_bcx
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,10 @@ use std::ops;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use syntax::abi;
|
use syntax::abi;
|
||||||
use syntax::ast::*;
|
use syntax::ast::{CrateNum, DefId, FnStyle, Ident, ItemTrait, LOCAL_CRATE};
|
||||||
|
use syntax::ast::{MutImmutable, MutMutable, Name, NamedField, NodeId};
|
||||||
|
use syntax::ast::{Onceness, StmtExpr, StmtSemi, StructField, UnnamedField};
|
||||||
|
use syntax::ast::{Visibility};
|
||||||
use syntax::ast_util::{is_local, lit_is_str};
|
use syntax::ast_util::{is_local, lit_is_str};
|
||||||
use syntax::ast_util;
|
use syntax::ast_util;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
|
|
|
@ -65,14 +65,15 @@ fn main() {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use alloc::libc_heap::malloc_raw;
|
use alloc::libc_heap::malloc_raw;
|
||||||
use collections::string::String;
|
use collections::string::String;
|
||||||
use collections::hash;
|
use collections::hash;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::kinds::marker;
|
use core::kinds::marker;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::prelude::{Clone, Collection, Drop, Eq, ImmutableSlice, Iterator};
|
||||||
|
use core::prelude::{MutableSlice, None, Option, Ordering, PartialEq};
|
||||||
|
use core::prelude::{PartialOrd, RawPtr, Some, StrSlice, range};
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::raw::Slice;
|
use core::raw::Slice;
|
||||||
use core::slice;
|
use core::slice;
|
||||||
|
|
|
@ -18,9 +18,13 @@
|
||||||
|
|
||||||
#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)]
|
#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)]
|
||||||
#![feature(linkage, lang_items, unsafe_destructor, default_type_params)]
|
#![feature(linkage, lang_items, unsafe_destructor, default_type_params)]
|
||||||
|
#![feature(import_shadowing)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![experimental]
|
#![experimental]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#[phase(plugin, link)] extern crate core;
|
#[phase(plugin, link)] extern crate core;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
|
@ -42,7 +42,7 @@ use core::prelude::*;
|
||||||
|
|
||||||
use alloc::heap;
|
use alloc::heap;
|
||||||
use collections::treemap::TreeMap;
|
use collections::treemap::TreeMap;
|
||||||
use collections::{Map, MutableMap};
|
use collections::MutableMap;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::kinds::marker;
|
use core::kinds::marker;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
@ -261,6 +261,8 @@ impl<T: 'static> KeyValue<T> {
|
||||||
/// assert_eq!(*key.get().unwrap(), 3);
|
/// assert_eq!(*key.get().unwrap(), 3);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn get(&'static self) -> Option<Ref<T>> {
|
pub fn get(&'static self) -> Option<Ref<T>> {
|
||||||
|
use collections::Map;
|
||||||
|
|
||||||
let map = match unsafe { get_local_map() } {
|
let map = match unsafe { get_local_map() } {
|
||||||
Some(map) => map,
|
Some(map) => map,
|
||||||
None => return None,
|
None => return None,
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
//! local storage, and logging. Even a 'freestanding' Rust would likely want
|
//! local storage, and logging. Even a 'freestanding' Rust would likely want
|
||||||
//! to implement this.
|
//! to implement this.
|
||||||
|
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use alloc::arc::Arc;
|
use alloc::arc::Arc;
|
||||||
use alloc::boxed::{BoxAny, Box};
|
use alloc::boxed::{BoxAny, Box};
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
@ -22,6 +20,8 @@ use core::atomic::{AtomicUint, SeqCst};
|
||||||
use core::iter::Take;
|
use core::iter::Take;
|
||||||
use core::kinds::marker;
|
use core::kinds::marker;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::prelude::{Clone, Drop, Err, Iterator, None, Ok, Option, Send, Some};
|
||||||
|
use core::prelude::{drop};
|
||||||
use core::raw;
|
use core::raw;
|
||||||
|
|
||||||
use local_data;
|
use local_data;
|
||||||
|
|
|
@ -72,7 +72,7 @@ use core::raw::Closure;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
|
|
||||||
use local::Local;
|
use local::Local;
|
||||||
use task::{Task, Result};
|
use task::Task;
|
||||||
|
|
||||||
use uw = libunwind;
|
use uw = libunwind;
|
||||||
|
|
||||||
|
|
|
@ -437,8 +437,6 @@ pub use core::fmt::{secret_signed, secret_lower_hex, secret_upper_hex};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use core::fmt::{secret_bool, secret_char, secret_octal, secret_binary};
|
pub use core::fmt::{secret_bool, secret_char, secret_octal, secret_binary};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use core::fmt::{secret_bool, secret_char, secret_octal, secret_binary};
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub use core::fmt::{secret_float, secret_upper_exp, secret_lower_exp};
|
pub use core::fmt::{secret_float, secret_upper_exp, secret_lower_exp};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use core::fmt::{secret_pointer};
|
pub use core::fmt::{secret_pointer};
|
||||||
|
|
|
@ -26,12 +26,7 @@ instances as clients.
|
||||||
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
use c_str::ToCStr;
|
use io::{Listener, Acceptor, IoResult, IoError, TimedOut, standard_error};
|
||||||
use clone::Clone;
|
|
||||||
use io::{Listener, Acceptor, Reader, Writer, IoResult, IoError};
|
|
||||||
use io::{standard_error, TimedOut};
|
|
||||||
use kinds::Send;
|
|
||||||
use boxed::Box;
|
|
||||||
use rt::rtio::{IoFactory, LocalIo, RtioUnixListener};
|
use rt::rtio::{IoFactory, LocalIo, RtioUnixListener};
|
||||||
use rt::rtio::{RtioUnixAcceptor, RtioPipe};
|
use rt::rtio::{RtioUnixAcceptor, RtioPipe};
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
|
|
|
@ -20,7 +20,6 @@ use prelude::*;
|
||||||
use io::{IoResult, IoError};
|
use io::{IoResult, IoError};
|
||||||
use libc;
|
use libc;
|
||||||
use os;
|
use os;
|
||||||
use boxed::Box;
|
|
||||||
use rt::rtio::{RtioPipe, LocalIo};
|
use rt::rtio::{RtioPipe, LocalIo};
|
||||||
|
|
||||||
/// A synchronous, in-memory pipe.
|
/// A synchronous, in-memory pipe.
|
||||||
|
|
|
@ -20,7 +20,6 @@ use io::{IoResult, IoError};
|
||||||
use io;
|
use io;
|
||||||
use libc;
|
use libc;
|
||||||
use mem;
|
use mem;
|
||||||
use boxed::Box;
|
|
||||||
use rt::rtio::{RtioProcess, ProcessConfig, IoFactory, LocalIo};
|
use rt::rtio::{RtioProcess, ProcessConfig, IoFactory, LocalIo};
|
||||||
use rt::rtio;
|
use rt::rtio;
|
||||||
use c_str::CString;
|
use c_str::CString;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use cmp;
|
use cmp;
|
||||||
use io;
|
use io;
|
||||||
use boxed::Box;
|
|
||||||
use slice::bytes::MutableByteVector;
|
use slice::bytes::MutableByteVector;
|
||||||
|
|
||||||
/// Wraps a `Reader`, limiting the number of bytes that can be read from it.
|
/// Wraps a `Reader`, limiting the number of bytes that can be read from it.
|
||||||
|
|
|
@ -107,10 +107,14 @@
|
||||||
|
|
||||||
#![feature(macro_rules, globs, managed_boxes, linkage)]
|
#![feature(macro_rules, globs, managed_boxes, linkage)]
|
||||||
#![feature(default_type_params, phase, lang_items, unsafe_destructor)]
|
#![feature(default_type_params, phase, lang_items, unsafe_destructor)]
|
||||||
|
#![feature(import_shadowing)]
|
||||||
|
|
||||||
// Don't link to std. We are std.
|
// Don't link to std. We are std.
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
#![deny(missing_doc)]
|
#![deny(missing_doc)]
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ use intrinsics;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use num::strconv;
|
use num::strconv;
|
||||||
use num;
|
use num;
|
||||||
use string::String;
|
|
||||||
|
|
||||||
pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
|
pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
|
||||||
pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
|
pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
|
||||||
|
|
|
@ -21,7 +21,6 @@ use intrinsics;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use num::strconv;
|
use num::strconv;
|
||||||
use num;
|
use num;
|
||||||
use string::String;
|
|
||||||
|
|
||||||
pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
|
pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
|
||||||
pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
|
pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
|
||||||
|
|
|
@ -103,10 +103,9 @@
|
||||||
|
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::prelude::{Drop, None, Option, Some};
|
||||||
|
|
||||||
pub use core::atomic::{AtomicBool, AtomicInt, AtomicUint, AtomicPtr};
|
pub use core::atomic::{AtomicBool, AtomicInt, AtomicUint, AtomicPtr};
|
||||||
pub use core::atomic::{Ordering, Relaxed, Release, Acquire, AcqRel, SeqCst};
|
pub use core::atomic::{Ordering, Relaxed, Release, Acquire, AcqRel, SeqCst};
|
||||||
|
|
|
@ -37,7 +37,6 @@ use core::prelude::*;
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use collections::Vec;
|
use collections::Vec;
|
||||||
use collections::Collection;
|
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
use rustrt::local::Local;
|
use rustrt::local::Local;
|
||||||
|
|
|
@ -28,9 +28,13 @@
|
||||||
html_playground_url = "http://play.rust-lang.org/")]
|
html_playground_url = "http://play.rust-lang.org/")]
|
||||||
|
|
||||||
#![feature(phase, globs, macro_rules, unsafe_destructor)]
|
#![feature(phase, globs, macro_rules, unsafe_destructor)]
|
||||||
|
#![feature(import_shadowing)]
|
||||||
#![deny(missing_doc)]
|
#![deny(missing_doc)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
#[phase(plugin, link)] extern crate core;
|
#[phase(plugin, link)] extern crate core;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate collections;
|
extern crate collections;
|
||||||
|
|
|
@ -198,7 +198,7 @@ use owned_slice::OwnedSlice;
|
||||||
use parse::token::InternedString;
|
use parse::token::InternedString;
|
||||||
use parse::token::special_idents;
|
use parse::token::special_idents;
|
||||||
|
|
||||||
use self::ty::*;
|
use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self, Ty};
|
||||||
|
|
||||||
pub mod ty;
|
pub mod ty;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
html_root_url = "http://doc.rust-lang.org/master/")]
|
html_root_url = "http://doc.rust-lang.org/master/")]
|
||||||
|
|
||||||
#![feature(macro_rules, globs, managed_boxes, default_type_params, phase)]
|
#![feature(macro_rules, globs, managed_boxes, default_type_params, phase)]
|
||||||
#![feature(quote, struct_variant, unsafe_destructor)]
|
#![feature(quote, struct_variant, unsafe_destructor, import_shadowing)]
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
|
// NOTE(stage0, pcwalton): Remove after snapshot.
|
||||||
|
#![allow(unknown_features)]
|
||||||
|
|
||||||
extern crate fmt_macros;
|
extern crate fmt_macros;
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
#[phase(plugin, link)] extern crate log;
|
#[phase(plugin, link)] extern crate log;
|
||||||
|
|
|
@ -456,62 +456,63 @@ declare_special_idents_and_keywords! {
|
||||||
(7, opaque, "<opaque>");
|
(7, opaque, "<opaque>");
|
||||||
(8, unnamed_field, "<unnamed_field>");
|
(8, unnamed_field, "<unnamed_field>");
|
||||||
(9, type_self, "Self");
|
(9, type_self, "Self");
|
||||||
|
(10, prelude_import, "prelude_import");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod keywords {
|
pub mod keywords {
|
||||||
// These ones are variants of the Keyword enum
|
// These ones are variants of the Keyword enum
|
||||||
|
|
||||||
'strict:
|
'strict:
|
||||||
(10, As, "as");
|
(11, As, "as");
|
||||||
(11, Break, "break");
|
(12, Break, "break");
|
||||||
(12, Crate, "crate");
|
(13, Crate, "crate");
|
||||||
(13, Else, "else");
|
(14, Else, "else");
|
||||||
(14, Enum, "enum");
|
(15, Enum, "enum");
|
||||||
(15, Extern, "extern");
|
(16, Extern, "extern");
|
||||||
(16, False, "false");
|
(17, False, "false");
|
||||||
(17, Fn, "fn");
|
(18, Fn, "fn");
|
||||||
(18, For, "for");
|
(19, For, "for");
|
||||||
(19, If, "if");
|
(20, If, "if");
|
||||||
(20, Impl, "impl");
|
(21, Impl, "impl");
|
||||||
(21, In, "in");
|
(22, In, "in");
|
||||||
(22, Let, "let");
|
(23, Let, "let");
|
||||||
(23, Loop, "loop");
|
(24, Loop, "loop");
|
||||||
(24, Match, "match");
|
(25, Match, "match");
|
||||||
(25, Mod, "mod");
|
(26, Mod, "mod");
|
||||||
(26, Mut, "mut");
|
(27, Mut, "mut");
|
||||||
(27, Once, "once");
|
(28, Once, "once");
|
||||||
(28, Pub, "pub");
|
(29, Pub, "pub");
|
||||||
(29, Ref, "ref");
|
(30, Ref, "ref");
|
||||||
(30, Return, "return");
|
(31, Return, "return");
|
||||||
// Static and Self are also special idents (prefill de-dupes)
|
// Static and Self are also special idents (prefill de-dupes)
|
||||||
(super::STATIC_KEYWORD_NAME_NUM, Static, "static");
|
(super::STATIC_KEYWORD_NAME_NUM, Static, "static");
|
||||||
(super::SELF_KEYWORD_NAME_NUM, Self, "self");
|
(super::SELF_KEYWORD_NAME_NUM, Self, "self");
|
||||||
(31, Struct, "struct");
|
(32, Struct, "struct");
|
||||||
(32, Super, "super");
|
(33, Super, "super");
|
||||||
(33, True, "true");
|
(34, True, "true");
|
||||||
(34, Trait, "trait");
|
(35, Trait, "trait");
|
||||||
(35, Type, "type");
|
(36, Type, "type");
|
||||||
(36, Unsafe, "unsafe");
|
(37, Unsafe, "unsafe");
|
||||||
(37, Use, "use");
|
(38, Use, "use");
|
||||||
(38, Virtual, "virtual");
|
(39, Virtual, "virtual");
|
||||||
(39, While, "while");
|
(40, While, "while");
|
||||||
(40, Continue, "continue");
|
(41, Continue, "continue");
|
||||||
(41, Proc, "proc");
|
(42, Proc, "proc");
|
||||||
(42, Box, "box");
|
(43, Box, "box");
|
||||||
(43, Const, "const");
|
(44, Const, "const");
|
||||||
(44, Where, "where");
|
(45, Where, "where");
|
||||||
|
|
||||||
'reserved:
|
'reserved:
|
||||||
(45, Alignof, "alignof");
|
(46, Alignof, "alignof");
|
||||||
(46, Be, "be");
|
(47, Be, "be");
|
||||||
(47, Offsetof, "offsetof");
|
(48, Offsetof, "offsetof");
|
||||||
(48, Priv, "priv");
|
(49, Priv, "priv");
|
||||||
(49, Pure, "pure");
|
(50, Pure, "pure");
|
||||||
(50, Sizeof, "sizeof");
|
(51, Sizeof, "sizeof");
|
||||||
(51, Typeof, "typeof");
|
(52, Typeof, "typeof");
|
||||||
(52, Unsized, "unsized");
|
(53, Unsized, "unsized");
|
||||||
(53, Yield, "yield");
|
(54, Yield, "yield");
|
||||||
(54, Do, "do");
|
(55, Do, "do");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ impl rand::Rand for Uuid {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod uuidtest {
|
||||||
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
|
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
|
||||||
Version1Mac, Version2Dce, Version3Md5, Version4Random,
|
Version1Mac, Version2Dce, Version3Md5, Version4Random,
|
||||||
Version5Sha1};
|
Version5Sha1};
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
// aux-build:ambig_impl_2_lib.rs
|
// aux-build:ambig_impl_2_lib.rs
|
||||||
extern crate ambig_impl_2_lib;
|
extern crate ambig_impl_2_lib;
|
||||||
use ambig_impl_2_lib::me;
|
use ambig_impl_2_lib::me;
|
||||||
trait me {
|
trait me2 {
|
||||||
fn me(&self) -> uint;
|
fn me(&self) -> uint;
|
||||||
}
|
}
|
||||||
impl me for uint { fn me(&self) -> uint { *self } } //~ NOTE is `uint.me::me`
|
impl me2 for uint { fn me(&self) -> uint { *self } } //~ NOTE is `uint.me2::me`
|
||||||
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
|
fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope
|
||||||
//~^ NOTE is `ambig_impl_2_lib::uint.me::me`
|
//~^ NOTE is `ambig_impl_2_lib::uint.me::me`
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
// Copyright 2014 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.
|
|
||||||
|
|
||||||
#![feature(globs)]
|
|
||||||
#![deny(unused_imports)]
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
mod test1 {
|
|
||||||
|
|
||||||
mod foo { pub fn p() -> int { 1 } }
|
|
||||||
mod bar { pub fn p() -> int { 2 } }
|
|
||||||
|
|
||||||
pub mod baz {
|
|
||||||
use test1::foo::*; //~ ERROR: unused import
|
|
||||||
use test1::bar::*;
|
|
||||||
|
|
||||||
pub fn my_main() { assert!(p() == 2); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod test2 {
|
|
||||||
|
|
||||||
mod foo { pub fn p() -> int { 1 } }
|
|
||||||
mod bar { pub fn p() -> int { 2 } }
|
|
||||||
|
|
||||||
pub mod baz {
|
|
||||||
use test2::foo::p; //~ ERROR: unused import
|
|
||||||
use test2::bar::p;
|
|
||||||
|
|
||||||
pub fn my_main() { assert!(p() == 2); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod test3 {
|
|
||||||
|
|
||||||
mod foo { pub fn p() -> int { 1 } }
|
|
||||||
mod bar { pub fn p() -> int { 2 } }
|
|
||||||
|
|
||||||
pub mod baz {
|
|
||||||
use test3::foo::*; //~ ERROR: unused import
|
|
||||||
use test3::bar::p;
|
|
||||||
|
|
||||||
pub fn my_main() { assert!(p() == 2); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,13 +8,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
pub extern crate std; //~ ERROR: `pub` visibility is not allowed
|
pub extern crate core; //~ ERROR: `pub` visibility is not allowed
|
||||||
extern crate std;
|
|
||||||
|
|
||||||
pub use std::bool;
|
|
||||||
use std::bool;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
pub use std::bool; //~ ERROR: imports in functions are never reachable
|
pub use std::bool; //~ ERROR: imports in functions are never reachable
|
||||||
use std::bool;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
// Copyright 2013 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.
|
|
||||||
|
|
||||||
#![feature(globs)]
|
|
||||||
#![deny(unused_imports)]
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
mod A {
|
|
||||||
pub fn p() {}
|
|
||||||
}
|
|
||||||
mod B {
|
|
||||||
pub fn p() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod C {
|
|
||||||
pub fn q() {}
|
|
||||||
}
|
|
||||||
mod D {
|
|
||||||
pub fn q() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod E {
|
|
||||||
pub fn r() {}
|
|
||||||
}
|
|
||||||
mod F {
|
|
||||||
pub fn r() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod G {
|
|
||||||
pub fn s() {}
|
|
||||||
pub fn t() {}
|
|
||||||
}
|
|
||||||
mod H {
|
|
||||||
pub fn s() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod I {
|
|
||||||
pub fn u() {}
|
|
||||||
pub fn v() {}
|
|
||||||
}
|
|
||||||
mod J {
|
|
||||||
pub fn u() {}
|
|
||||||
pub fn v() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod K {
|
|
||||||
pub fn w() {}
|
|
||||||
}
|
|
||||||
mod L {
|
|
||||||
pub fn w() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod m {
|
|
||||||
use A::p; //~ ERROR: unused import
|
|
||||||
use B::p;
|
|
||||||
use C::q; //~ ERROR: unused import
|
|
||||||
use D::*;
|
|
||||||
use E::*; //~ ERROR: unused import
|
|
||||||
use F::r;
|
|
||||||
use G::*;
|
|
||||||
use H::*;
|
|
||||||
use I::*;
|
|
||||||
use J::v;
|
|
||||||
use K::*; //~ ERROR: unused import
|
|
||||||
use L::*;
|
|
||||||
|
|
||||||
#[main]
|
|
||||||
fn my_main() {
|
|
||||||
p();
|
|
||||||
q();
|
|
||||||
r();
|
|
||||||
s();
|
|
||||||
t();
|
|
||||||
u();
|
|
||||||
v();
|
|
||||||
w();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
// Copyright 2013 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(unused_imports)]
|
|
||||||
#![allow(non_camel_case_types)]
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
// Regression test for issue #6633
|
|
||||||
mod issue6633 {
|
|
||||||
use self::foo::name::name; //~ ERROR: unused import
|
|
||||||
use self::foo::name;
|
|
||||||
|
|
||||||
pub mod foo {
|
|
||||||
pub mod name {
|
|
||||||
pub type a = int;
|
|
||||||
pub mod name {
|
|
||||||
pub type a = f64;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar() -> name::a { 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Regression test for issue #6935
|
|
||||||
mod issue6935 {
|
|
||||||
use self::a::foo::a::foo;
|
|
||||||
use self::a::foo; //~ ERROR: unused import
|
|
||||||
|
|
||||||
pub mod a {
|
|
||||||
pub mod foo {
|
|
||||||
pub mod a {
|
|
||||||
pub fn foo() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar() { foo(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main(){}
|
|
|
@ -70,7 +70,6 @@ pub mod foo3 {
|
||||||
|
|
||||||
fn test_unused3() {
|
fn test_unused3() {
|
||||||
use foo3::Bar; //~ ERROR `Bar` is private
|
use foo3::Bar; //~ ERROR `Bar` is private
|
||||||
use foo3::{Bar,Baz}; //~ ERROR `Bar` is private
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_single3() {
|
fn test_single3() {
|
||||||
|
|
|
@ -171,7 +171,6 @@ pub mod mytest {
|
||||||
// Even though the inner `A` struct is a publicly exported item (usable from
|
// Even though the inner `A` struct is a publicly exported item (usable from
|
||||||
// external crates through `foo::foo`, it should not be accessible through
|
// external crates through `foo::foo`, it should not be accessible through
|
||||||
// its definition path (which has the private `i` module).
|
// its definition path (which has the private `i` module).
|
||||||
use self::foo::foo;
|
|
||||||
use self::foo::i::A; //~ ERROR: type `A` is inaccessible
|
use self::foo::i::A; //~ ERROR: type `A` is inaccessible
|
||||||
//~^ NOTE: module `i` is private
|
//~^ NOTE: module `i` is private
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2014 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.
|
||||||
|
|
||||||
|
extern crate std;
|
||||||
|
//~^ ERROR an external crate named `std` has already been imported
|
||||||
|
|
||||||
|
fn main(){}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2014 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 std = std::slice; //~ ERROR import conflicts with imported crate
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
||||||
|
|
17
src/test/compile-fail/resolve-conflict-import-vs-import.rs
Normal file
17
src/test/compile-fail/resolve-conflict-import-vs-import.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2014 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 std::mem::transmute;
|
||||||
|
use std::mem::transmute;
|
||||||
|
//~^ ERROR a value named `transmute` has already been imported
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2014 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.
|
||||||
|
|
||||||
|
fn std() {} //~ ERROR the name `std` conflicts with an external crate
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
||||||
|
|
18
src/test/compile-fail/resolve-conflict-item-vs-import.rs
Normal file
18
src/test/compile-fail/resolve-conflict-item-vs-import.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2014 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 std::mem::transmute;
|
||||||
|
//~^ ERROR import conflicts with value in this module
|
||||||
|
|
||||||
|
fn transmute() {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Copyright 2014 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.
|
|
||||||
|
|
||||||
mod a {
|
|
||||||
pub fn foobar() -> int { 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
mod b {
|
|
||||||
pub fn foobar() -> int { 2 }
|
|
||||||
}
|
|
||||||
|
|
||||||
mod c {
|
|
||||||
// Technically the second use shadows the first, but in theory it should
|
|
||||||
// only be shadowed for this module. The implementation of resolve currently
|
|
||||||
// doesn't implement this, so this test is ensuring that using "c::foobar"
|
|
||||||
// is *not* getting b::foobar. Today it's an error, but perhaps one day it
|
|
||||||
// can correctly get a::foobar instead.
|
|
||||||
pub use a::foobar;
|
|
||||||
use b::foobar;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
assert_eq!(c::foobar(), 1);
|
|
||||||
//~^ ERROR: unresolved name `c::foobar`
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#![foo] //~ ERROR unused attribute
|
#![foo] //~ ERROR unused attribute
|
||||||
|
|
||||||
#[foo] //~ ERROR unused attribute
|
#[foo] //~ ERROR unused attribute
|
||||||
extern crate std;
|
extern crate core;
|
||||||
|
|
||||||
#[foo] //~ ERROR unused attribute
|
#[foo] //~ ERROR unused attribute
|
||||||
use std::collections;
|
use std::collections;
|
||||||
|
|
|
@ -12,9 +12,8 @@ use foo::bar::{
|
||||||
mod //~ ERROR module `bar` is private
|
mod //~ ERROR module `bar` is private
|
||||||
};
|
};
|
||||||
use foo::bar::{
|
use foo::bar::{
|
||||||
Bar, //~ ERROR type `Bar` is inaccessible
|
Bar //~ ERROR type `Bar` is inaccessible
|
||||||
//~^ NOTE module `bar` is private
|
//~^ NOTE module `bar` is private
|
||||||
mod //~ ERROR module `bar` is private
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate std = "std";
|
extern crate std = "std";
|
||||||
extern crate rt = "native";
|
extern crate rt = "native";
|
||||||
|
#[prelude_import]
|
||||||
use std::prelude::*;
|
use std::prelude::*;
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
// Issue #7580
|
// Issue #7580
|
||||||
|
|
||||||
|
// ignore-pretty
|
||||||
|
//
|
||||||
|
// Expanded pretty printing causes resolve conflicts.
|
||||||
|
|
||||||
// error-pattern:fail works
|
// error-pattern:fail works
|
||||||
#![feature(globs)]
|
#![feature(globs)]
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ macro_rules! iotest (
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::io::process::Command;
|
use std::io::process::Command;
|
||||||
use native;
|
use native;
|
||||||
use super::*;
|
use super::{sleeper, test_destroy_actually_kills};
|
||||||
|
|
||||||
fn f() $b
|
fn f() $b
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
extern crate extern_mod_ordering_lib;
|
extern crate extern_mod_ordering_lib;
|
||||||
|
|
||||||
use extern_mod_ordering_lib::extern_mod_ordering_lib;
|
use the_lib = extern_mod_ordering_lib::extern_mod_ordering_lib;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
extern_mod_ordering_lib::f();
|
the_lib::f();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
extern crate collections;
|
extern crate collections;
|
||||||
extern crate std;
|
|
||||||
|
|
||||||
use std::collections::Bitv;
|
use std::collections::Bitv;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
extern crate foo = "issue-12612-1";
|
extern crate foo = "issue-12612-1";
|
||||||
extern crate bar = "issue-12612-2";
|
extern crate bar = "issue-12612-2";
|
||||||
|
|
||||||
use foo::bar;
|
|
||||||
|
|
||||||
mod test {
|
mod test {
|
||||||
use bar::baz;
|
use bar::baz;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
use foo::GC;
|
use foo::GC;
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
use d::*;
|
|
||||||
pub use m::GC; // this should shadow d::GC
|
pub use m::GC; // this should shadow d::GC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
|
|
||||||
#[phase(plugin, link)] extern crate std;
|
#[phase(plugin, link)] extern crate std2 = "std";
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
extern crate foo = "issue-5521";
|
extern crate foo = "issue-5521";
|
||||||
|
|
||||||
fn foo(a: foo::map) {
|
fn bar(a: foo::map) {
|
||||||
if false {
|
if false {
|
||||||
fail!();
|
fail!();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,7 +30,6 @@ mod test2 {
|
||||||
mod bar { pub fn p() -> int { 2 } }
|
mod bar { pub fn p() -> int { 2 } }
|
||||||
|
|
||||||
pub mod baz {
|
pub mod baz {
|
||||||
use test2::foo::p;
|
|
||||||
use test2::bar::p;
|
use test2::bar::p;
|
||||||
|
|
||||||
pub fn my_main() { assert!(p() == 2); }
|
pub fn my_main() { assert!(p() == 2); }
|
||||||
|
@ -43,7 +42,6 @@ mod test3 {
|
||||||
mod bar { pub fn p() -> int { 2 } }
|
mod bar { pub fn p() -> int { 2 } }
|
||||||
|
|
||||||
pub mod baz {
|
pub mod baz {
|
||||||
use test3::foo::*;
|
|
||||||
use test3::bar::p;
|
use test3::bar::p;
|
||||||
|
|
||||||
pub fn my_main() { assert!(p() == 2); }
|
pub fn my_main() { assert!(p() == 2); }
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
// 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.
|
||||||
|
|
||||||
use std::rt;
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let x = Some(rt::exclusive::Exclusive::new(true));
|
let x = Some(::std::rt::exclusive::Exclusive::new(true));
|
||||||
match x {
|
match x {
|
||||||
Some(ref z) if *z.lock() => {
|
Some(ref z) if *z.lock() => {
|
||||||
assert!(*z.lock());
|
assert!(*z.lock());
|
||||||
|
|
|
@ -27,8 +27,6 @@ pub mod foo1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_unused1() {
|
fn test_unused1() {
|
||||||
use foo1::Bar;
|
|
||||||
use foo1::{Bar,Baz};
|
|
||||||
use foo1::*;
|
use foo1::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +58,6 @@ pub mod foo2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_unused2() {
|
fn test_unused2() {
|
||||||
use foo2::Bar;
|
|
||||||
use foo2::{Bar,Baz};
|
|
||||||
use foo2::*;
|
use foo2::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +89,6 @@ pub mod foo3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_unused3() {
|
fn test_unused3() {
|
||||||
use foo3::Bar;
|
|
||||||
use foo3::{Bar,Baz};
|
|
||||||
use foo3::*;
|
use foo3::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
// 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.
|
||||||
|
|
||||||
extern crate std;
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
struct t {a: u8, b: i8}
|
struct t {a: u8, b: i8}
|
||||||
|
|
|
@ -9,15 +9,13 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
use std::rt;
|
|
||||||
|
|
||||||
struct Point {x: int, y: int, z: int}
|
struct Point {x: int, y: int, z: int}
|
||||||
|
|
||||||
fn f(p: &mut Point) { p.z = 13; }
|
fn f(p: &mut Point) { p.z = 13; }
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
let x = Some(rt::exclusive::Exclusive::new(true));
|
let x = Some(::std::rt::exclusive::Exclusive::new(true));
|
||||||
match x {
|
match x {
|
||||||
Some(ref z) if *z.lock() => {
|
Some(ref z) if *z.lock() => {
|
||||||
assert!(*z.lock());
|
assert!(*z.lock());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue