Skip to content

Fixes for rustc master #479

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Aug 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::hash;
use std::result;
use std::fmt::{mod, Show, Formatter};
use semver::Version;
use serialize::{Encoder,Encodable};
Expand Down Expand Up @@ -85,7 +84,7 @@ impl LibKind {
}

pub fn from_strs<S: Str>(strings: Vec<S>) -> CargoResult<Vec<LibKind>> {
result::collect(strings.iter().map(|s| LibKind::from_str(s.as_slice())))
strings.iter().map(|s| LibKind::from_str(s.as_slice())).collect()
}

pub fn crate_type(&self) -> &'static str {
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Registry for Vec<Summary> {
}

pub struct PackageRegistry<'a> {
sources: SourceMap,
sources: SourceMap<'a>,
overrides: Vec<SourceId>,
config: &'a mut Config<'a>
}
Expand Down Expand Up @@ -53,7 +53,7 @@ impl<'a> PackageRegistry<'a> {
Ok(ret)
}

pub fn move_sources(self) -> SourceMap {
pub fn move_sources(self) -> SourceMap<'a> {
self.sources
}

Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl fmt::Show for Resolve {
}
}

struct Context<'a, R> {
struct Context<'a, R:'a> {
registry: &'a mut R,
resolve: Resolve,

Expand Down
48 changes: 24 additions & 24 deletions src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ pub struct ShellConfig {
pub tty: bool
}

enum AdequateTerminal {
NoColor(Box<Writer>),
Color(Box<Terminal<Box<Writer>>>)
enum AdequateTerminal<'a> {
NoColor(Box<Writer+'a>),
Color(Box<Terminal<Box<Writer+'a>>+'a>)
}

pub struct Shell {
terminal: AdequateTerminal,
pub struct Shell<'a> {
terminal: AdequateTerminal<'a>,
config: ShellConfig
}

pub struct MultiShell {
out: Shell,
err: Shell,
pub struct MultiShell<'a> {
out: Shell<'a>,
err: Shell<'a>,
verbose: bool
}

pub type Callback<'a> = |&mut MultiShell|:'a -> IoResult<()>;

impl MultiShell {
pub fn new(out: Shell, err: Shell, verbose: bool) -> MultiShell {
impl<'a> MultiShell<'a> {
pub fn new(out: Shell<'a>, err: Shell<'a>, verbose: bool) -> MultiShell<'a> {
MultiShell { out: out, err: err, verbose: verbose }
}

pub fn out(&mut self) -> &mut Shell {
pub fn out(&mut self) -> &mut Shell<'a> {
&mut self.out
}

pub fn err(&mut self) -> &mut Shell {
pub fn err(&mut self) -> &mut Shell<'a> {
&mut self.err
}

Expand Down Expand Up @@ -72,17 +72,17 @@ impl MultiShell {
}
}

pub type ShellCallback<'a> = |&mut Shell|:'a -> IoResult<()>;
pub type ShellCallback<'a> = |&mut Shell<'a>|:'a -> IoResult<()>;

impl Shell {
pub fn create(out: Box<Writer>, config: ShellConfig) -> Shell {
impl<'a> Shell<'a> {
pub fn create(out: Box<Writer+'a>, config: ShellConfig) -> Shell<'a> {
if config.tty && config.color {
let term: Option<term::TerminfoTerminal<Box<Writer>>> = Terminal::new(out);
let term: Option<term::TerminfoTerminal<Box<Writer+'a>>> = Terminal::new(out);
term.map(|t| Shell {
terminal: Color(box t as Box<Terminal<Box<Writer>>>),
terminal: Color(box t as Box<Terminal<Box<Writer+'a>>>),
config: config
}).unwrap_or_else(|| {
Shell { terminal: NoColor(box stderr() as Box<Writer>), config: config }
Shell { terminal: NoColor(box stderr() as Box<Writer+'a>), config: config }
})
} else {
Shell { terminal: NoColor(out), config: config }
Expand Down Expand Up @@ -121,8 +121,8 @@ impl Shell {
}
}

impl Terminal<Box<Writer>> for Shell {
fn new(out: Box<Writer>) -> Option<Shell> {
impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
fn new(out: Box<Writer+'a>) -> Option<Shell<'a>> {
Some(Shell {
terminal: NoColor(out),
config: ShellConfig {
Expand Down Expand Up @@ -168,26 +168,26 @@ impl Terminal<Box<Writer>> for Shell {
}
}

fn unwrap(self) -> Box<Writer> {
fn unwrap(self) -> Box<Writer+'a> {
fail!("Can't unwrap a Shell");
}

fn get_ref<'a>(&'a self) -> &'a Box<Writer> {
fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {
match self.terminal {
Color(ref c) => c.get_ref(),
NoColor(ref w) => w
}
}

fn get_mut<'a>(&'a mut self) -> &'a mut Box<Writer> {
fn get_mut<'b>(&'b mut self) -> &'b mut Box<Writer+'a> {
match self.terminal {
Color(ref mut c) => c.get_mut(),
NoColor(ref mut w) => w
}
}
}

impl Writer for Shell {
impl<'a> Writer for Shell<'a> {
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
match self.terminal {
Color(ref mut c) => c.write(buf),
Expand Down
52 changes: 26 additions & 26 deletions src/cargo/core/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,18 @@ impl SourceId {
}
}

pub fn load(&self, config: &mut Config) -> Box<Source> {
pub fn load<'a>(&self, config: &'a mut Config) -> Box<Source+'a> {
log!(5, "loading SourceId; {}", self);
match self.kind {
GitKind(..) => box GitSource::new(self, config) as Box<Source>,
GitKind(..) => box GitSource::new(self, config) as Box<Source+'a>,
PathKind => {
let path = match self.url.to_file_path() {
Ok(p) => p,
Err(()) => fail!("path sources cannot be remote"),
};
box PathSource::new(&path, self) as Box<Source>
},
RegistryKind => box DummyRegistrySource::new(self) as Box<Source>,
RegistryKind => box DummyRegistrySource::new(self) as Box<Source+'a>,
}
}

Expand All @@ -267,17 +267,17 @@ impl SourceId {
}
}

pub struct SourceMap {
map: HashMap<SourceId, Box<Source>>
pub struct SourceMap<'a> {
map: HashMap<SourceId, Box<Source+'a>>
}

pub type Sources<'a> = Values<'a, SourceId, Box<Source>>;
pub type SourcesMut<'a> = iter::Map<'static, (&'a SourceId, &'a mut Box<Source>),
&'a mut Source,
MutEntries<'a, SourceId, Box<Source>>>;
pub type Sources<'a> = Values<'a, SourceId, Box<Source+'a>>;
pub type SourcesMut<'a> = iter::Map<'static, (&'a SourceId, &'a mut Box<Source+'a>),
&'a mut Source+'a,
MutEntries<'a, SourceId, Box<Source+'a>>>;

impl SourceMap {
pub fn new() -> SourceMap {
impl<'a> SourceMap<'a> {
pub fn new() -> SourceMap<'a> {
SourceMap {
map: HashMap::new()
}
Expand All @@ -287,54 +287,54 @@ impl SourceMap {
self.map.contains_key(id)
}

pub fn get(&self, id: &SourceId) -> Option<&Source> {
pub fn get(&self, id: &SourceId) -> Option<&Source+'a> {
let source = self.map.find(id);

source.map(|s| {
let s: &Source = *s;
let s: &Source+'a = *s;
s
})
}

pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source> {
pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'a> {
self.map.find_mut(id).map(|s| {
let s: &mut Source = *s;
let s: &mut Source+'a = *s;
s
})
}

pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source> {
pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'a> {
self.get(pkg_id.get_source_id())
}

pub fn insert(&mut self, id: &SourceId, source: Box<Source>) {
pub fn insert(&mut self, id: &SourceId, source: Box<Source+'a>) {
self.map.insert(id.clone(), source);
}

pub fn len(&self) -> uint {
self.map.len()
}

pub fn sources(&self) -> Sources {
pub fn sources(&'a self) -> Sources<'a> {
self.map.values()
}

pub fn sources_mut(&mut self) -> SourcesMut {
self.map.mut_iter().map(|(_, v)| { let s: &mut Source = *v; s })
pub fn sources_mut(&'a mut self) -> SourcesMut<'a> {
self.map.mut_iter().map(|(_, v)| { let s: &mut Source+'a = *v; s })
}
}

pub struct SourceSet {
sources: Vec<Box<Source>>
pub struct SourceSet<'a> {
sources: Vec<Box<Source+'a>>
}

impl SourceSet {
pub fn new(sources: Vec<Box<Source>>) -> SourceSet {
impl<'a> SourceSet<'a> {
pub fn new(sources: Vec<Box<Source+'a>>) -> SourceSet<'a> {
SourceSet { sources: sources }
}
}

impl Registry for SourceSet {
impl<'a> Registry for SourceSet<'a> {
fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>> {
let mut ret = Vec::new();

Expand All @@ -346,7 +346,7 @@ impl Registry for SourceSet {
}
}

impl Source for SourceSet {
impl<'a> Source for SourceSet<'a> {
fn update(&mut self) -> CargoResult<()> {
for source in self.sources.mut_iter() {
try!(source.update());
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn process_executed<'a,
}
}

pub fn shell(verbose: bool) -> MultiShell {
pub fn shell(verbose: bool) -> MultiShell<'static> {
let tty = stderr_raw().isatty();
let stderr = box stderr() as Box<Writer>;

Expand Down
Loading