Skip to content

Commit 96b6868

Browse files
committed
---
yaml --- r: 92083 b: refs/heads/auto c: 9635c76 h: refs/heads/master i: 92081: 1076a5e 92079: c7a32fd v: v3
1 parent 3f6f03d commit 96b6868

File tree

5 files changed

+65
-8
lines changed

5 files changed

+65
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: a243360401790476deea3d502f644783ed8d7563
16+
refs/heads/auto: 9635c763ba5edc8c8ea2868b895548b52f640e5a
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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/auto/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,
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+
}

0 commit comments

Comments
 (0)