Commit Graph

29624 Commits

Author SHA1 Message Date
Huon Wilson
0df221e993 rustc: provide more precise information about refutable patterns.
The compiler now points exactly which part(s) of a pattern are
refutable, rather than just highlighting the whole pattern.
2014-05-27 09:24:37 +10:00
Huon Wilson
f2a137829e syntax: desugar a for loop to a let binding to get better error
messages when the pattern is refutable.

This means the compiler points directly to the pattern and said that the
problem is the pattern being refutable (rather than just saying that
some value isn't covered in the `match` as it did previously).

Fixes #14390.
2014-05-27 09:24:37 +10:00
bors
746d086f93 auto merge of #14440 : Sawyer47/rust/tuple-doc, r=alexcrichton 2014-05-26 14:06:26 -07:00
Piotr Jawniak
9051f9bc61 Improve docs for core::tuple 2014-05-26 21:07:29 +02:00
bors
ca287ebc64 auto merge of #14374 : swgillespie/rust/swgillespie-tutorial, r=alexcrichton
The current tutorial says that the only way to get master is to build from source, which isn't true anymore - nightly binaries and an installer for Mac OS X are now available at the install page: http://www.rust-lang.org/install.html . Feedback very much welcome! Addresses issue #13578.
2014-05-26 11:51:27 -07:00
Huon Wilson
6ddd40d436 syntax: Add a source field to Local for tracking if it comes from lets or fors. 2014-05-26 22:44:38 +10:00
bors
6fad19e16b auto merge of #14439 : thestinger/rust/nonnull, r=luqmana 2014-05-26 01:51:25 -07:00
Daniel Micay
22ab5303ff handle attributes for non-immediate types first
Slices are non-immediate and were not having these attributes applied.
2014-05-26 03:26:02 -04:00
bors
ba77c60270 auto merge of #14300 : cmr/rust/enum-size-lint, r=kballard
See commits for details.
2014-05-26 00:16:27 -07:00
Daniel Micay
0c51149ac9 mark non-immediate by-value parameters as non-null 2014-05-26 02:59:19 -04:00
bors
a7ab73344d auto merge of #14432 : kballard/rust/nt_block, r=huonw
Fixes #13678.
2014-05-25 22:36:23 -07:00
Kevin Ballard
ff0f9b62f6 Allow $foo:block nonterminals in expression position
Fixes #13678.
2014-05-25 22:33:12 -07:00
Sean Gillespie
b3fb258406 Update tutorial, see issue #13578 2014-05-25 21:54:49 -07:00
P1start
c1fd3459fa Minor fixes to std::str docs
This tweaks the `std::str` docs to compensate for the recent shift from `~str`
to `String`.
2014-05-26 16:52:12 +12:00
bors
20a41519fd auto merge of #14430 : kballard/rust/squelch_os_warning, r=alexcrichton
Clean up the re-exports of various modules in `std::std`, and remove the
`realstd` stuff from `std::rt::args`.
2014-05-25 18:41:22 -07:00
Santiago Rodriguez
68455a12db Fix to tutorial 2014-05-25 19:00:03 -05:00
bors
db2ddb1bba auto merge of #14423 : Kimundi/rust/static_regex, r=alexcrichton
This patch changes the internals of `Regex` and `regex!()` such that

```rust
static RE: Regex = regex!(...);
```

is valid. It doesn't change anything about the actual regex implementation, it just changes the type to something that can be constructed as a const expression.
2014-05-25 16:46:20 -07:00
Kevin Ballard
009d898a94 De-realstd os::args
With the test runner using ::std::os::args(), and std::std::os now being
a re-export of realstd::os, there's no more need for realstd stuff
mucking up rt::args.

Remove the one test of os::args(), as it's not very useful and it won't
work anymore now that rt::args doesn't use realstd.
2014-05-25 16:37:19 -07:00
Kevin Ballard
69070ac85f libstd: Remove unnecessary re-exports under std::std 2014-05-25 16:21:07 -07:00
bors
0fca6c6a02 auto merge of #14391 : alexcrichton/rust/more-rustdoc-inline, r=huonw
As part of the libstd facade (cc #13851), rustdoc is taught to inline documentation across crate boundaries through the usage of a `pub use` statement. This is done to allow libstd to maintain the facade that it is a standalone library with a defined public interface (allowing us to shuffle around what's underneath it).

A preview is available at http://people.mozilla.org/~acrichton/doc/std/index.html
2014-05-25 13:56:21 -07:00
Marvin Löbel
b997de529a Change regex! macro to expand to a constexpr, allowing to put it in a static 2014-05-25 22:30:50 +02:00
Alex Crichton
3100bc5b82 rustdoc: Move inlining to its own module 2014-05-25 13:26:46 -07:00
bors
1cf1527b91 auto merge of #14426 : catharsis/rust/master, r=alexcrichton
Just a tiny fix, sorry about the noise :-)
2014-05-25 12:21:21 -07:00
Anton Löfgren
5ca437078b guide-runtime.md: Fix a typo 2014-05-25 21:11:54 +02:00
bors
759517c180 auto merge of #14417 : Sawyer47/rust/dlist-fixme, r=huonw
Issue #3511 was closed, but dlist.rs contained a FIXME for it.
2014-05-25 05:01:18 -07:00
bors
489f470886 auto merge of #14370 : cmr/rust/design-faq, r=brson
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 03:01:20 -07:00
Corey Richardson
11c0f77107 doc: add a new language design faq
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 02:53:53 -07:00
Piotr Jawniak
9b5bdfc2e2 Fix FIXME #3511 in Dlist code
Issue #3511 was closed, but dlist.rs contained a FIXME for it.
2014-05-25 11:41:20 +02:00
Alex Crichton
bd339ced36 doc: Document the new #[doc(no_inline)] attribute 2014-05-25 01:18:37 -07:00
Alex Crichton
8dad7f579e rustdoc: Get [src] links working for inlined dox
These links work by hyperlinking back to the actual documentation page with a
query parameter which will be recognized and then auto-click the appropriate
[src] link.
2014-05-25 01:18:37 -07:00
Alex Crichton
9f13db2cb2 rustdoc: Fix rendering of the 'static bound 2014-05-25 01:18:11 -07:00
Alex Crichton
837d4d8f35 rustdoc: Link to local reexportations of items
Within the documentation for a crate, all hyperlinks to reexported items don't
go across crates, but rather to the items in the crate itself. This will allow
references to Option in the standard library to link to the standard library's
Option, instead of libcore's.

This does mean that other crate's links for Option will still link to libcore's
Option.
2014-05-25 01:18:11 -07:00
Alex Crichton
a96067077a rustdoc: Prevent a segfault when using markdown
The field passed from markdown could sometimes be null, and it wasn't properly
handled.
2014-05-25 01:18:11 -07:00
Alex Crichton
316ef79dc2 rustc: Encode module attributes
This will allow for rustdoc to pick up the documentation on the other end.
2014-05-25 01:18:11 -07:00
Alex Crichton
781e898348 rustdoc: Use csearch for impl loading
The normal analysis passes aren't guaranteed to have loaded all impls, so use
the csearch methods directly to load impls.
2014-05-25 01:18:10 -07:00
Alex Crichton
5ee3d0e1ff rustdoc: Inline reexported modules 2014-05-25 01:18:10 -07:00
Alex Crichton
9181c35ee9 rustdoc: Inline names of function arguments 2014-05-25 01:18:10 -07:00
Alex Crichton
6ee9109c8b rustdoc: Inline argument names of foreign methods 2014-05-25 01:18:10 -07:00
Alex Crichton
ec4f79ff6c rustdoc: Don't show reexported enum variants
For now just assume that the enum type itself is reexported.
2014-05-25 01:17:57 -07:00
Alex Crichton
622c8f7b57 rustdoc: Inline enums across crates 2014-05-25 01:17:57 -07:00
Alex Crichton
c81b511bfd rustdoc: Start inlining structs across crates 2014-05-25 01:17:57 -07:00
Alex Crichton
8b8e70ba1d std: Add doc(noinline) to the prelude reexports 2014-05-25 01:17:34 -07:00
Alex Crichton
712118b9c0 rustdoc: Inline documentation of pub use
This commit teaches rustdoc to inline the documentation for the destination of a
`pub use` statement across crate boundaries. This is intended for the standard
library's facade to show the fact that the facade is just an implementation
detail rather than the api of the standard library itself.

This starts out by inlining traits and functions, but more items will come soon.
The current drawback of this system is that hyperlinks across crates sill go to
the original item's definition rather than the reexported location.
2014-05-25 01:17:14 -07:00
bors
6b1426b87c auto merge of #14415 : Sawyer47/rust/ascii-fixme, r=huonw
Issue #5475 was closed some time ago, but ascii.rs still contained
a FIXME for it.
2014-05-25 01:11:19 -07:00
Piotr Jawniak
d12e12ed99 Fix FIXME #5475 in std::ascii
Issue #5475 was closed some time ago, but ascii.rs still contained
a FIXME for it.
2014-05-25 08:56:50 +02:00
bors
7d76d0ad44 auto merge of #14323 : richo/rust/features/strbuf_to_string, r=huonw
Converts `StrBuf` to `String` throughout rustc and the standard library.

Tests all pass locally, but usual caveats about platforms that aren't OSX apply since I don't have a test environment handy.

@alexcritchon mentioned that @pcwalton may have a patch incoming that should block this?

closes #14312
2014-05-24 21:51:18 -07:00
Richo Healey
553074506e core: rename strbuf::StrBuf to string::String
[breaking-change]
2014-05-24 21:48:10 -07:00
bors
bbb70cdd9c auto merge of #14402 : huonw/rust/arc-field-rename, r=alexcrichton
Paper over privacy issues with Deref by changing field names.

Types that implement Deref can cause weird error messages due to their
private fields conflicting with a field of the type they deref to, e.g.,
previously

    struct Foo { x: int }

    let a: Arc<Foo> = ...;
    println!("{}", a.x);

would complain the the `x` field of `Arc` was private (since Arc has a
private field called `x`) rather than just ignoring it.

This patch doesn't fix that issue, but does mean one would have to write
`a._ptr` to hit the same error message, which seems far less
common. (This patch `_`-prefixes all private fields of
`Deref`-implementing types.)

cc #12808
2014-05-24 18:56:19 -07:00
Huon Wilson
9698221f91 Paper over privacy issues with Deref by changing field names.
Types that implement Deref can cause weird error messages due to their
private fields conflicting with a field of the type they deref to, e.g.,
previously

    struct Foo { x: int }

    let a: Arc<Foo> = ...;
    println!("{}", a.x);

would complain the the `x` field of `Arc` was private (since Arc has a
private field called `x`) rather than just ignoring it.

This patch doesn't fix that issue, but does mean one would have to write
`a._ptr` to hit the same error message, which seems far less
common. (This patch `_`-prefixes all private fields of
`Deref`-implementing types.)

cc #12808
2014-05-25 10:23:37 +10:00
bors
07563be6eb auto merge of #14373 : sfackler/rust/unused-attr, r=huonw
The compiler now tracks which attributes were actually looked at during the compilation process and warns for those that were unused.

Some things of note:

* The tracking is done via thread locals, as it made the implementation more straightforward. Note that this shouldn't hamper any future parallelization as each task can have its own thread local state which can be merged for the lint pass. If there are serious objections to this, I can restructure things to explicitly pass the state around.
* There are a number of attributes that have to be special-cased and globally whitelisted. This happens for four reasons:
  * The `doc` and `automatically_derived` attributes are used by rustdoc, but not by the compiler.
  * The crate-level attributes `license`, `desc` and `comment` aren't currently used by anything.
  * Stability attributes as well as `must_use` are checked only when the tagged item is used, so we can't guarantee that the compiler's looked at them.
  * 12 attributes are used only in trans, which happens after the lint pass.

#14300 is adding infrastructure to track lint state through trans, which this lint should also be able to use to handle the last case. For the other attributes, the right solution would probably involve a specific pass to mark uses that occur in the correct context. For example, a `doc` attribute attached to a match arm should generate a warning, but will not currently.

RFC: 0002-attribute-usage
2014-05-24 17:21:20 -07:00