Commit Graph

34684 Commits

Author SHA1 Message Date
bors
641e2a110d auto merge of #19152 : alexcrichton/rust/issue-17863, r=aturon
This commit is an implementation of [RFC 240][rfc] when applied to the standard
library. It primarily deprecates the entirety of `string::raw`, `vec::raw`,
`slice::raw`, and `str::raw` in favor of associated functions, methods, and
other free functions. The detailed renaming is:

* slice::raw::buf_as_slice => slice::from_raw_buf
* slice::raw::mut_buf_as_slice => slice::from_raw_mut_buf
* slice::shift_ptr => deprecated with no replacement
* slice::pop_ptr => deprecated with no replacement
* str::raw::from_utf8 => str::from_utf8_unchecked
* str::raw::c_str_to_static_slice => str::from_c_str
* str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff)
* str::raw::slice_unchecked => str.slice_unchecked
* string::raw::from_parts => String::from_raw_parts
* string::raw::from_buf_len => String::from_raw_buf_len
* string::raw::from_buf => String::from_raw_buf
* string::raw::from_utf8 => String::from_utf8_unchecked
* vec::raw::from_buf => Vec::from_raw_buf

All previous functions exist in their `#[deprecated]` form, and the deprecation
messages indicate how to migrate to the newer variants.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md
[breaking-change]

Closes #17863
2014-11-23 05:46:52 +00:00
P1start
55af4aff56 Change how rustdoc shows constants and statics to be more similar to other items
Fixes #19046.
2014-11-23 17:18:35 +13:00
P1start
6b5655cb84 Make rustdoc display extern crate statements correctly 2014-11-23 17:18:35 +13:00
P1start
2f0249b3a8 Highlight trait methods in rustdoc’s search results 2014-11-23 17:18:27 +13:00
Nicholas Bishop
b637a867a5 Fix typo in Result documentation 2014-11-22 22:13:00 -05:00
bors
529f8bcd8b auto merge of #19146 : gereeter/rust/reference-borrow, r=aturon
This should be a more general version of #19131.
2014-11-23 02:36:46 +00:00
Nick Cameron
34c76646b5 save-analysis: add values for types 2014-11-23 15:02:58 +13:00
Nick Cameron
e83785c51f save-analysis: emit a type for enum variants 2014-11-23 15:02:58 +13:00
bors
2274996a1d auto merge of #19137 : tbu-/rust/pr_refcell_unsafety, r=huonw 2014-11-23 00:36:43 +00:00
Jonathan Reem
1b17eefa4a Any: use plain transmute instead of transmute_copy for downcasting.
transmute_copy is no longer needed and is just slow.
2014-11-22 16:06:21 -08:00
Jonathan Reem
4705475be2 Mark Any::get_type_id as experimental
It is likely going to be removed and replaced
with an associated static.

Fixes #19222
2014-11-22 15:31:51 -08:00
bors
ccc4a7cebc auto merge of #19136 : alfie/rust/master, r=steveklabnik
An example of how type definitions work would be handy
2014-11-22 22:36:40 +00:00
Adolfo Ochagavía
d678684236 Add test 2014-11-22 21:47:49 +01:00
bors
0d0a290614 auto merge of #19134 : sinistersnare/rust/patch-2, r=alexcrichton
Vec<T> can index now so its a useless conversion.
2014-11-22 20:36:40 +00:00
Alex Crichton
8ca27a633e std: Align raw modules with unsafe conventions
This commit is an implementation of [RFC 240][rfc] when applied to the standard
library. It primarily deprecates the entirety of `string::raw`, `vec::raw`,
`slice::raw`, and `str::raw` in favor of associated functions, methods, and
other free functions. The detailed renaming is:

* slice::raw::buf_as_slice => slice::with_raw_buf
* slice::raw::mut_buf_as_slice => slice::with_raw_mut_buf
* slice::shift_ptr => deprecated with no replacement
* slice::pop_ptr => deprecated with no replacement
* str::raw::from_utf8 => str::from_utf8_unchecked
* str::raw::c_str_to_static_slice => str::from_c_str
* str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff)
* str::raw::slice_unchecked => str.slice_unchecked
* string::raw::from_parts => String::from_raw_parts
* string::raw::from_buf_len => String::from_raw_buf_len
* string::raw::from_buf => String::from_raw_buf
* string::raw::from_utf8 => String::from_utf8_unchecked
* vec::raw::from_buf => Vec::from_raw_buf

All previous functions exist in their `#[deprecated]` form, and the deprecation
messages indicate how to migrate to the newer variants.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md
[breaking-change]

Closes #17863
2014-11-22 09:36:56 -08:00
Adolfo Ochagavía
9f15ccb448 Fix pretty printing unsafe match arms 2014-11-22 17:30:45 +01:00
bors
caec7b0414 auto merge of #19133 : nodakai/rust/run-make-tests-missing-extracflags, r=alexcrichton
Missing `$(EXTRACFLAGS)` resutled in compile failures.
2014-11-22 14:46:38 +00:00
we
97d435497c DSTify free functions in std::hash 2014-11-22 17:03:40 +03:00
bors
4389ee3893 auto merge of #19132 : sinistersnare/rust/patch-1, r=alexcrichton
Just used Githubs edit view, so I hope this works...
2014-11-22 12:46:37 +00:00
bors
acfdb14044 auto merge of #19125 : chris-morgan/rust/vim-prelude-2014-11-20, r=alexcrichton 2014-11-22 10:46:40 +00:00
Vadim Petrochenkov
46bdb455c3 Merge pull request #1 from rust-lang/master
Update from original
2014-11-22 13:42:36 +03:00
bors
7765993d62 auto merge of #19124 : Kintaro/rust/remove_test_struct_variants, r=bstrie
Removed usage of struct_variant feature from all tests.
2014-11-22 08:46:44 +00:00
Matt McPherrin
0beaccb9bb Rename variables called pq to heap
The old name was sensible when this module was PriorityQueue but isn't
anymore.
2014-11-21 23:01:38 -08:00
bors
829680840c auto merge of #17513 : dradtke/rust/master, r=kballard
Looks like I made my previous PR a little too hastily. =)

This PR fixes a couple issues that I discovered with my previous revision:

1. Updated the errorformat to ignore "pointer lines" so that they don't show up in the output (with quickfix jumping, they're redundant and unnecessary).
2. Renamed a couple variables to be more in line with Cargo's terminology (`g:cargo_toml_name` should now be `g:cargo_manifest_name`).
3. Added support for errors reported with absolute paths (looks to be the case when compiling an executable instead of a library).
4. Most importantly, added support for errors reported while compiling a dependency. When building a Cargo package with local dependencies, if one of those dependencies failed to compile, the quickfix would be completely broken as it assumed that all errors were relative to the local manifest, or the closest Cargo.toml. With this update, it now pays attention to lines that end with `(file://<path>)`, and from then on adjusts all errors to be relative to `<path>`.

As a side note, that `<path>` output is somewhat broken on Windows. While `file:///home/damien/...` on *Nix is a valid URI, `file:///C:/Users/damien/...` on Windows is not, because `C:/` (or whatever the drive is) should take the place of the third slash which is *Nix's root, not be appended to it. I added a workaround for this in my script, but I figured I'd mention it to see if this is a bug in how Rust formats paths.
2014-11-22 06:31:43 +00:00
bors
2a4c0100fe auto merge of #19122 : Kintaro/rust/remove_struct_variant, r=jakub-
The struct_variant is not gated anymore. This commit just removes it and the resulting warnings when compiling rust. Now compiles with the snapshot from 11/18 (as opposed to PR #19014)
2014-11-22 04:06:45 +00:00
Jashank Jeremy
ab854481ba args() doc: Fix a documentation line. 2014-11-22 13:34:38 +11:00
bors
2af82f7530 auto merge of #19117 : jmesmon/rust/mk-cfg-suffix, r=cmr
Right now we'll end up globbing them into the accepted targets and (ever worse) they will override the make variables of real target files because we `include`d everything in that directory.

As a side effect, editors get a better hint on file types.
2014-11-22 01:46:46 +00:00
bors
81eeec0941 auto merge of #18603 : brson/rust/stdchar, r=aturon
* Deprecate the free functions in favor of methods, except the two ctors `from_u32` and `from_digit`, whose methods are deprecated.
* Mark the `Char` and `UnicodeChar` traits experimental until we decide for sure that we won't have some sort of inherent methods for primitives.
* The `UnicodeChar` methods related to numerics are now called e.g. `is_numeric` to match the 'numeric' unicode character class, and the `*_digit_radix` methods on `Char` now just called `*_digit`.
* `len_utf8_bytes` -> `len_utf8`
* Converted methods to take self by-value
* Converted `escape_default` and `escape_unicode` to iterators over chars.
* Renamed `is_XID_start`, `is_XID_continue` to `is_xid_start`, `is_xid_continue` to match conventions

This also converts `encode_utf8` and `encode_utf16` to return iterators. I suspect this is not the final form of these methods. Perf is worse (numbers in the commit). Many of the uses ended up being awkward, copying into a buffer then writing that buffer to a `Writer`. It might be more appropriate for these to return `Reader`s instead, but that type is defined in `std`.

Note: although I *did* add the `from_u32` ctor to the `Char` trait, I deprecated it again later, preferring the free ctors.

I've been sitting on this for a while.

cc @aturon
2014-11-21 23:16:48 +00:00
Alexander Light
69861df831 Shuffle locations for Deref
Remove both `strong_count` and `weak_count` from `Weak`s and make the
methods bare functions so as not to cause trouble with `deref`.
2014-11-21 17:56:33 -05:00
Aaron Turon
1e66164210 libs: add std::os::windows module
The new `std::os::windows` module exposes several extension traits
for extracting file descriptors, sockets, and handles from `std::io`
types.
2014-11-21 14:24:30 -08:00
Alex Crichton
1684419897 Register new snapshots 2014-11-21 14:15:33 -08:00
Aaron Turon
6733d8b483 Fallout from deprecation 2014-11-21 14:10:13 -08:00
Aaron Turon
7ce2d9c3fa libs: stabilize ascii module
This is an initial API stabilization pass for `std::ascii`. Aside from
some renaming to match conversion conventions, and deprecations in favor
of using iterators directly, almost nothing is changed here. However,
the static case conversion tables that were previously public are now private.

The stabilization of the (rather large!) set of extension traits is left
to a follow-up pass, because we hope to land some more general machinery
that will provide the same functionality without custom traits.

[breaking-change]
2014-11-21 14:10:13 -08:00
Brian Anderson
75ffadf8b6 core: Convert a 'failure' to 'panic' in docs 2014-11-21 13:18:08 -08:00
Brian Anderson
879af89baf core: Update docs for escape_unicode, escape_default 2014-11-21 13:18:08 -08:00
Brian Anderson
73622f8fdf unicode: Remove unused non_snake_case allows. 2014-11-21 13:18:08 -08:00
Brian Anderson
f39c29d0bc unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continue 2014-11-21 13:18:08 -08:00
Brian Anderson
76ddd2b154 unicode: Add stability attributes to u_char
Free functions deprecated. UnicodeChar experimental pending
final decisions about prelude.
2014-11-21 13:18:08 -08:00
Brian Anderson
d6ee804b63 unicode: Convert UnicodeChar methods to by-value
Extension traits for primitive types should be by-value.

[breaking-change]
2014-11-21 13:18:08 -08:00
Brian Anderson
aad2461604 core: Convert Char::escape_default, escape_unicode to iterators
[breaking-change]
2014-11-21 13:18:08 -08:00
Brian Anderson
ca1820b1fc core: Convert Char methods to by-val self
Methods on primitmive Copy types generally should take `self`.

[breaking-change]
2014-11-21 13:18:08 -08:00
Brian Anderson
5928f6c8b6 Fix various deprecation warnings from char changes 2014-11-21 13:18:04 -08:00
Brian Anderson
b577e4c8d8 core: Mark remaining Char methods unstable
The `Char` trait itself may go away in favor of primitive inherent
methods. Still some questions about whether the preconditions are
following the final error handling conventions.
2014-11-21 13:17:09 -08:00
Brian Anderson
95c3f618c0 core: Deprecated remaining free functions in char
Prefer the methods.
2014-11-21 13:17:09 -08:00
Brian Anderson
4dd1724576 core: Add stability attributes to char::from_digit and from_u32
For now we are preferring free functions for primitive ctors,
so they are marked 'unstable' pending final decision. The
methods on `Char` are 'deprecated'.
2014-11-21 13:17:09 -08:00
Brian Anderson
f6607a20c4 core: Add Char::len_utf16
Missing method to pair with len_utf8.
2014-11-21 13:17:09 -08:00
Brian Anderson
0150fa4b1b core: Rename Char::len_utf8_bytes to Char::len_utf8
"bytes" is redundant.

Deprecate the old.
2014-11-21 13:17:09 -08:00
Brian Anderson
acb5fefd6d core: Rename Char::is_digit_radix to is_digit
This fits the naming of `to_digit` and `from_digit`. Leave
the old name deprecated.
2014-11-21 13:17:09 -08:00
Brian Anderson
c2aff692fa unicode: Rename UnicodeChar::is_digit to is_numeric
'Numeric' is the proper name of the unicode character class,
and this frees up the word 'digit' for ascii use in libcore.

Since I'm going to rename `Char::is_digit_radix` to
`is_digit`, I am not leaving a deprecated method in place,
because that would just cause name clashes, as both
`Char` and `UnicodeChar` are in the prelude.

[breaking-change]
2014-11-21 13:17:04 -08:00
bors
cd75847437 auto merge of #18822 : scialex/rust/better-rustdoc, r=alexcrichton
Changed `rustdoc` so that if we do not have the `strip-private` pass
enabled private modules will be included in the generated documentation

I added this because it is useful to be able to read the documentation in the very nice `rustdoc` web interface when doing internal work on a project. In this case we want the `rustdoc` to include modules that are hidden from consumers. Since this is not currently possible I added it here.
2014-11-21 21:06:51 +00:00