Commit Graph

30605 Commits

Author SHA1 Message Date
John Clements
ff9995e089 added test cases for closure arg hygiene 2014-07-04 13:20:14 -07:00
John Clements
63fb7c6f40 comments only 2014-07-04 13:20:14 -07:00
John Clements
3e99309bfc make any_pat! and u64_from_be_bytes_bench_impl! macros hygienic 2014-07-04 13:20:14 -07:00
John Clements
0ba15c99f3 hygiene for item fn args
also, introduce fn_decl_arg_bindings and expand_and_rename abstractions
2014-07-04 13:20:14 -07:00
John Clements
92708322fd comments & test cases for IdentRenamers 2014-07-04 13:20:14 -07:00
John Clements
6bee3c87c9 use PatIdentRenamer for match bindings 2014-07-04 13:20:13 -07:00
John Clements
35175f015f comments only 2014-07-04 13:20:13 -07:00
John Clements
aa91ef0cf8 new_mark -> apply_mark, new_rename -> apply_rename 2014-07-04 13:20:06 -07:00
John Clements
b8cd7f7c6d add PatIdentRenamer 2014-07-04 12:08:04 -07:00
John Clements
9fdaa948c0 move RenameList to mtwt, add new_renames abstraction 2014-07-04 12:07:51 -07:00
John Clements
f126eacd11 comments, whitespace, rename NameFinderContext to PatIdentFinder 2014-07-04 12:05:43 -07:00
bors
935da0739e auto merge of #15405 : pcwalton/rust/delifetime, r=nick29581
This was parsed by the parser but completely ignored; not even stored in
the AST!

This breaks code that looks like:

    static X: &'static [u8] = &'static [1, 2, 3];

Change this code to the shorter:

    static X: &'static [u8] = &[1, 2, 3];

Closes #15312.

[breaking-change]

r? @nick29581
2014-07-04 19:01:33 +00:00
Anton Lofgren
e737440bc6 doc/guide-ffi: A few minor typo/language fixes
Signed-off-by: Anton Lofgren <alofgren@op5.com>
2014-07-04 20:09:28 +02:00
Erick Tryzelaar
83f9f07ec4 serialize: Remove allocations from escaping strs and indenting spaces 2014-07-04 11:08:38 -07:00
bors
25e8b6ed9c auto merge of #15404 : vhbit/rust/ios-ptr-fixes, r=pcwalton 2014-07-04 17:16:29 +00:00
bors
c9e2ca0dfa auto merge of #15051 : retep998/rust/master, r=alexcrichton
This implementation does have the minor issue of not handling things correctly when a codepoint is split across multiple writes or reads, but its better than not having unicode support at all.

Adds a Windows specific struct `WindowsTTY` in `libnative` and make `tty_open` create that struct on Windows. Adds needed functions and constants to `c_win32.rs`.

Libuv still needs to be updated before #15028 can be closed.
2014-07-04 15:31:27 +00:00
Peter Atashian
a34fd5a1bb windows: Unicode console support.
Adds a WindowsTTY for libnative that converts between UTF-8 and UTF-16.

Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-07-04 10:45:28 -04:00
dgoon
4c9cca41a8 add a missing closing parens 2014-07-04 23:43:16 +09:00
bors
04ac2b087e auto merge of #15403 : vhbit/rust/ios-llvm-fixme, r=pcwalton
It was required to get iOS compilable but since
that time a couple of changes were introduced
which cause the same bug to re-appear and broke 
build anyway. Fixing all of them doesn’t look a 
viable alternative to me as it will pollute the 
code too much.

So it should be fixed from LLVM side and I hope 
LLVM will upstream corresponding changes in a 
month.

Meanwhile, who wants to play with Rust on iOS is 
better to use a fork which uses patched LLVM:
https://github.com/vhbit/rust/tree/ios . It may 
lag behind master a bit, but it is Travis-checked 
to compile successfully.
2014-07-04 13:46:25 +00:00
Zbigniew Siciarz
a4b1361a01 Fixed Result type parameters in doc comment. 2014-07-04 15:23:17 +02:00
Björn Steinbrink
db44468de0 trans::foreign: Simplify some code by using our builder impl 2014-07-04 14:50:36 +02:00
bors
c0b76abf91 auto merge of #15388 : jakub-/rust/issue-12285, r=pcwalton
Unit-like struct patterns are irrefutable, no need for a branch.

And some cleanup while I'm at it.
2014-07-04 12:01:22 +00:00
bors
36d7d746c8 auto merge of #15387 : huonw/rust/toc-space, r=alexcrichton
A margin for the top level list was leaking into nested ones.

before; after:

![screenshot from 2014-07-04 08 18 32](https://cloud.githubusercontent.com/assets/1203825/3476459/0b7f8ea8-0300-11e4-8b67-0c47b7931d56.png)
2014-07-04 10:16:21 +00:00
Luqman Aden
e646188f66 librustc: Remove match arm since we don't allow enum to float casts. 2014-07-04 01:33:45 -07:00
Luqman Aden
7cce75f839 librustc: Apply null pointer optimization to slices, closures and trait
objects.
2014-07-04 01:33:33 -07:00
bors
5012b858ed auto merge of #15378 : mdinger/rust/Issue_15333, r=alexcrichton
Here's the issue: https://github.com/rust-lang/rust/issues/15333

Tested it. It works. FYI, in case anyone doesn't know: keyboard shortcut `'` restricts text search to only links on Firefox allowing this to be checked easily.
2014-07-04 08:31:20 +00:00
Patrick Walton
29ec2506ab librustc: Remove the &LIFETIME EXPR production from the language.
This was parsed by the parser but completely ignored; not even stored in
the AST!

This breaks code that looks like:

    static X: &'static [u8] = &'static [1, 2, 3];

Change this code to the shorter:

    static X: &'static [u8] = &[1, 2, 3];

Closes #15312.

[breaking-change]
2014-07-04 00:56:57 -07:00
Valerii Hiora
b86440f85f Removed LLVM bug workaround
It was required to get iOS compilable but since
that time a couple of changes were introduced
which cause the same bug to re-appear and broke 
build anyway. Fixing all of them doesn’t look a 
viable alternative to me as it will pollute the 
code too much.

So it should be fixed from LLVM side and I hope 
LLVM will upstream corresponding changes in a 
month.

Meanwhile, who wants to play with Rust on iOS is 
better to use a fork which uses patched LLVM:
https://github.com/vhbit/rust/tree/ios . It may 
lag behind master a bit, but it is Travis-checked 
to compile successfully.
2014-07-04 10:40:21 +03:00
Valerii Hiora
2bd826cac2 Fixed iOS build after *T removal 2014-07-04 10:29:55 +03:00
bors
9766b493fc auto merge of #15369 : omasanori/rust/asctime, r=alexcrichton
In C, `ctime(t)` is equivalent to `asctime(localtime(t))`, so the result should depend on the local timezone. Current `ctime` is compatible with `asctime` in C, not `ctime`.

This commit renames `ctime` to `asctime` and adds `ctime` which converts the time to the local timezone before formatting it.

This commit also fixes the documentation of them. Current documentation of `ctime` says it returns "a string of the current time." However, it actually returns a string of the time represented as `self`, not the time when it is called.
2014-07-04 06:41:17 +00:00
bors
1bff1ff810 auto merge of #15356 : pcwalton/rust/wrong-implementor, r=alexcrichton
parameters.

This can break code that mistakenly used type parameters in place of
`Self`. For example, this will break:

    trait Foo {
        fn bar<X>(u: X) -> Self {
            u
        }
    }

Change this code to not contain a type error. For example:

    trait Foo {
        fn bar<X>(_: X) -> Self {
            self
        }
    }

Closes #15172.

[breaking-change]

r? @alexcrichton
2014-07-04 04:56:16 +00:00
bors
d623a8bf3c auto merge of #15321 : huonw/rust/nil-prim, r=alexcrichton
This adds a primitive page for () like http://doc.rust-lang.org/master/std/uint/primitive.uint.html .

I would prefer the modules to be `std::tuple::unit`, but rustdoc only searches at the top level (filed as #15320).
2014-07-04 03:06:19 +00:00
bors
5b11610ced auto merge of #15343 : alexcrichton/rust/0.11.0-release, r=brson 2014-07-04 01:21:19 +00:00
Huon Wilson
7c92735f08 core: add a primitive page for (). 2014-07-04 11:20:54 +10:00
Kevin Butler
4703bb4eaa liburl: Generic input for {en,de}code. 2014-07-04 01:34:49 +01:00
Kevin Butler
465ec23918 liburl: cosmetic test changes. 2014-07-04 01:34:42 +01:00
Kevin Butler
feaad623a1 liburl: Remove some unnecessary allocations.
Some signatures have changed from String to &str returns.

To fix, call to_string() on the returned value.

[breaking-change]
2014-07-04 01:33:41 +01:00
John Clements
4358bf8bfa simplify and uncomment item-fn-arg hygiene unit test 2014-07-03 17:32:35 -07:00
Kevin Butler
11b093425d liburl: Simplify encoding/decoding using iterators. 2014-07-04 01:30:45 +01:00
Kevin Butler
ed47c479d7 liburl: remove redundant fields in Url.
url.path - Now a Path instead of a String.

To fix old code:
url.path => url.path.path
url.query => url.path.query
url.fragment => url.path.fragment

Not much point having the Path struct if it's not going to be used.

[breaking-change]
2014-07-04 01:28:20 +01:00
Kevin Butler
a9e82e145e liburl: rename and move path_from_str to Path::parse_str.
url::path_from_str => url::Path::parse_str

The FromStr trait still works, but its confusing to have a path_from_str
free function that retuns a Result, while the regular from_str style
functions return an Option, hence the rename to indicate a Result.

[breaking-change]
2014-07-04 01:26:48 +01:00
Kevin Butler
2194fd7569 liburl: rename and move from_str to Url::parse_str.
url::from_str => url::Url::parse_str

The FromStr trait still works, but its confusing to have a from_str
free function that retuns a Result, while the regular from_str
returns an Option, hence the rename.

[breaking-change]
2014-07-04 01:22:32 +01:00
Jakub Wieczorek
c2c27faa35 Fix #12285
Unit-like struct patterns are irrefutable, no need for a branch.
2014-07-04 00:29:47 +02:00
Huon Wilson
fb258f22de doc: reduce spacing of table of contents.
A margin for the top level list was leaking into nested ones.
2014-07-04 08:17:20 +10:00
bors
5d5c20647f auto merge of #15377 : alexcrichton/rust/rollup, r=alexcrichton
Closes #15276 (Guide: if)
Closes #15280 (std::os - Add join_paths, make setenv non-utf8 capable)
Closes #15314 (Guide: functions)
Closes #15327 (Simplify PatIdent to contain an Ident rather than a Path)
Closes #15340 (Guide: add mutable binding section)
Closes #15342 (Fix ICE with nested macro_rules!-style macros)
Closes #15350 (Remove duplicated slash in install script path)
Closes #15351 (correct a few spelling mistakes in the tutorial)
Closes #15352 (librustc: Have the kind checker check sub-bounds in trait casts.)
Closes #15359 (Fix spelling errors.)
Closes #15361 (Rename set_broadast() to set_broadcast().)
Closes #15366 (Simplify creating a parser from a token tree)
Closes #15367 (Add examples for StrVector methods)
Closes #15372 (Vec::grow should use reserve_additional, Vec::reserve should check against capacity)
Closes #15373 (Fix minor issues in the documentation of libtime.)
2014-07-03 21:46:47 +00:00
bors
dd812ccbb5 auto merge of #15076 : luqmana/rust/naim, r=pcwalton
```Rust
struct With {
    x: int,
    f: NoCopy
}

#[no_mangle]
fn bar() {
    let mine = With { x: 3, f: NoCopy };
    match mine {
        c => {
            foo(c);
        }
    }
}

#[no_mangle]
fn foo(_: With) {}
```

Before:
```LLVM
define internal void @bar() unnamed_addr #1 {
entry-block:
  %mine = alloca %"struct.With<[]>"
  %__llmatch = alloca %"struct.With<[]>"*
  %c = alloca %"struct.With<[]>"
  %0 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 0
  store i64 3, i64* %0
  %1 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 1
  store %"struct.With<[]>"* %mine, %"struct.With<[]>"** %__llmatch
  br label %case_body

case_body:                                        ; preds = %entry-block
  %2 = load %"struct.With<[]>"** %__llmatch
  %3 = bitcast %"struct.With<[]>"* %2 to i8*
  %4 = bitcast %"struct.With<[]>"* %c to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 8, i32 8, i1 false)
  %5 = load %"struct.With<[]>"* %c
  call void @foo(%"struct.With<[]>" %5)
  br label %join

join:                                             ; preds = %case_body
  ret void
}
```

After:
```LLVM
define internal void @bar() unnamed_addr #1 {
entry-block:
  %mine = alloca %"struct.With<[]>"
  %c = alloca %"struct.With<[]>"*
  %0 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 0
  store i64 3, i64* %0
  %1 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 1
  store %"struct.With<[]>"* %mine, %"struct.With<[]>"** %c
  br label %case_body

case_body:                                        ; preds = %entry-block
  %2 = load %"struct.With<[]>"** %c
  %3 = load %"struct.With<[]>"* %2
  call void @foo(%"struct.With<[]>" %3)
  br label %join

join:                                             ; preds = %case_body
  ret void
}
```

r? @pcwalton
2014-07-03 19:56:47 +00:00
Alex Crichton
9bd6479912 Test fixes from the rollup 2014-07-03 12:54:52 -07:00
OGINO Masanori
0c5b627232 Fix minor issues in the documentation of libtime.
- When the timezone is UTC, the "zone" field of the RFC 822 format is
  "GMT" (or "UT"), not "UTC."

- Although the name of `rfc3999` refers to RFC 3999, the documentation
  of it refers only to ISO 8601. This commit adds a description of the
  relation between ISO 8601 and RFC 3999.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-03 12:54:52 -07:00
Erick Tryzelaar
451b7495b0 collections: Fix conditional when reserving extra vec space 2014-07-03 12:54:52 -07:00
Erick Tryzelaar
e7adb8434a collections: grow should use the overflow-checked reserve_additional 2014-07-03 12:54:52 -07:00