Commit Graph

44334 Commits

Author SHA1 Message Date
Simon Sapin
3226858e50 Fix tests for changes in #26241. 2015-07-13 23:28:58 +02:00
Simon Sapin
eb99f0e420 Mark some new things as unstable. 2015-07-13 16:21:43 +02:00
Simon Sapin
7469914e96 Add str::split_at_mut 2015-07-13 16:21:43 +02:00
Simon Sapin
f9005512a9 Implement IndexMut for String and str.
... matching the existing Index impls.
There is no reason not to if String implement DerefMut.

The code removed in `src/librustc/middle/effect.rs` was added in #9750
to prevent things like `s[0] = 0x80` where `s: String`,
but I belive became unnecessary when the Index(Mut) traits were introduced.
2015-07-13 16:21:43 +02:00
Simon Sapin
90d61d828f Add more tests for AsciiExt::is_ascii 2015-07-13 16:21:43 +02:00
Simon Sapin
304f545274 Add tests for AsciiExt::make_ascii_*case, including on String. 2015-07-13 16:21:43 +02:00
Simon Sapin
2d34a531f4 Implement DerefMut for String
`&mut str` is rarely useful, but it is for e.g.
`AsciiExt::make_ascii_lowercase`.
2015-07-13 16:21:43 +02:00
bors
50d305e498 Auto merge of #26966 - nagisa:tail-init, r=alexcrichton
Fixes #26906
2015-07-12 13:16:24 +00:00
bors
2999003be8 Auto merge of #26965 - bluss:cstring-debug, r=alexcrichton
Use escaped byte string representation for CString Debug

Faithfully represent the contents of the CString and CStr in their Debug
impl, by treating them as byte strings with our default escaping to
ascii representation.

Add impl Debug for CStr.

Fixes #26964.
2015-07-12 11:45:23 +00:00
bors
aff208033b Auto merge of #26985 - Manishearth:rollup, r=Manishearth
- Successful merges: #26881, #26967, #26973, #26974, #26976, #26979
- Failed merges:
2015-07-12 09:50:13 +00:00
Manish Goregaokar
aad7cb8339 Rollup merge of #26979 - tshepang:trim, r=Gankro
- It is clear that what follows are re-exports
- There aren't so many re-exports that examples should be given
2015-07-12 18:35:55 +05:30
Manish Goregaokar
afe16ae7ff Rollup merge of #26976 - tshepang:more-simple-explanation, r=gankro
That sentence make me read it a few times before properly understanding it
2015-07-12 18:35:55 +05:30
Manish Goregaokar
dcc64d113c Rollup merge of #26974 - tshepang:trailing-comma, r=Gankro 2015-07-12 18:35:55 +05:30
Manish Goregaokar
bcc0b8cec7 Rollup merge of #26973 - tshepang:repetition, r=Gankro 2015-07-12 18:35:54 +05:30
Manish Goregaokar
1cf7b1e938 Rollup merge of #26967 - tsurai:master, r=steveklabnik
The very first code fragment off every struct and trait documentation page generates wrong playground code. This pull request adjusts ```playpen.js``` to only create a link for real examples.

Documentation:
```rust
pub struct String {
    // some fields omitted
}
```

Playground:
```rust
Struct std::String
            
                [−]
            
        [src]
```

r? @steveklabnik
2015-07-12 18:35:54 +05:30
Manish Goregaokar
ad930f4145 Rollup merge of #26881 - andreastt:international_keyboard, r=alexcrichton
Avoids some code duplication and relies less on deprecated properties on `KeyboardEvent`.  The code is still looking quite bad, but that’s primarily because interop in this area is a disaster zone.
2015-07-12 18:35:54 +05:30
bors
88c1105fc7 Auto merge of #26931 - reem:string-conversions, r=alexcrichton
Implements merged RFC 1152.

Closes #26697.
2015-07-12 07:32:54 +00:00
bors
78547d2b95 Auto merge of #26972 - jethrogb:patch-1, r=alexcrichton
The File object needs to be writable for the set_len to succeed.
2015-07-12 06:02:17 +00:00
Jonathan Reem
69521affbb Add String::into_boxed_slice and Box<str>::into_string
Implements merged RFC 1152.

Closes #26697.
2015-07-11 21:31:56 -07:00
bors
da1b296e16 Auto merge of #26959 - dhuseby:i686-unknown-freebsd, r=alexcrichton
this adds support for i686-unknown-freebsd target.
2015-07-12 02:37:31 +00:00
bors
0c052199b9 Auto merge of #26913 - sfackler:tuple-debug, r=alexcrichton
This does change the Debug output for 1-tuples to `(foo)` instead of `(foo,)` but I don't think it's that big  of a deal.

r? @alexcrichton
2015-07-11 23:41:07 +00:00
Tshepang Lekhonkhobe
a458d46ea5 doc: remove redundant info
- It is clear that what follows are re-exports
- There aren't so many re-exports that examples should be given
2015-07-12 00:51:07 +02:00
bors
b8bb908d88 Auto merge of #26882 - andreastt:style_improvements, r=alexcrichton
Sharpens the help dialogues edges by removing border-padding, which
matches better with the rest of the document.

Also increases somewhat the rounded edges of the key symbols to
make it clear they are symbols.

Also introduces closing apostrophes and ellipsis for search field
placeholder.
2015-07-11 21:48:44 +00:00
Simonas Kazlauskas
7a90865db5 Implement RFC 1058 2015-07-12 00:47:56 +03:00
jethrogb
9262d647bb Change std::fs::File.set_len example and documentation
The File object needs to be writable for the truncate to succeed.
2015-07-11 14:17:45 -07:00
Tshepang Lekhonkhobe
ef8c3775af doc: make explanation easier to undrstand 2015-07-11 23:03:22 +02:00
Ulrik Sverdrup
92c8a9439b Use escaped byte string representation for CString Debug
Faithfully represent the contents of the CString and CStr in their Debug
impl, by treating them as byte strings with our default escaping to
ascii representation.

Add impl Debug for Cstr.

Fixes #26964.
2015-07-11 22:55:52 +02:00
bors
d18eb74009 Auto merge of #26878 - Esption:master, r=pnkfelix
I noticed in docs, specifically http://doc.rust-lang.org/std/primitive.u8.html#method.is_power_of_two, that it was like this, and it was apparently in multiple places too.

Didn't change any occurrences through the cross-depo things. There's a lot in /src/llvm/ for instance, but I'm not confident on how to go about sending fixes for those, so this is just what's in the base rust depo.

r? @steveklabnik
2015-07-11 19:18:02 +00:00
Tshepang Lekhonkhobe
de7d1c08d3 remove repetition from E0308 explanation 2015-07-11 20:21:10 +02:00
Dave Huseby
c415683402 fixing trailing whitespace 2015-07-11 07:18:12 -07:00
Cristian Kubis
9e9698213c doc: remove playground links for structs and traits 2015-07-11 13:48:10 +02:00
bors
1b28ffa521 Auto merge of #26961 - Manishearth:rollup, r=Manishearth
- Successful merges: #26932, #26936, #26943, #26944
- Failed merges:
2015-07-11 07:40:27 +00:00
Manish Goregaokar
25b14375b7 Rollup merge of #26944 - rick68:patch-11, r=brson
fix typos
2015-07-11 18:40:13 +05:30
Manish Goregaokar
a36411d9db Rollup merge of #26943 - brson:installer, r=alexcrichton 2015-07-11 18:40:13 +05:30
Manish Goregaokar
ba6c808feb Rollup merge of #26936 - bluss:doc-array, r=steveklabnik
Small tweaks for the documentation of the primitive type array

Follow up to PR #26923, fix a few small details.
2015-07-11 18:40:13 +05:30
Manish Goregaokar
bb73c7a38d Rollup merge of #26932 - tsurai:master, r=steveklabnik
Simple adjustment to auto select the nightly channel for examples using unstable feature.
2015-07-11 18:40:13 +05:30
Dave Huseby
1a928f434a adding support for i686-unknown-freebsd target 2015-07-11 00:23:04 -07:00
bors
f7f28c8b26 Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthon
This round: io::Result and the free functions.
2015-07-11 04:44:55 +00:00
bors
96e64ec987 Auto merge of #26945 - steveklabnik:doc_io_bufreader, r=alexcrichton
Mostly just adding basic examples, what's there seems mostly good.

r? @alexcrichton
2015-07-11 03:10:11 +00:00
bors
64db3aac0f Auto merge of #26929 - alexcrichton:windows-dir-junction, r=brson
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes #26716
2015-07-11 01:35:30 +00:00
bors
98dcd5e10a Auto merge of #26941 - fhartwig:osx-file-debug, r=alexcrichton
This makes `Debug` for `File` show the file path and access mode of the file on OS X, just like on Linux.
I'd be happy about any feedback how to make this code better. In particular, I'm not sure how to handle the buffer passed to `fnctl`. This way works, but it feels a bit cumbersome. `fcntl` unfortunately doesn't return the length of the path.
2015-07-11 00:01:51 +00:00
Steve Klabnik
18201d7db1 More docs for std::io::BufReader 2015-07-10 16:47:48 -04:00
bors
072d07ce9f Auto merge of #26926 - alexcrichton:llvm-archive-writer, r=brson
We have previously always relied upon an external tool, `ar`, to modify archives
that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
a number of downsides:

* Spawning a process is relatively expensive for small compilations
* Encoding arguments across process boundaries often incurs unnecessary overhead
  or lossiness. For example `ar` has a tough time dealing with files that have
  the same name in archives, and the compiler copies many files around to ensure
  they can be passed to `ar` in a reasonable fashion.
* Most `ar` programs found do **not** have the ability to target arbitrary
  platforms, so this is an extra tool which needs to be found/specified when
  cross compiling.

The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
wasn't available in the standard LLVM libraries (it was just a standalone
program). Recently, however, in LLVM 3.7, this functionality has been moved to a
library and is now accessible by consumers of LLVM via the `writeArchive`
function.

This commit migrates our archive bindings to no longer invoke `ar` by default
but instead make a library call to LLVM to do various operations. This solves
all of the downsides listed above:

* Archive management is now much faster, for example creating a "hello world"
  staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
  recently started requiring modification of rlibs, and linking a hello world
  dynamic library is now 2x faster.
* The compiler is now one step closer to "hassle free" cross compilation because
  no external tool is needed for managing archives, LLVM does the right thing!

This commit does not remove support for calling a system `ar` utility currently.
We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
(so the system LLVM can be used wherever possible), and in these cases we must
shell out to a system utility. All nightly builds of Rust, however, will stop
needing a system `ar`.
2015-07-10 20:18:30 +00:00
Wei-Ming Yang
2509702314 Update boxed.rs
fix typos
2015-07-11 03:50:32 +08:00
Steven Fackler
b0ab164b80 Add trailing , for 1-tuples 2015-07-10 11:03:52 -08:00
Brian Anderson
e6d3780e22 Upgrade rust-installer. Fixes install on Fedora-based Linuxes. 2015-07-10 11:33:29 -07:00
bors
fe0b5c0d38 Auto merge of #26896 - tbu-:pr_getcwd, r=alexcrichton
(On Windows, it works already.)
2015-07-10 16:26:19 +00:00
Alex Crichton
4a824275b9 trans: Use LLVM's writeArchive to modify archives
We have previously always relied upon an external tool, `ar`, to modify archives
that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
a number of downsides:

* Spawning a process is relatively expensive for small compilations
* Encoding arguments across process boundaries often incurs unnecessary overhead
  or lossiness. For example `ar` has a tough time dealing with files that have
  the same name in archives, and the compiler copies many files around to ensure
  they can be passed to `ar` in a reasonable fashion.
* Most `ar` programs found do **not** have the ability to target arbitrary
  platforms, so this is an extra tool which needs to be found/specified when
  cross compiling.

The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
wasn't available in the standard LLVM libraries (it was just a standalone
program). Recently, however, in LLVM 3.7, this functionality has been moved to a
library and is now accessible by consumers of LLVM via the `writeArchive`
function.

This commit migrates our archive bindings to no longer invoke `ar` by default
but instead make a library call to LLVM to do various operations. This solves
all of the downsides listed above:

* Archive management is now much faster, for example creating a "hello world"
  staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
  recently started requiring modification of rlibs, and linking a hello world
  dynamic library is now 2x faster.
* The compiler is now one step closer to "hassle free" cross compilation because
  no external tool is needed for managing archives, LLVM does the right thing!

This commit does not remove support for calling a system `ar` utility currently.
We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
(so the system LLVM can be used wherever possible), and in these cases we must
shell out to a system utility. All nightly builds of Rust, however, will stop
needing a system `ar`.
2015-07-10 09:06:21 -07:00
Alex Crichton
72750c7c6e std: Consider directory junctions as directories
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes #26716
2015-07-10 08:25:37 -07:00
bors
fddfd089b7 Auto merge of #26928 - reem:cstr-is-a-cow, r=Gankro
This allows CString and CStr to be used with the Cow type,
which is extremely useful when interfacing with C libraries
that make extensive use of C-style strings.
2015-07-10 14:52:48 +00:00