Skip to content

Commit

Permalink
auto merge of #13532 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Apr 16, 2014
2 parents 74bd233 + c18c928 commit 349d66a
Show file tree
Hide file tree
Showing 45 changed files with 567 additions and 434 deletions.
3 changes: 1 addition & 2 deletions man/rustc.1
Expand Up @@ -182,8 +182,7 @@ rustdoc
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.

.SH "AUTHOR"
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
<\fIgraydon@mozilla.com\fR> is the project leader.
See \fBAUTHORS.txt\fR in the Rust source distribution.

.SH "COPYRIGHT"
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
Expand Down
3 changes: 1 addition & 2 deletions man/rustdoc.1
Expand Up @@ -90,8 +90,7 @@ rustc
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.

.SH "AUTHOR"
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
<\fIgraydon@mozilla.com\fR> is the project leader.
See \fBAUTHORS.txt\fR in the Rust source distribution.

.SH "COPYRIGHT"
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
Expand Down
2 changes: 1 addition & 1 deletion mk/dist.mk
Expand Up @@ -118,7 +118,7 @@ PKG_EXE = dist/$(PKG_NAME)-install.exe
%.ico: $(S)src/etc/pkg/%.ico
cp $< $@

$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
$(PKG_EXE): rust.iss modpath.iss upgrade.iss LICENSE.txt rust-logo.ico \
$(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
dist-prepare-win
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin
Expand Down
6 changes: 0 additions & 6 deletions mk/prepare.mk
Expand Up @@ -20,13 +20,7 @@
# PREPARE_TARGETS - the target triples, space separated
# PREPARE_DEST_DIR - the directory to put the image


# On windows we install from stage3, but on unix only stage2
ifdef CFG_WINDOWSY_$(CFG_BUILD)
PREPARE_STAGE=3
else
PREPARE_STAGE=2
endif

DEFAULT_PREPARE_DIR_CMD = umask 022 && mkdir -p
DEFAULT_PREPARE_BIN_CMD = install -m755
Expand Down
14 changes: 10 additions & 4 deletions src/doc/complement-lang-faq.md
Expand Up @@ -27,7 +27,7 @@ Some examples that demonstrate different aspects of the language:

You may also be interested in browsing [GitHub's Rust][github-rust] page.

[github-rust]: https://github.com/languages/Rust
[github-rust]: https://github.com/trending?l=rust

## Does it run on Windows?

Expand Down Expand Up @@ -141,8 +141,14 @@ export RUST_LOG=hello
./hello
```

**Long answer** RUST_LOG takes a 'logging spec' that consists of a comma-separated list of paths, where a path consists of the crate name and sequence of module names, each separated by double-colons. For standalone .rs files the crate is implicitly named after the source file, so in the above example we were setting RUST_LOG to the name of the hello crate. Multiple paths can be combined to control the exact logging you want to see. For example, when debugging linking in the compiler you might set `RUST_LOG=rustc::metadata::creader,rustc::util::filesearch,rustc::back::rpath`

If you aren't sure which paths you need, try setting RUST_LOG to `::help` and running your program. This will print a list of paths available for logging. For a full description see [the language reference][1].
**Long answer** RUST_LOG takes a 'logging spec' that consists of a
comma-separated list of paths, where a path consists of the crate name and
sequence of module names, each separated by double-colons. For standalone .rs
files the crate is implicitly named after the source file, so in the above
example we were setting RUST_LOG to the name of the hello crate. Multiple paths
can be combined to control the exact logging you want to see. For example, when
debugging linking in the compiler you might set
`RUST_LOG=rustc::metadata::creader,rustc::util::filesearch,rustc::back::rpath`
For a full description see [the language reference][1].

[1]:http://doc.rust-lang.org/doc/master/rust.html#logging-system
4 changes: 0 additions & 4 deletions src/doc/rust.md
Expand Up @@ -4056,10 +4056,6 @@ crate name the crate is given a default name that matches the source file,
with the extension removed. In that case, to turn on logging for a program
compiled from, e.g. `helloworld.rs`, `RUST_LOG` should be set to `helloworld`.

As a convenience, the logging spec can also be set to a special pseudo-crate,
`::help`. In this case, when the application starts, the runtime will
simply output a list of loaded modules containing log expressions, then exit.

#### Logging Expressions

Rust provides several macros to log information. Here's a simple Rust program
Expand Down
2 changes: 1 addition & 1 deletion src/etc/pkg/modpath.iss
Expand Up @@ -164,7 +164,7 @@ begin
end;
procedure CurStepChanged(CurStep: TSetupStep);
procedure ModPathCurStepChanged(CurStep: TSetupStep);
var
taskname: String;
begin
Expand Down
13 changes: 12 additions & 1 deletion src/etc/pkg/rust.iss
Expand Up @@ -49,4 +49,15 @@ begin
setArrayLength(Result, 1)
Result[0] := ExpandConstant('{app}\bin');
end;
#include "modpath.iss"
#include "modpath.iss"
#include "upgrade.iss"
// Both modpath.iss and upgrade.iss want to overload CurStepChanged.
// This version does the overload then delegates to each.
procedure CurStepChanged(CurStep: TSetupStep);
begin
UpgradeCurStepChanged(CurStep);
ModPathCurStepChanged(CurStep);
end;
61 changes: 61 additions & 0 deletions src/etc/pkg/upgrade.iss
@@ -0,0 +1,61 @@
// The following code taken from https://stackoverflow.com/questions/2000296/innosetup-how-to-automatically-uninstall-previous-installed-version
// It performs upgrades by running the uninstaller before the install

/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\Rust_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;


/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;


/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

// default return value
Result := 0;

// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;

/////////////////////////////////////////////////////////////////////
procedure UpgradeCurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;
15 changes: 0 additions & 15 deletions src/libcollections/hashmap.rs
Expand Up @@ -1424,43 +1424,28 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {
}

impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Container for HashSet<T, H> {
/// Return the number of elements in the set
fn len(&self) -> uint { self.map.len() }
}

impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Mutable for HashSet<T, H> {
/// Clear the set, removing all values.
fn clear(&mut self) { self.map.clear() }
}

impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Set<T> for HashSet<T, H> {
/// Return true if the set contains a value
fn contains(&self, value: &T) -> bool { self.map.search(value).is_some() }

/// Return true if the set has no elements in common with `other`.
/// This is equivalent to checking for an empty intersection.
fn is_disjoint(&self, other: &HashSet<T, H>) -> bool {
self.iter().all(|v| !other.contains(v))
}

/// Return true if the set is a subset of another
fn is_subset(&self, other: &HashSet<T, H>) -> bool {
self.iter().all(|v| other.contains(v))
}

/// Return true if the set is a superset of another
fn is_superset(&self, other: &HashSet<T, H>) -> bool {
other.is_subset(self)
}
}

impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> MutableSet<T> for HashSet<T, H> {
/// Add a value to the set. Return true if the value was not already
/// present in the set.
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }

/// Remove a value from the set. Return true if the value was
/// present in the set.
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
}

Expand Down
63 changes: 8 additions & 55 deletions src/libcollections/treemap.rs
Expand Up @@ -64,32 +64,20 @@ fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
impl<K: Ord + TotalOrd, V: Ord> Ord for TreeMap<K, V> {
#[inline]
fn lt(&self, other: &TreeMap<K, V>) -> bool { lt(self, other) }
#[inline]
fn le(&self, other: &TreeMap<K, V>) -> bool { !lt(other, self) }
#[inline]
fn ge(&self, other: &TreeMap<K, V>) -> bool { !lt(self, other) }
#[inline]
fn gt(&self, other: &TreeMap<K, V>) -> bool { lt(other, self) }
}

impl<K: TotalOrd, V> Container for TreeMap<K, V> {
/// Return the number of elements in the map
fn len(&self) -> uint { self.length }

/// Return true if the map contains no elements
fn is_empty(&self) -> bool { self.root.is_none() }
}

impl<K: TotalOrd, V> Mutable for TreeMap<K, V> {
/// Clear the map, removing all key-value pairs.
fn clear(&mut self) {
self.root = None;
self.length = 0
}
}

impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
/// Return a reference to the value corresponding to the key
fn find<'a>(&'a self, key: &K) -> Option<&'a V> {
let mut current: &'a Option<~TreeNode<K, V>> = &self.root;
loop {
Expand All @@ -108,22 +96,17 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
}

impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> {
/// Return a mutable reference to the value corresponding to the key
#[inline]
fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> {
find_mut(&mut self.root, key)
}

/// Insert a key-value pair from the map. If the key already had a value
/// present in the map, that value is returned. Otherwise None is returned.
fn swap(&mut self, key: K, value: V) -> Option<V> {
let ret = insert(&mut self.root, key, value);
if ret.is_none() { self.length += 1 }
ret
}

/// Removes a key from the map, returning the value at the key if the key
/// was previously in the map.
fn pop(&mut self, key: &K) -> Option<V> {
let ret = remove(&mut self.root, key);
if ret.is_some() { self.length -= 1 }
Expand Down Expand Up @@ -531,15 +514,13 @@ impl<K, V> Iterator<(K, V)> for MoveEntries<K,V> {
}

impl<'a, T> Iterator<&'a T> for SetItems<'a, T> {
/// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
#[inline]
fn next(&mut self) -> Option<&'a T> {
self.iter.next().map(|(value, _)| value)
}
}

impl<'a, T> Iterator<&'a T> for RevSetItems<'a, T> {
/// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
#[inline]
fn next(&mut self) -> Option<&'a T> {
self.iter.next().map(|(value, _)| value)
Expand All @@ -557,90 +538,62 @@ pub struct TreeSet<T> {
impl<T: Eq + TotalOrd> Eq for TreeSet<T> {
#[inline]
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
#[inline]
fn ne(&self, other: &TreeSet<T>) -> bool { self.map != other.map }
}

impl<T: Ord + TotalOrd> Ord for TreeSet<T> {
#[inline]
fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map }
#[inline]
fn le(&self, other: &TreeSet<T>) -> bool { self.map <= other.map }
#[inline]
fn ge(&self, other: &TreeSet<T>) -> bool { self.map >= other.map }
#[inline]
fn gt(&self, other: &TreeSet<T>) -> bool { self.map > other.map }
}

impl<T: TotalOrd> Container for TreeSet<T> {
/// Return the number of elements in the set
#[inline]
fn len(&self) -> uint { self.map.len() }

/// Return true if the set contains no elements
#[inline]
fn is_empty(&self) -> bool { self.map.is_empty() }
}

impl<T: TotalOrd> Mutable for TreeSet<T> {
/// Clear the set, removing all values.
#[inline]
fn clear(&mut self) { self.map.clear() }
}

impl<T: TotalOrd> Set<T> for TreeSet<T> {
/// Return true if the set contains a value
#[inline]
fn contains(&self, value: &T) -> bool {
self.map.contains_key(value)
}

/// Return true if the set has no elements in common with `other`.
/// This is equivalent to checking for an empty intersection.
fn is_disjoint(&self, other: &TreeSet<T>) -> bool {
self.intersection(other).next().is_none()
}

/// Return true if the set is a subset of another
#[inline]
fn is_subset(&self, other: &TreeSet<T>) -> bool {
other.is_superset(self)
}

/// Return true if the set is a superset of another
fn is_superset(&self, other: &TreeSet<T>) -> bool {
let mut x = self.iter();
let mut y = other.iter();
let mut a = x.next();
let mut b = y.next();
while b.is_some() {
if a.is_none() {
return false
while a.is_some() {
if b.is_none() {
return false;
}

let a1 = a.unwrap();
let b1 = b.unwrap();

match a1.cmp(b1) {
Less => (),
Greater => return false,
Equal => b = y.next(),
match b1.cmp(a1) {
Less => (),
Greater => return false,
Equal => a = x.next(),
}

a = x.next();
b = y.next();
}
true
}
}

impl<T: TotalOrd> MutableSet<T> for TreeSet<T> {
/// Add a value to the set. Return true if the value was not already
/// present in the set.
#[inline]
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }

/// Remove a value from the set. Return true if the value was
/// present in the set.
#[inline]
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
}
Expand Down

0 comments on commit 349d66a

Please sign in to comment.