Commit Graph

29329 Commits

Author SHA1 Message Date
Corey Richardson
c327080ee0 rustc: add a lint for large enum variants
It can be easy to accidentally bloat the size of an enum by making one variant
larger than the others. When this happens, it usually goes unnoticed. This
commit adds a lint that can warn when the largest variant in an enum is more
than 3 times larger than the second-largest variant. This requires a little
bit of rejiggering, because size information is only available in trans, but
lint levels are only available in the lint context.

It is allow by default because it's pretty noisy, and isn't really *that*
undesirable.

Closes #10362
2014-05-22 23:01:47 -07:00
lucy
3d6337079f libcore: Document math intrinsics. 2014-05-23 07:44:03 +02:00
Corey Richardson
f122ad08a5 rustc: middle: ty: use doc comments for the tcx 2014-05-22 22:24:56 -07:00
Corey Richardson
3f8cc1683b rustc: middle: lint: use more doc comments 2014-05-22 22:24:54 -07:00
Ted Horst
2571d42241 updated hash value in reduced benchmark 2014-05-22 23:07:57 -05:00
bors
02117dd1bc auto merge of #14357 : huonw/rust/spelling, r=pnkfelix
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`.

```rust
//! a
//! b

fn bar() {}
```
2014-05-22 20:56:18 -07:00
bors
ec0258a381 auto merge of #14314 : alexcrichton/rust/deriving-hash, r=brson
One of the long-term goals of the libstd facade is to move the collections
library underneath the standard library. This would imply that libcollections
today would invert its dependency with libstd.

One of the primary blockers for doing this is the HashMap collection. Of its two
major dependencies, hashing and randomness, this commit is the first step in
dealing with hashing.

When moving the hash module beneath libstd, it must break its primary dependence
on the io::Writer trait (used as the hashing state). The proposed strategy for
breaking this dependence is taking a similar path as core::fmt, which is to have
the hash module define its own "writer trait". This trait would be similar to
std::io::Writer, except that it would not return errors and it would have fewer
convenience methods.

The Hash trait today has its type parameter behind a feature gate (default type
parameters), so this pending change will likely break no code which hasn't opted
in to the feature gate. The SipState struct will lose its implementation of
io::Writer, but it will regain similar methods for dealing with writing data.

This change specifically prepares for the hash migration by modifying
deriving(Hash) to use the std:#️⃣:Writer bound instead of the std::io::Writer
bound. This bound is currently wired to std::io::Writer, but after a snapshot it
will have no need to be wired to the io writer trait.
2014-05-22 18:36:22 -07:00
Luqman Aden
90eeb92e10 Update to LLVM head and mark various ptrs as nonnull. 2014-05-22 21:06:24 -04:00
bors
a0960a1223 auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonw 2014-05-22 16:56:23 -07:00
bors
87ad19eb78 auto merge of #14310 : pcwalton/rust/detildestr-alllibs, r=brson
r? @brson
2014-05-22 15:16:31 -07:00
Alex Crichton
711f531b65 doc: Touch up the unsafe guide
* Change ~ references to Box
* Rewrite examples so they can be compiled an run
* Mention libcore
* Update wording about compiler-required functions
2014-05-22 15:14:23 -07:00
Patrick Walton
e878721d70 libcore: Remove all uses of ~str from libcore.
[breaking-change]
2014-05-22 14:42:02 -07:00
Patrick Walton
5633d4641f libstd: Remove all uses of ~str from libstd 2014-05-22 14:42:02 -07:00
Patrick Walton
a9dd903d79 libtime: Remove the tz_zone field from times.
It depends on `~str`.
2014-05-22 14:42:02 -07:00
Patrick Walton
36195eb91f libstd: Remove ~str from all libstd modules except fmt and str. 2014-05-22 14:42:01 -07:00
Jonathan Bailey
12240e5b9e Fixed incorrect module path
extra::arc -> sync::arc
2014-05-22 13:46:52 -07:00
bors
e402e75f4e auto merge of #14350 : zwarich/rust/let-suggestion, r=pcwalton 2014-05-22 13:31:24 -07:00
Alex Crichton
0dd4c1e7bd Remove a slew of old deprecated functions 2014-05-22 11:54:14 -07:00
bors
8d50d6a93c auto merge of #14346 : alexcrichton/rust/rustdoc-external-crates, r=pcwalton
This commit alters rustdoc to crawl the metadata of upstream libraries in order
to fill in default methods for traits implemented in downstream crates. This,
for example, documents the `insert` function on hash maps.

This is a fairly lossy extraction from the metadata. Documentation and
attributes are lost, but they aren't used anyway. Unfortunately, argument names
are also lost because they are not present in the metadata. Source links are
also lost because the spans are not serialized.

While not perfect, it appears that presenting this documentation through rustdoc
is much better than nothing, so I wanted to land this to allow iteration on it
later on.
2014-05-22 10:31:25 -07:00
Alex Crichton
c746c503f0 rustdoc: Fill in external trait methods
This commit alters rustdoc to crawl the metadata of upstream libraries in order
to fill in default methods for traits implemented in downstream crates. This,
for example, documents the `insert` function on hash maps.

This is a fairly lossy extraction from the metadata. Documentation and
attributes are lost, but they aren't used anyway. Unfortunately, argument names
are also lost because they are not present in the metadata. Source links are
also lost because the spans are not serialized.

While not perfect, it appears that presenting this documentation through rustdoc
is much better than nothing, so I wanted to land this to allow iteration on it
later on.
2014-05-22 09:46:22 -07:00
bors
3c9f2a5d0a auto merge of #14354 : EdorianDark/rust/master, r=huonw
It seemed to me, that [T] was deprecated and i am trying to help.
2014-05-22 08:51:20 -07:00
bors
9411cec580 auto merge of #14349 : richo/rust/docs/win64_calling_convention, r=alexcrichton
Wikipedia suggests that windows on x64 has it's own calling convention (Supported by the fact that we implement it)

source: http://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions
2014-05-22 07:16:22 -07:00
Huon Wilson
d3fde8476b syntax: put the correct span on doc-comments inside a module.
The position of the .bump call (before extracting the span fields) was
causing a doc-comment to have the span of the next token, not itself.
2014-05-22 22:58:14 +10:00
Huon Wilson
37bd466e58 Spelling/doc formatting fixes. 2014-05-22 22:55:37 +10:00
bors
9ac9148bbd auto merge of #14335 : tbu-/rust/pr_doc_strsplit, r=pnkfelix
In particular, show examples for splitting the empty string and using `splitn`
with a count of 0.

Fix #14222.
2014-05-22 05:26:22 -07:00
Dirk Leifeld
6787e22c08 Remove allow(deprecated_owned_vector) lint 2014-05-22 13:19:44 +02:00
bors
e7e5e9ce96 auto merge of #14345 : alexcrichton/rust/rustdoc-many-impls, r=pcwalton
Right now, when you look in the "Implementors" section for traits, you only see
implementors within that crate. This commit modifies that section to include
implementors from neighboring crates as well.

For example, the Container trait currently says that it is only implemented by
strings and slices, but it is in fact implemented by nearly all containers.

Implementation-wise, this change generates an "implementors cache" similarly to
the search index where each crate will append implementors to the files. When
the page for a trait is loaded, it will load its specific cache file, rendering
links for all upstream types which implement the trait.
2014-05-22 02:51:21 -07:00
bors
022a7b3cfb auto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichton 2014-05-22 01:06:25 -07:00
Richo Healey
e5d883101c docs: Add win64 calling convention 2014-05-22 00:05:56 -07:00
bors
22e2204c3d auto merge of #14321 : alexcrichton/rust/ices, r=pcwalton
Also adding tests for fixed ICEs
2014-05-21 23:31:27 -07:00
Cameron Zwarich
516a177273 Add a suggestion to use a let binding on some borrowck errors. 2014-05-21 22:04:22 -07:00
Alex Crichton
1ccc51ce3b doc: Fix some broken links 2014-05-21 20:33:00 -07:00
bors
f78eb14341 auto merge of #14307 : kballard/rust/vim_prelude_mutablecloneablevector, r=cmr
Add slice::MutableCloneableVector to the prelude. It's the only slice
trait that's currently missing.

Update rust.vim to match the latest prelude and current set of keywords.
Also teach it to handle box placement expressions specially.
2014-05-21 20:11:27 -07:00
Alex Crichton
799ddba8da Change static.rust-lang.org to doc.rust-lang.org
The new documentation site has shorter urls, gzip'd content, and index.html
redirecting functionality.
2014-05-21 19:55:39 -07:00
bors
257a73ce82 auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brson
This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.
2014-05-21 17:31:29 -07:00
Alex Crichton
06eb9765fe rustdoc: Show types for traits across crates
Right now, when you look in the "Implementors" section for traits, you only see
implementors within that crate. This commit modifies that section to include
implementors from neighboring crates as well.

For example, the Container trait currently says that it is only implemented by
strings and slices, but it is in fact implemented by nearly all containers.

Implementation-wise, this change generates an "implementors cache" similarly to
the search index where each crate will append implementors to the files. When
the page for a trait is loaded, it will load its specific cache file, rendering
links for all upstream types which implement the trait.
2014-05-21 16:41:58 -07:00
Alex Crichton
fdf935a524 std,green: Mark some queue types as NoShare 2014-05-21 16:36:57 -07:00
Daniel Micay
f1ce693e61 alter exchange_free for sized deallocation
The support for sized deallocation is nearly complete. The only known
missing pieces are `Box<str>`, `Box<[T]>` and `proc`.
2014-05-21 16:16:17 -04:00
Daniel Micay
945019830b migrate from exchange_malloc to allocate
This is now only used internally by the compiler.
2014-05-21 16:16:17 -04:00
bors
5f3f0918ad auto merge of #14334 : brson/rust/deoxidize, r=alexcrichton
Using `rustc` instead of e.g. `compile` makes it clear this is a rust build step.
2014-05-21 13:11:28 -07:00
bors
83eefa88c1 auto merge of #14328 : Sawyer47/rust/remove-fixmes, r=alexcrichton 2014-05-21 11:36:29 -07:00
Tobias Bucher
dcc2305664 Add examples for edge cases of str.split/str.splitn
In particular, show examples for splitting the empty string and using `splitn`
with a count of 0.

Fix #14222.
2014-05-21 20:05:55 +02:00
Brian Anderson
7c8c544731 mk: Replace 'oxidize' with 'rustc'. Closes #13781 2014-05-21 11:01:59 -07:00
bors
96670e9723 auto merge of #14320 : kballard/rust/fix_stdlib_inject_attrs, r=alexcrichton
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an
outer attribute so it can pretty-print properly.

Also add `#![no_std]` and `#[feature(phase)]` so compiling the
pretty-printed source will work.
2014-05-21 09:46:27 -07:00
Alex Crichton
0d4b840523 rustc: Fix an ICE with box-placement syntax
Closes #14084
2014-05-21 09:16:14 -07:00
Alex Crichton
a016aa2405 rustc: Turn a Box ICE into an error
Closes #14092
2014-05-21 09:16:11 -07:00
Alex Crichton
3d268fe666 std: Change hash to reexport its own Writer
One of the long-term goals of the libstd facade is to move the collections
library underneath the standard library. This would imply that libcollections
today would invert its dependency with libstd.

One of the primary blockers for doing this is the HashMap collection. Of its two
major dependencies, hashing and randomness, this commit is the first step in
dealing with hashing.

When moving the hash module beneath libstd, it must break its primary dependence
on the io::Writer trait (used as the hashing state). The proposed strategy for
breaking this dependence is taking a similar path as core::fmt, which is to have
the hash module define its own "writer trait". This trait would be similar to
std::io::Writer, except that it would not return errors and it would have fewer
convenience methods.

The Hash trait today has its type parameter behind a feature gate (default type
parameters), so this pending change will likely break no code which hasn't opted
in to the feature gate. The SipState struct will lose its implementation of
io::Writer, but it will regain similar methods for dealing with writing data.

This change specifically prepares for the hash migration by modifying
deriving(Hash) to use the std:#️⃣:Writer bound instead of the std::io::Writer
bound. This bound is currently wired to std::io::Writer, but after a snapshot it
will have no need to be wired to the io writer trait.
2014-05-21 09:15:23 -07:00
bors
803e92de89 auto merge of #14326 : huonw/rust/tiny-fixes, r=pnkfelix
The changes to flowgraph make invalid invocations slightly more forgiving by (trying to) provide slightly more information and by avoiding the ICE message.
2014-05-21 08:06:27 -07:00
Piotr Jawniak
fe7cc81087 Remove two outdated FIXMEs from complex.rs 2014-05-21 16:04:35 +02:00
bors
1edb0e5364 auto merge of #14324 : zecozephyr/rust/docfix, r=luqmana 2014-05-21 06:21:25 -07:00