Commit Graph

41506 Commits

Author SHA1 Message Date
Alex Crichton
c7017b3b3e rollup merge of #24661: SimonSapin/fmt-write-char
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).

Note that this brand new method is marked as **stable**. I judged this safe enough: it’s simple enough that it’s very unlikely to change. Still, I can mark it unstable instead if you prefer.

r? @alexcrichton
2015-04-21 15:23:13 -07:00
Alex Crichton
251f8d3fbd rollup merge of #24654: mdinger/patch-2
This just fixes some comments made on https://github.com/rust-lang/rust/pull/24632 . The second I think is better unless @steveklabnik actually meant something else.
2015-04-21 15:23:12 -07:00
Alex Crichton
59171f8ec8 rollup merge of #24651: tamird/old-references
r? @alexcrichton
2015-04-21 15:23:11 -07:00
Alex Crichton
1ec7ccb53c rollup merge of #24640: steveklabnik/new_unsafe_guide
https://github.com/rust-lang/rust/pull/24631 is related, as it will delete this from the TOC, but I want to keep it here.
2015-04-21 15:23:10 -07:00
Alex Crichton
d14fb2f0d6 rollup merge of #24635: tamird/llvm-3.5
r? @alexcrichton
2015-04-21 15:23:10 -07:00
Alex Crichton
6b1ce49574 rollup merge of #24611: doomsplayer/doomsplayer-patch-1
as dependency for #24594
2015-04-21 15:23:09 -07:00
Alex Crichton
a63df9218e rollup merge of #24563: kwantam/rfc_1054
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.

Also cleaned up references to str.words() throughout codebase.

Closes #15628
2015-04-21 15:23:08 -07:00
Alex Crichton
37a1f2e3ac rollup merge of #24487: erickt/syntax
This removes the usage of `#[feature(into_cow, slice_patterns, box_syntax, box_patterns, quote, unsafe_destructor)]` from being used in libsyntax. My main desire for this is that it brings me one step closer to letting [syntex](https://github.com/erickt/rust-syntex) compile with stable rust. Hopefully this doesn't inconvenience rust development.
2015-04-21 15:23:07 -07:00
Alex Crichton
957cb422a9 rollup merge of #24439: alexcrichton/fix-archive-assembler
When linking an archive statically to an rlib, the compiler will extract all
contents of the archive and add them all to the rlib being generated. The
current method of extraction is to run `ar x`, dumping all files into a
temporary directory. Object archives, however, are allowed to have multiple
entries with the same file name, so there is no method for them to extract their
contents into a directory in a lossless fashion.

This commit adds iterator support to the `ArchiveRO` structure which hooks into
LLVM's support for reading object archives. This iterator is then used to
inspect each object in turn and extract it to a unique location for later
assembly.
2015-04-21 15:23:06 -07:00
Alex Crichton
2fc2e12687 rollup merge of #24222: lambda/rename-soft-link-to-symlink
Implement [RFC #1048][rfc].

On Windows, when you create a symbolic link you must specify whether it
points to a directory or a file, even if it is created dangling, while
on Unix, the same symbolic link could point to a directory, a file, or
nothing at all.  Furthermore, on Windows special privilege is necessary
to use a symbolic link, while on Unix, you can generally create a
symbolic link in any directory you have write privileges to.

This means that it is unlikely to be able to use symbolic links purely
portably; anyone who uses them will need to think about the cross
platform implications.  This means that using platform-specific APIs
will make it easier to see where code will need to differ between the
platforms, rather than trying to provide some kind of compatibility
wrapper.

Furthermore, `soft_link` has no precedence in any other API, so to avoid
confusion, move back to the more standard `symlink` terminology.

Create a `std::os::unix::symlink` for the Unix version that is
destination type agnostic, as well as `std::os::windows::{symlink_file,
symlink_dir}` for Windows.

Because this is a stable API, leave a compatibility wrapper in
`std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file`
on Windows, preserving the existing behavior of `soft_link`.

[rfc]: https://github.com/rust-lang/rfcs/pull/1048
2015-04-21 15:23:06 -07:00
Alex Crichton
75f35657b3 rollup merge of #24162: pnkfelix/fsk-detect-duplicate-loop-labels
Check for duplicate loop labels in function bodies.

See also: http://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833

The change, which we are putting in as future-proofing in preparation for future potential additions to the language (namely labeling arbitrary blocks and using those labels in borrow expressions), means that code like this will start emitting warnings:

```rust
fn main() {
    { 'a: loop { break; } }
    { 'a: loop { break; } }
}
```

To make the above code compile without warnings, write this instead:

```rust
fn main() {
    { 'a: loop { break; } }
    { 'b: loop { break; } }
}
```

Since this change is only introducing a new warnings, this change is non-breaking.

Fix #21633
2015-04-21 15:23:05 -07:00
kwantam
c361e13d71 implement rfc 1054: split_whitespace() fn, deprecate words()
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.

Also cleaned up references to s.words() throughout codebase.

Closes #15628
2015-04-21 15:31:51 -04:00
kwantam
f43c86cda4 unstabilize Words struct
Words struct was stabilied by mistake. Unstabilize.
2015-04-21 15:31:45 -04:00
Alex Crichton
9ab0475d94 rustc: Handle duplicate names merging archives
When linking an archive statically to an rlib, the compiler will extract all
contents of the archive and add them all to the rlib being generated. The
current method of extraction is to run `ar x`, dumping all files into a
temporary directory. Object archives, however, are allowed to have multiple
entries with the same file name, so there is no method for them to extract their
contents into a directory in a lossless fashion.

This commit adds iterator support to the `ArchiveRO` structure which hooks into
LLVM's support for reading object archives. This iterator is then used to
inspect each object in turn and extract it to a unique location for later
assembly.
2015-04-21 11:08:19 -07:00
Erick Tryzelaar
19c8d70174 syntax: Copy unstable str::char_at into libsyntax 2015-04-21 10:23:53 -07:00
Erick Tryzelaar
7f9180fcb9 syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32 2015-04-21 10:11:05 -07:00
Erick Tryzelaar
83b1d7fd6f syntax: Remove #[feature(path_ext)]
Replace Path::exists with stable metadata call.
2015-04-21 10:09:27 -07:00
Erick Tryzelaar
c3da1a1912 syntax: replace Vec::push_all with stable Vec::extend 2015-04-21 10:09:26 -07:00
Erick Tryzelaar
21143aae94 syntax: Replace Vec::map_in_place with stable mut iterator 2015-04-21 10:08:57 -07:00
Erick Tryzelaar
a2cfe38505 syntax: Replace [].tail with the stable [1..] syntax 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
2937cce70c syntax: Replace String::from_str with the stable String::from 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
8553658952 syntax: remove #[feature(quote, unsafe_destructor)] 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
bc6d990adb syntax: Don't use unstable fn to convert single element to a slice 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
e3dd68d0a4 syntax: Remove use of TraitObject in pretty printer 2015-04-21 10:08:27 -07:00
Erick Tryzelaar
cfb9d286ea syntax: remove uses of .into_cow() 2015-04-21 10:08:26 -07:00
Erick Tryzelaar
ca0ee4c645 syntax: Remove uses of #[feature(slice_patterns)] 2015-04-21 10:08:26 -07:00
Erick Tryzelaar
a4541b02a3 syntax: remove #![feature(box_syntax, box_patterns)] 2015-04-21 10:07:48 -07:00
Simon Sapin
16181e686a Pick a feature name for write_char 2015-04-21 18:16:08 +02:00
Brian Campbell
3cc84efcdd Deprecate std::fs::soft_link in favor of platform-specific versions
On Windows, when you create a symbolic link you must specify whether it
points to a directory or a file, even if it is created dangling, while
on Unix, the same symbolic link could point to a directory, a file, or
nothing at all.  Furthermore, on Windows special privilege is necessary
to use a symbolic link, while on Unix, you can generally create a
symbolic link in any directory you have write privileges to.

This means that it is unlikely to be able to use symbolic links purely
portably; anyone who uses them will need to think about the cross
platform implications.  This means that using platform-specific APIs
will make it easier to see where code will need to differ between the
platforms, rather than trying to provide some kind of compatibility
wrapper.

Furthermore, `soft_link` has no precedence in any other API, so to avoid
confusion, move back to the more standard `symlink` terminology.

Create a `std::os::unix::symlink` for the Unix version that is
destination type agnostic, as well as `std::os::windows::{symlink_file,
symlink_dir}` for Windows.

Because this is a stable API, leave a compatibility wrapper in
`std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file`
on Windows, preserving the existing behavior of `soft_link`.
2015-04-21 12:14:22 -04:00
Felix S. Klock II
2b3cd40f82 add notes clarifying introduction of warnings for a pair of run-pass tests. 2015-04-21 18:09:46 +02:00
Felix S. Klock II
ccc9f5eb84 Tests for shadowing between lifetimes and loop labels within function bodies. 2015-04-21 18:09:46 +02:00
Felix S. Klock II
dd24070799 Check for shadowing between lifetimes and loop labels in function bodies.
Note: this Warns rather than error on shadowing problems involving labels.
We took this more conservative option mostly due to issues with
hygiene being broken for labels and/or lifetimes.

Add FIXME regarding non-hygienic comparison.
2015-04-21 18:09:41 +02:00
Simon Sapin
19cc9435d9 write_char is unlikely to make it for 1.0, it’ll be 1.1 2015-04-21 18:06:00 +02:00
Tamir Duberstein
71bc70ea1b Remove references to old_{path,io} 2015-04-21 08:16:03 -07:00
Tamir Duberstein
fe7f95fb3c Remove dead test
This was moved to https://github.com/rust-lang/term/issues/12
2015-04-21 08:16:02 -07:00
Tamir Duberstein
32e5f4948f Remove unused files
Looks like these were missed in bf4e77d.
2015-04-21 08:16:02 -07:00
Young Wu
7a0df61ab1 add TCP_* consts for linux 2015-04-21 22:42:34 +08:00
bors
7397bdc9c5 Auto merge of #24620 - pczarn:model-lexer-issues, r=cmr
Fixes #15679
Fixes #15878
Fixes #15882
Closes #15883
2015-04-21 14:37:53 +00:00
Tamir Duberstein
ba276adab5 LLVM < 3.5 is unsupported since bb18a3c 2015-04-21 07:20:48 -07:00
Simon Sapin
265a7cc3bd Add a write_char method to std::fmt::Write
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).
2015-04-21 14:51:28 +02:00
Steve Klabnik
9cc0af8d69 Refocus unsafe code chapter on unsafe itself. 2015-04-21 08:28:06 -04:00
bors
77acda1c8e Auto merge of #24598 - lfairy:impl-debug-for-file, r=alexcrichton
This patch adds a `Debug` impl for `std::fs::File`.

On all platforms (Unix and Windows) it shows the file descriptor.

On Linux, it displays the path and access mode as well.

Ideally we should show the path/mode for all platforms, not just Linux,
but this will do for now.

cc #24570
2015-04-21 11:46:15 +00:00
Piotr Czarnecki
13bc8afa4b Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
bors
3860240b0e Auto merge of #24646 - brson:stab, r=alexcrichton 2015-04-21 07:24:09 +00:00
Chris Wong
1131bc0a0f Implement Debug for File
This patch adds a `Debug` impl for `std::fs::File`.

On all platforms (Unix and Windows) it shows the file descriptor.

On Linux, it displays the path and access mode as well.

Ideally we should show the path/mode for all platforms, not just Linux,
but this will do for now.

cc #24570
2015-04-21 17:13:36 +12:00
mdinger
dc596695c9 Fix typos 2015-04-21 01:05:26 -04:00
bors
21c48c3e82 Auto merge of #24648 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24514, #24516, #24571, #24577, #24625, #24627, #24628, #24629, #24630, #24631, #24632, #24642, #24643, #24647
- Failed merges: #24640
2015-04-21 01:18:15 +00:00
Steve Klabnik
9ddcc38b6e Refocus unsafe code chapter on unsafe itself. 2015-04-20 21:17:46 -04:00
Steve Klabnik
550c8d87a7 Rollup merge of #24647 - mbrubeck:doc-edit, r=steveklabnik
None
2015-04-20 21:15:55 -04:00
Steve Klabnik
1d082de2d9 Rollup merge of #24643 - steveklabnik:doc_if_let, r=jakub-
and while let
2015-04-20 21:15:54 -04:00