Commit Graph

29327 Commits

Author SHA1 Message Date
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
Alan Andrade
0cae849595 fix mostly grammar per PR comments 2014-05-24 17:08:00 -07:00
Steven Fackler
3347993264 Changes from feedback 2014-05-24 16:49:47 -07:00
Steven Fackler
864c5016ae Get "make check" to work with unused-attribute
There's a fair number of attributes that have to be whitelisted since
they're either looked for by rustdoc, in trans, or as needed. These can
be cleaned up in the future.
2014-05-24 16:49:46 -07:00
Steven Fackler
24f98c6d7a Whitelist doc attributes
This is a bit overly permissive but should be okay for now.
2014-05-24 16:49:46 -07:00
Steven Fackler
e0648093d8 Port more stuff to mark used attributes 2014-05-24 16:49:46 -07:00
Steven Fackler
50181add04 First sketch of lint pass
Enough attributes are marked to cleanly compile an empty library.
2014-05-24 16:08:36 -07:00
Steven Fackler
c305473d3c Add AttrId to Attribute_ 2014-05-24 16:08:36 -07:00
bors
6304a27b80 auto merge of #14401 : aochagavia/rust/pr4, r=alexcrichton
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait.

* Renamed `to_lower` to `to_lowercase`
* Renamed `to_upper` to `to_uppercase`
* Renamed `is_alpha` to `is_alphabetic`
* Renamed `is_alnum` to `is_alphanumeric`
* Renamed `is_lower` to `is_lowercase`
* Renamed `is_upper` to `is_uppercase`

[breaking-change]
2014-05-24 14:26:23 -07:00
Alan Andrade
99744653d5 get over bold text madness, changes per PR, brought the "returning pointers" section back to pointers guide 2014-05-24 13:15:48 -07:00
Adolfo Ochagavía
e998958672 Update ascii functions used elsewhere 2014-05-24 22:00:18 +02:00
bors
43f942f886 auto merge of #14378 : huonw/rust/deque-adjustments, r=alexcrichton
Might as well remove the duplication/`forget` call.
2014-05-24 12:51:24 -07:00
bors
b546fff784 auto merge of #14405 : aochagavia/rust/pr5, r=cmr 2014-05-24 10:51:25 -07:00
Adolfo Ochagavía
9088a56db1 Removed unnecessary macro declaration 2014-05-24 18:11:30 +02:00
bors
39c1ecd411 auto merge of #14396 : vhbit/rust/opaque-mutex, r=alexcrichton
On some systems (iOS for example) mutex is represented by opaque data structure which doesn't play well with simple data copy. Therefore mutex should be initialized from magic static value and filled by OS only when it landed RC.

Initially written for iOS but since landing iOS support might require quite a lot of time I think it is better to split parts which aren't directly related to iOS and merge them in
2014-05-24 04:56:25 -07:00
Huon Wilson
9a8379deb2 std: minor simplification to sync::deque. 2014-05-24 21:44:37 +10:00
Adolfo Ochagavía
f7ccae5f15 Rename functions in Ascii
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait.

* Renamed `to_lower` to `to_lowercase`
* Renamed `to_upper` to `to_uppercase`
* Renamed `is_alpha` to `is_alphabetic`
* Renamed `is_alnum` to `is_alphanumeric`
* Renamed `is_lower` to `is_lowercase`
* Renamed `is_upper` to `is_uppercase`

[breaking-change]
2014-05-24 12:44:36 +02:00
bors
e72a21b2bb auto merge of #14392 : alexcrichton/rust/mem-updates, r=sfackler
* All of the *_val functions have gone from #[unstable] to #[stable]
* The overwrite and zeroed functions have gone from #[unstable] to #[stable]
* The uninit function is now deprecated, replaced by its stable counterpart,
  uninitialized

[breaking-change]
2014-05-24 03:21:24 -07:00
bors
12467989c3 auto merge of #14389 : Ryman/rust/14303, r=alexcrichton
Closes #14303.
2014-05-24 01:41:25 -07:00
bors
6cf430147e auto merge of #14388 : kballard/rust/nonfatal_lexer_errors, r=alexcrichton
Most errors that arise in the lexer can be recovered from. This allows
for more than one syntax error to be reported at a time.
2014-05-24 00:01:25 -07:00
bors
3bec8d7246 auto merge of #14384 : luqmana/rust/mca, r=alexcrichton
Only add `-Qunused-arguments` for clang.
2014-05-23 22:06:23 -07:00
Valerii Hiora
41b65d39ab Fixes problems on systems with opaque mutex
On some systems (iOS for example) mutex is represented by
opaque data structure which doesn't play well with simple
data copy. Therefore mutex should be initialized from
magic static value and filled by OS only when it landed RC.
2014-05-24 08:01:23 +03:00
Alex Crichton
2fd4841724 core: Finish stabilizing the mem module.
* All of the *_val functions have gone from #[unstable] to #[stable]
* The overwrite and zeroed functions have gone from #[unstable] to #[stable]
* The uninit function is now deprecated, replaced by its stable counterpart,
  uninitialized

[breaking-change]
2014-05-23 20:55:57 -07:00
bors
9c870b3d1c auto merge of #14306 : luqmana/rust/up-llvm, r=alexcrichton
We can now mark arguments and returns as `nonnull` in LLVM. It's still somewhat limited by the fact that LLVM loses this information after inlining but it might help in certain cases.
2014-05-23 19:51:20 -07:00
Kevin Ballard
4c9dace5d5 Make most lexer errors non-fatal
Most errors that arise in the lexer can be recovered from. This allows
for more than one syntax error to be reported at a time.
2014-05-23 19:35:08 -07:00
Luqman Aden
3cae434f5c librustc: Consolidate the attribute handling for tagging function arguments and returns. 2014-05-23 22:32:30 -04:00
Alan Andrade
64dad2cb03 Cleanup lifetime guide
Clean pointers guide
2014-05-23 18:52:06 -07:00
bors
12e80f1a14 auto merge of #14379 : brson/rust/simd, r=alexcrichton
Followup to https://github.com/mozilla/rust/pull/14331 and https://github.com/mozilla/rust/pull/12524
2014-05-23 18:06:19 -07:00
Luqman Aden
69e246fdc9 Add clang specific flag more selectively. 2014-05-23 17:27:13 -07:00
bors
4462687457 auto merge of #14317 : P1start/rust/lifetime-formatting, r=alexcrichton
This changes certain error messages about lifetimes so that they display lifetimes without an `&`.

Fixes #10291.
2014-05-23 16:31:20 -07:00
Brian Anderson
02d1ce830b core: Derive Show on SIMD types 2014-05-23 15:28:30 -07:00
Brian Anderson
eea66e1697 core: Document simd mod 2014-05-23 15:28:30 -07:00
Brian Anderson
8e58ec5b9d std: Move unstable::finally to std::finally. #1457
[breaking-change]
2014-05-23 15:28:27 -07:00
Brian Anderson
1a1e6c8e73 std: Move simd to core::simd and reexport. #1457
[breaking-change]
2014-05-23 15:27:48 -07:00
Brian Anderson
1240197a5b std: Move running_on_valgrind to rt::util. #1457
[breaking-change]
2014-05-23 15:27:48 -07:00
bors
11aa731b38 auto merge of #14368 : tedhorst/rust/master, r=alexcrichton 2014-05-23 14:56:24 -07:00
bors
53db981148 auto merge of #14359 : brson/rust/minordoc, r=alexcrichton 2014-05-23 13:21:25 -07:00
Kevin Butler
da663ccf9f Improve error message for lifetimes after type params.
Closes #14303.
2014-05-23 20:51:21 +01:00
bors
c329a1fcdc auto merge of #14313 : kballard/rust/tuple_dotdot_match_ice, r=cmr
Fixes #14308.
2014-05-23 11:46:26 -07:00
Brian Anderson
807dffde18 Minor library doc copyediting 2014-05-23 10:33:21 -07:00
bors
ad775be8b4 auto merge of #14360 : alexcrichton/rust/remove-deprecated, r=kballard
These have all been deprecated for awhile now, so it's likely time to start removing them.
2014-05-23 09:11:26 -07:00
Alex Crichton
33573bc0aa syntax: Clean out obsolete syntax parsing
All of these features have been obsolete since February 2014, where most have
been obsolete since 2013. There shouldn't be any more need to keep around the
parser hacks after this length of time.
2014-05-23 09:07:28 -07:00
bors
9e244d7084 auto merge of #14372 : neeee/rust/intrinsic-docs, r=brson 2014-05-23 02:06:25 -07:00
bors
33c3eddd11 auto merge of #14362 : zecozephyr/rust/docfixes, r=cmr
extra::arc -> alloc::arc
2014-05-23 00:31:27 -07:00
P1start
e6b23da5a2 Fix lifetime error to print 'a instead of &'a
This changes certain error messages about lifetimes so that they display
lifetimes without an `&`.

Fixes #10291.
2014-05-23 18:22:48 +12:00
Corey Richardson
d8467e23e7 rustc: abstract lint level exporting from EnumSizeVariance 2014-05-22 23:01:47 -07:00
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