Skip to content

Commit e281519

Browse files
committed
---
yaml --- r: 94063 b: refs/heads/try c: 1191ae8 h: refs/heads/master i: 94061: d99e077 94059: a3c946f 94055: df9d00c 94047: f0903aa v: v3
1 parent 622b3ba commit e281519

File tree

18 files changed

+84
-37
lines changed

18 files changed

+84
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: c9eed5742e15e8c6ee24376970623a246477b8f0
5+
refs/heads/try: 1191ae87dbf301a26379ca1b9797c352ab082b85
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/url.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,51 @@ use std::hashmap::HashMap;
1919
use std::to_bytes;
2020
use std::uint;
2121

22+
/// A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource
23+
/// Identifier) that includes network location information, such as hostname or
24+
/// port number.
25+
///
26+
/// # Example
27+
///
28+
/// ```rust
29+
/// let url = Url { scheme: ~"https",
30+
/// user: Some(UserInfo { user: ~"username", pass: None }),
31+
/// host: ~"example.com",
32+
/// port: Some(~"8080"),
33+
/// path: ~"/foo/bar",
34+
/// query: ~[(~"baz", ~"qux")],
35+
/// fragment: Some(~"quz") };
36+
/// // https://[email protected]:8080/foo/bar?baz=qux#quz
37+
/// ```
2238
#[deriving(Clone, Eq)]
2339
pub struct Url {
40+
/// The scheme part of a URL, such as `https` in the above example.
2441
scheme: ~str,
42+
/// A URL subcomponent for user authentication. `username` in the above example.
2543
user: Option<UserInfo>,
44+
/// A domain name or IP address. For example, `example.com`.
2645
host: ~str,
46+
/// A TCP port number, for example `8080`.
2747
port: Option<~str>,
48+
/// The path component of a URL, for example `/foo/bar`.
2849
path: ~str,
50+
/// The query component of a URL. `~[(~"baz", ~"qux")]` represents the
51+
/// fragment `baz=qux` in the above example.
2952
query: Query,
53+
/// The fragment component, such as `quz`. Doesn't include the leading `#` character.
3054
fragment: Option<~str>
3155
}
3256

57+
/// An optional subcomponent of a URI authority component.
3358
#[deriving(Clone, Eq)]
3459
pub struct UserInfo {
60+
/// The user name.
3561
user: ~str,
62+
/// Password or other scheme-specific authentication information.
3663
pass: Option<~str>
3764
}
3865

66+
/// Represents the query component of a URI.
3967
pub type Query = ~[(~str, ~str)];
4068

4169
impl Url {

branches/try/src/librustc/back/archive.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,25 @@ impl Archive {
119119
}
120120

121121
fn find_library(&self, name: &str) -> Path {
122-
let (prefix, ext) = match self.sess.targ_cfg.os {
122+
let (osprefix, osext) = match self.sess.targ_cfg.os {
123123
abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
124124
};
125-
let libname = format!("{}{}.{}", prefix, name, ext);
125+
// On windows, static libraries sometimes show up as libfoo.a and other
126+
// times show up as foo.lib
127+
let oslibname = format!("{}{}.{}", osprefix, name, osext);
128+
let unixlibname = format!("lib{}.a", name);
126129

127130
let mut rustpath = filesearch::rust_path();
128131
rustpath.push(self.sess.filesearch.get_target_lib_path());
129132
let path = self.sess.opts.addl_lib_search_paths.iter();
130133
for path in path.chain(rustpath.iter()) {
131134
debug!("looking for {} inside {}", name, path.display());
132-
let test = path.join(libname.clone());
135+
let test = path.join(oslibname.as_slice());
133136
if test.exists() { return test }
137+
if oslibname != unixlibname {
138+
let test = path.join(unixlibname.as_slice());
139+
if test.exists() { return test }
140+
}
134141
}
135142
self.sess.fatal(format!("could not find native static library `{}`, \
136143
perhaps an -L flag is missing?", name));

branches/try/src/librustc/middle/typeck/check/_match.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,24 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
294294
etc: bool) {
295295
let tcx = pcx.fcx.ccx.tcx;
296296
297-
// Index the class fields.
297+
// Index the class fields. The second argument in the tuple is whether the
298+
// field has been bound yet or not.
298299
let mut field_map = HashMap::new();
299300
for (i, class_field) in class_fields.iter().enumerate() {
300-
field_map.insert(class_field.name, i);
301+
field_map.insert(class_field.name, (i, false));
301302
}
302303
303304
// Typecheck each field.
304305
let mut found_fields = HashSet::new();
305306
for field in fields.iter() {
306-
match field_map.find(&field.ident.name) {
307-
Some(&index) => {
307+
match field_map.find_mut(&field.ident.name) {
308+
Some(&(_, true)) => {
309+
tcx.sess.span_err(span,
310+
format!("field `{}` bound twice in pattern",
311+
tcx.sess.str_of(field.ident)));
312+
}
313+
Some(&(index, ref mut used)) => {
314+
*used = true;
308315
let class_field = class_fields[index];
309316
let field_type = ty::lookup_field_type(tcx,
310317
class_id,

branches/try/src/librustuv/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ impl RtioTimer for TimerWatcher {
7777
let _missile = match util::replace(&mut self.action, None) {
7878
None => missile, // no need to do a homing dance
7979
Some(action) => {
80-
util::ignore(missile); // un-home ourself
81-
util::ignore(action); // destroy the previous action
80+
drop(missile); // un-home ourself
81+
drop(action); // destroy the previous action
8282
self.fire_homing_missile() // re-home ourself
8383
}
8484
};

branches/try/src/librustuv/uvio.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use std::libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY,
2626
use std::io::{FileMode, FileAccess, Open, Append, Truncate, Read, Write,
2727
ReadWrite, FileStat};
2828
use std::io::signal::Signum;
29-
use std::util;
3029
use ai = std::io::net::addrinfo;
3130

3231
#[cfg(test)] use std::unstable::run_in_bare_thread;
@@ -104,7 +103,7 @@ impl HomingMissile {
104103

105104
impl Drop for HomingMissile {
106105
fn drop(&mut self) {
107-
let f = ForbidUnwind::new("leaving home");
106+
let _f = ForbidUnwind::new("leaving home");
108107

109108
// It would truly be a sad day if we had moved off the home I/O
110109
// scheduler while we were doing I/O.
@@ -120,8 +119,6 @@ impl Drop for HomingMissile {
120119
});
121120
})
122121
}
123-
124-
util::ignore(f);
125122
}
126123
}
127124

branches/try/src/libstd/io/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ mod test {
11791179
file.write(bytes!("foo"));
11801180
file.fsync();
11811181
file.datasync();
1182-
util::ignore(file);
1182+
drop(file);
11831183
})
11841184

11851185
test!(fn truncate_works() {
@@ -1210,7 +1210,7 @@ mod test {
12101210
assert_eq!(stat(&path).size, 9);
12111211
assert_eq!(File::open(&path).read_to_end(),
12121212
(bytes!("fo", 0, 0, 0, 0, "wut")).to_owned());
1213-
util::ignore(file);
1213+
drop(file);
12141214
})
12151215

12161216
test!(fn open_flavors() {

branches/try/src/libstd/prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@ pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector};
8686
// Reexported runtime types
8787
pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};
8888
pub use task::spawn;
89+
90+
/// Disposes of a value.
91+
#[inline]
92+
pub fn drop<T>(_x: T) { }

branches/try/src/libstd/rt/sched.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,6 @@ mod test {
11731173
use rt::sleeper_list::SleeperList;
11741174
use rt::stack::StackPool;
11751175
use rt::sched::{Shutdown, TaskFromFriend};
1176-
use util;
11771176

11781177
do run_in_bare_thread {
11791178
stress_factor().times(|| {
@@ -1205,7 +1204,7 @@ mod test {
12051204
handle.send(TaskFromFriend(task));
12061205

12071206
handle.send(Shutdown);
1208-
util::ignore(handle);
1207+
drop(handle);
12091208

12101209
thread.join();
12111210
})

branches/try/src/libstd/unstable/sync.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ mod tests {
467467
use prelude::*;
468468
use super::{Exclusive, UnsafeArc, atomically};
469469
use task;
470-
use util;
471470
use mem::size_of;
472471

473472
//#[unsafe_no_drop_flag] FIXME: #9758
@@ -571,7 +570,7 @@ mod tests {
571570
let x2 = x.clone();
572571
let left_x = x.try_unwrap();
573572
assert!(left_x.is_self());
574-
util::ignore(left_x);
573+
drop(left_x);
575574
assert!(x2.try_unwrap().expect_t("try_unwrap none") == ~~"hello");
576575
}
577576
@@ -590,7 +589,7 @@ mod tests {
590589
task::deschedule(); // Try to make the unwrapper get blocked first.
591590
let left_x = x.try_unwrap();
592591
assert!(left_x.is_self());
593-
util::ignore(left_x);
592+
drop(left_x);
594593
p.recv();
595594
}
596595
@@ -620,7 +619,7 @@ mod tests {
620619
assert!(x2.unwrap() == ~~"hello");
621620
}
622621
// Have to get rid of our reference before blocking.
623-
util::ignore(x);
622+
drop(x);
624623
res.recv();
625624
}
626625

branches/try/src/libstd/util.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ use unstable::intrinsics;
1919
#[inline]
2020
pub fn id<T>(x: T) -> T { x }
2121

22-
/// Ignores a value.
23-
#[inline]
24-
pub fn ignore<T>(_x: T) { }
25-
2622
/**
2723
* Swap the values at two mutable locations of the same type, without
2824
* deinitialising or copying either one.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct A { foo: int }
12+
13+
fn main() {
14+
let A { foo, foo } = A { foo: 3 }; //~ ERROR: field `foo` bound twice
15+
}

branches/try/src/test/compile-fail/lint-unused-imports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ mod bar {
6363
fn main() {
6464
cal(foo::Point{x:3, y:9});
6565
let a = 3;
66-
ignore(a);
66+
id(a);
6767
test::C.b();
6868
let _a = from_elem(0, 0);
6969
}

branches/try/src/test/compile-fail/once-cant-call-twice-on-heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#[feature(once_fns)];
1515
extern mod extra;
1616
use extra::arc;
17-
use std::util;
1817

1918
fn foo(blk: proc()) {
2019
blk();
@@ -25,6 +24,6 @@ fn main() {
2524
let x = arc::Arc::new(true);
2625
do foo {
2726
assert!(*x.get());
28-
util::ignore(x);
27+
drop(x);
2928
}
3029
}

branches/try/src/test/compile-fail/once-cant-call-twice-on-stack.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#[feature(once_fns)];
1515
extern mod extra;
1616
use extra::arc;
17-
use std::util;
1817

1918
fn foo(blk: once ||) {
2019
blk();
@@ -25,6 +24,6 @@ fn main() {
2524
let x = arc::Arc::new(true);
2625
foo(|| {
2726
assert!(*x.get());
28-
util::ignore(x);
27+
drop(x);
2928
})
3029
}

branches/try/src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
extern mod extra;
1515
use extra::arc;
16-
use std::util;
1716

1817
fn foo(blk: ||) {
1918
blk();
@@ -24,6 +23,6 @@ fn main() {
2423
let x = arc::Arc::new(true);
2524
foo(|| {
2625
assert!(*x.get());
27-
util::ignore(x); //~ ERROR cannot move out of captured outer variable
26+
drop(x); //~ ERROR cannot move out of captured outer variable
2827
})
2928
}

branches/try/src/test/run-pass/once-move-out-on-heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#[feature(once_fns)];
1616
extern mod extra;
1717
use extra::arc;
18-
use std::util;
1918

2019
fn foo(blk: proc()) {
2120
blk();
@@ -25,6 +24,6 @@ fn main() {
2524
let x = arc::Arc::new(true);
2625
do foo {
2726
assert!(*x.get());
28-
util::ignore(x);
27+
drop(x);
2928
}
3029
}

branches/try/src/test/run-pass/once-move-out-on-stack.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#[feature(once_fns)];
1616
extern mod extra;
1717
use extra::arc;
18-
use std::util;
1918

2019
fn foo(blk: once ||) {
2120
blk();
@@ -25,6 +24,6 @@ fn main() {
2524
let x = arc::Arc::new(true);
2625
foo(|| {
2726
assert!(*x.get());
28-
util::ignore(x);
27+
drop(x);
2928
})
3029
}

0 commit comments

Comments
 (0)