]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoUpdate compile fail tests to use isize.
Huon Wilson [Thu, 8 Jan 2015 10:54:35 +0000 (21:54 +1100)]
Update compile fail tests to use isize.

9 years agoRemove warning from the libraries.
Huon Wilson [Thu, 8 Jan 2015 10:45:49 +0000 (21:45 +1100)]
Remove warning from the libraries.

This adds the int_uint feature to *every* library, whether or not it
needs it.

9 years agoAdd a warning feature gate for int/uint in types and i/u suffixes.
Huon Wilson [Thu, 8 Jan 2015 10:16:35 +0000 (21:16 +1100)]
Add a warning feature gate for int/uint in types and i/u suffixes.

9 years agoStore deprecated status of i/u-suffixed literals.
Huon Wilson [Thu, 8 Jan 2015 09:13:14 +0000 (20:13 +1100)]
Store deprecated status of i/u-suffixed literals.

9 years agoauto merge of #20744 : huonw/rust/fix-string-slicing, r=pnkfelix
bors [Thu, 8 Jan 2015 12:39:56 +0000 (12:39 +0000)]
auto merge of #20744 : huonw/rust/fix-string-slicing, r=pnkfelix

9 years agoLet ToString work with unsized types, importantly, `str`.
Huon Wilson [Thu, 8 Jan 2015 11:48:32 +0000 (22:48 +1100)]
Let ToString work with unsized types, importantly, `str`.

9 years agoauto merge of #20737 : aturon/rust/stab-stragglers, r=alexcrichton
bors [Thu, 8 Jan 2015 09:04:49 +0000 (09:04 +0000)]
auto merge of #20737 : aturon/rust/stab-stragglers, r=alexcrichton

Marks `vec`, `char` and `fmt` as stable module names.

9 years agoAdd missing module stability attributes
Aaron Turon [Thu, 8 Jan 2015 08:26:21 +0000 (00:26 -0800)]
Add missing module stability attributes

9 years agoauto merge of #20733 : alexcrichton/rust/rollup, r=alexcrichton
bors [Thu, 8 Jan 2015 05:35:51 +0000 (05:35 +0000)]
auto merge of #20733 : alexcrichton/rust/rollup, r=alexcrichton

9 years agoMore test fixes and rebase conflicts
Alex Crichton [Thu, 8 Jan 2015 04:06:37 +0000 (20:06 -0800)]
More test fixes and rebase conflicts

9 years agorollup merge of #20731: nick29581/assoc-inherant
Alex Crichton [Thu, 8 Jan 2015 03:30:20 +0000 (19:30 -0800)]
rollup merge of #20731: nick29581/assoc-inherant

9 years agoTest fixes and rebase conflicts
Alex Crichton [Thu, 8 Jan 2015 02:53:58 +0000 (18:53 -0800)]
Test fixes and rebase conflicts

9 years agoForbid associated items in inherent impls
Nick Cameron [Thu, 8 Jan 2015 02:07:15 +0000 (15:07 +1300)]
Forbid associated items in inherent impls

Closes #20359

9 years agorollup merge of #20707: nikomatsakis/issue-20582
Alex Crichton [Thu, 8 Jan 2015 01:44:24 +0000 (17:44 -0800)]
rollup merge of #20707: nikomatsakis/issue-20582

9 years agorollup merge of #20723: pnkfelix/feature-gate-box-syntax
Alex Crichton [Thu, 8 Jan 2015 01:42:47 +0000 (17:42 -0800)]
rollup merge of #20723: pnkfelix/feature-gate-box-syntax

Conflicts:
src/compiletest/compiletest.rs
src/libcollections/lib.rs
src/libserialize/lib.rs
src/libsyntax/feature_gate.rs

9 years agofallout: part of changes to compile-fail tests. (follows same pattern as prior two...
Felix S. Klock II [Thu, 8 Jan 2015 01:41:23 +0000 (02:41 +0100)]
fallout: part of changes to compile-fail tests.  (follows same pattern as prior two commits.)

9 years agorollup merge of #20720: nick29581/assoc-ice-missing
Alex Crichton [Thu, 8 Jan 2015 01:38:03 +0000 (17:38 -0800)]
rollup merge of #20720: nick29581/assoc-ice-missing

9 years agofallout: run-fail tests that use box. (many/all could be ported to `Box::new` instead.)
Felix S. Klock II [Thu, 8 Jan 2015 01:37:58 +0000 (02:37 +0100)]
fallout: run-fail tests that use box. (many/all could be ported to `Box::new` instead.)

9 years agorollup merge of #20657: alexcrichton/stabilize-macros
Alex Crichton [Thu, 8 Jan 2015 01:36:16 +0000 (17:36 -0800)]
rollup merge of #20657: alexcrichton/stabilize-macros

9 years agoRemove String impls and fix for make tidy
Nick Cameron [Thu, 8 Jan 2015 01:33:57 +0000 (14:33 +1300)]
Remove String impls and fix for make tidy

9 years agorollup merge of #20706: nikomatsakis/assoc-types-projections-in-structs-issue-20470
Alex Crichton [Thu, 8 Jan 2015 01:35:00 +0000 (17:35 -0800)]
rollup merge of #20706: nikomatsakis/assoc-types-projections-in-structs-issue-20470

Conflicts:
src/librustc_trans/trans/expr.rs

9 years agorollup merge of #20665: nikomatsakis/assoc-types-method-dispatch-projection
Alex Crichton [Thu, 8 Jan 2015 01:33:41 +0000 (17:33 -0800)]
rollup merge of #20665: nikomatsakis/assoc-types-method-dispatch-projection

Conflicts:
src/librustc/middle/ty.rs

9 years agofallout: run-pass tests that use box. (many could be ported to `Box::new` instead...
Felix S. Klock II [Thu, 8 Jan 2015 01:25:56 +0000 (02:25 +0100)]
fallout: run-pass tests that use box.  (many could be ported to `Box::new` instead in the future.)

9 years agorollup merge of #20728: huonw/type-param-shadowing
Alex Crichton [Thu, 8 Jan 2015 01:30:15 +0000 (17:30 -0800)]
rollup merge of #20728: huonw/type-param-shadowing

Conflicts:
src/librustc_typeck/check/wf.rs

9 years agorollup merge of #20631: huon/no-drop-and-copy
Alex Crichton [Thu, 8 Jan 2015 01:28:38 +0000 (17:28 -0800)]
rollup merge of #20631: huon/no-drop-and-copy

9 years agoProhibit type parameter shadowing with a clunky hammer.
Huon Wilson [Thu, 8 Jan 2015 00:39:45 +0000 (11:39 +1100)]
Prohibit type parameter shadowing with a clunky hammer.

This is a [breaking-change].

Change

    impl<T> Foo<T> {
        fn bar<T>(...

to (for example)

    impl<T> Foo<T> {
        fn bar<U>(...

Per RFC 459.

Closes #19390.

9 years agorollup merge of #20721: japaric/snap
Alex Crichton [Thu, 8 Jan 2015 01:26:58 +0000 (17:26 -0800)]
rollup merge of #20721: japaric/snap

Conflicts:
src/libcollections/vec.rs
src/libcore/fmt/mod.rs
src/librustc/lint/builtin.rs
src/librustc/session/config.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/type_.rs
src/librustc_typeck/check/_match.rs
src/librustdoc/html/format.rs
src/libsyntax/std_inject.rs
src/libsyntax/util/interner.rs
src/test/compile-fail/mut-pattern-mismatched.rs

9 years agoNormalize types of fields in struct literals during type-checking.
Niko Matsakis [Wed, 7 Jan 2015 23:45:36 +0000 (18:45 -0500)]
Normalize types of fields in struct literals during type-checking.
Fixes #20535.

9 years agoUpdate compile-fail test with new message that is generated as a
Niko Matsakis [Wed, 7 Jan 2015 20:32:36 +0000 (15:32 -0500)]
Update compile-fail test with new message that is generated as a
result of using `ty::type_is_sized`

9 years agoAdd rather involved run-pass test case.
Niko Matsakis [Wed, 7 Jan 2015 18:57:42 +0000 (13:57 -0500)]
Add rather involved run-pass test case.

9 years agoNormalize associated types in `with_field_tys`
Niko Matsakis [Wed, 7 Jan 2015 18:53:54 +0000 (13:53 -0500)]
Normalize associated types in `with_field_tys`

9 years agoUse ty::type_is_sized() so that we handle projection types properly.
Niko Matsakis [Wed, 7 Jan 2015 17:49:52 +0000 (12:49 -0500)]
Use ty::type_is_sized() so that we handle projection types properly.

9 years agorollup merge of #20726: dgrunwald/require-parens-for-chained-comparison
Alex Crichton [Thu, 8 Jan 2015 01:19:55 +0000 (17:19 -0800)]
rollup merge of #20726: dgrunwald/require-parens-for-chained-comparison

[Rendered RFC](https://github.com/rust-lang/rfcs/blob/master/text/0558-require-parentheses-for-chained-comparisons.md)

9 years agorollup merge of #20725: tomjakubowski/rustdoc-misc
Alex Crichton [Thu, 8 Jan 2015 01:19:51 +0000 (17:19 -0800)]
rollup merge of #20725: tomjakubowski/rustdoc-misc

Conflicts:
src/librustdoc/html/format.rs

9 years agorollup merge of #20722: alexcrichton/audit-show
Alex Crichton [Thu, 8 Jan 2015 01:18:59 +0000 (17:18 -0800)]
rollup merge of #20722: alexcrichton/audit-show

Conflicts:
src/libcollections/vec.rs
src/libcore/fmt/mod.rs
src/librustdoc/html/format.rs

9 years agorollup merge of #20716: brson/RUST_DEBUG
Alex Crichton [Thu, 8 Jan 2015 01:18:08 +0000 (17:18 -0800)]
rollup merge of #20716: brson/RUST_DEBUG

9 years agorollup merge of #20710: daboross/fix-stable-before-bracket
Alex Crichton [Thu, 8 Jan 2015 01:18:06 +0000 (17:18 -0800)]
rollup merge of #20710: daboross/fix-stable-before-bracket

This changes a line that has `\n#[stable]}` to instead have `}\n#[stable]`.

The #[stable] has been before the bracket since https://github.com/rust-lang/rust/commit/b94bcbf56eab163517e8ffc93888284b8dbb6238.

This is a (very) minor change, and I have not built this locally because of my not-so-powerful machine.

9 years agorollup merge of #20709: thiagopnts/ownership-guide-typo
Alex Crichton [Thu, 8 Jan 2015 01:18:05 +0000 (17:18 -0800)]
rollup merge of #20709: thiagopnts/ownership-guide-typo

I was reading the ownership guide and found this small typo :bowtie:

9 years agorollup merge of #20708: aturon/new-int-modules
Alex Crichton [Thu, 8 Jan 2015 01:18:01 +0000 (17:18 -0800)]
rollup merge of #20708: aturon/new-int-modules

Conflicts:
src/libserialize/lib.rs

9 years agorollup merge of #20704: alexcrichton/hopefully-make-tests-less-spurious
Alex Crichton [Thu, 8 Jan 2015 01:17:34 +0000 (17:17 -0800)]
rollup merge of #20704: alexcrichton/hopefully-make-tests-less-spurious

These tests have all been failing spuroiusly on Windows from time to time, and
one suspicion is that the shilc thread outliving the main thread somehow causes
the problem. Switch all the tests over to using Thread::scoped instead of
Thread::spawn to see if it helps the issue.

cc #19120

9 years agorollup merge of #20703: barosl/rustdoc-z-index-fallout
Alex Crichton [Thu, 8 Jan 2015 01:17:32 +0000 (17:17 -0800)]
rollup merge of #20703: barosl/rustdoc-z-index-fallout

Due to the CSS changes done by the previous patch to make the line numbers clickable (#20092), the sidebar became unclickable. This PR reverts the changes and adopts an alternative approach.

I'm very sorry for having broken things.

9 years agorollup merge of #20696: reem/unsized-typeid
Alex Crichton [Thu, 8 Jan 2015 01:17:31 +0000 (17:17 -0800)]
rollup merge of #20696: reem/unsized-typeid

This removes the needlessly constricting bound on `intrinsics::type_Id` and `TypeId::of`. Also fixes an ICE where using bounds on type parameters in extern blocks fails to resolve the used traits.

9 years agorollup merge of #20695: frewsxcv/patch-2
Alex Crichton [Thu, 8 Jan 2015 01:17:29 +0000 (17:17 -0800)]
rollup merge of #20695: frewsxcv/patch-2

This should be rollup

9 years agorollup merge of #20693: EchoAce/intro-oboe
Alex Crichton [Thu, 8 Jan 2015 01:17:27 +0000 (17:17 -0800)]
rollup merge of #20693: EchoAce/intro-oboe

Issue #20686, proposed by nstoddard.

9 years agorollup merge of #20688: jroesch/reject-non-param-bounds-followup
Alex Crichton [Thu, 8 Jan 2015 01:17:25 +0000 (17:17 -0800)]
rollup merge of #20688: jroesch/reject-non-param-bounds-followup

This is a follow up to my recent PR. r? @nikomatsakis

9 years agorollup merge of #20680: nick29581/target-word
Alex Crichton [Thu, 8 Jan 2015 01:17:23 +0000 (17:17 -0800)]
rollup merge of #20680: nick29581/target-word

Closes #20421

[breaking-change]

r? @brson

9 years agorollup merge of #20663: brson/feature-staging
Alex Crichton [Thu, 8 Jan 2015 01:17:22 +0000 (17:17 -0800)]
rollup merge of #20663: brson/feature-staging

This partially implements the feature staging described in the
[release channel RFC][rc]. It does not yet fully conform to the RFC as
written, but does accomplish its goals sufficiently for the 1.0 alpha
release.

It has three primary user-visible effects:

* On the nightly channel, use of unstable APIs generates a warning.
* On the beta channel, use of unstable APIs generates a warning.
* On the beta channel, use of feature gates generates a warning.

Code that does not trigger these warnings is considered 'stable',
modulo pre-1.0 bugs.

Disabling the warnings for unstable APIs continues to be done in the
existing (i.e. old) style, via `#[allow(...)]`, not that specified in
the RFC. I deem this marginally acceptable since any code that must do
this is not using the stable dialect of Rust.

Use of feature gates is itself gated with the new 'unstable_features'
lint, on nightly set to 'allow', and on beta 'warn'.

The attribute scheme used here corresponds to an older version of the
RFC, with the `#[staged_api]` crate attribute toggling the staging
behavior of the stability attributes, but the user impact is only
in-tree so I'm not concerned about having to make design changes later
(and I may ultimately prefer the scheme here after all, with the
`#[staged_api]` crate attribute).

Since the Rust codebase itself makes use of unstable features the
compiler and build system do a midly elaborate dance to allow it to
bootstrap while disobeying these lints (which would otherwise be
errors because Rust builds with `-D warnings`).

This patch includes one significant hack that causes a
regression. Because the `format_args!` macro emits calls to unstable
APIs it would trigger the lint.  I added a hack to the lint to make it
not trigger, but this in turn causes arguments to `println!` not to be
checked for feature gates. I don't presently understand macro
expansion well enough to fix. This is bug #20661.

Closes #16678

[rc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md

Next steps are to disable the existing out-of-tree behavior for stability attributes, and convert the remaining system to be feature-based per the RFC. During the first beta cycle we will set these lints to 'forbid'.

9 years agorollup merge of #20654: alexcrichton/stabilize-hash
Alex Crichton [Thu, 8 Jan 2015 01:17:19 +0000 (17:17 -0800)]
rollup merge of #20654: alexcrichton/stabilize-hash

This commit aims to prepare the `std::hash` module for alpha by formalizing its
current interface whileholding off on adding `#[stable]` to the new APIs.  The
current usage with the `HashMap` and `HashSet` types is also reconciled by
separating out composable parts of the design. The primary goal of this slight
redesign is to separate the concepts of a hasher's state from a hashing
algorithm itself.

The primary change of this commit is to separate the `Hasher` trait into a
`Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was
actually just a factory for various states, but hashing had very little control
over how these states were used. Additionally the old `Hasher` trait was
actually fairly unrelated to hashing.

This commit redesigns the existing `Hasher` trait to match what the notion of a
`Hasher` normally implies with the following definition:

    trait Hasher {
        type Output;
        fn reset(&mut self);
        fn finish(&self) -> Output;
    }

This `Hasher` trait emphasizes that hashing algorithms may produce outputs other
than a `u64`, so the output type is made generic. Other than that, however, very
little is assumed about a particular hasher. It is left up to implementors to
provide specific methods or trait implementations to feed data into a hasher.

The corresponding `Hash` trait becomes:

    trait Hash<H: Hasher> {
        fn hash(&self, &mut H);
    }

The old default of `SipState` was removed from this trait as it's not something
that we're willing to stabilize until the end of time, but the type parameter is
always required to implement `Hasher`. Note that the type parameter `H` remains
on the trait to enable multidispatch for specialization of hashing for
particular hashers.

Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is
simply used as part `derive` and the implementations for all primitive types.

With these definitions, the old `Hasher` trait is realized as a new `HashState`
trait in the `collections::hash_state` module as an unstable addition for
now. The current definition looks like:

    trait HashState {
        type Hasher: Hasher;
        fn hasher(&self) -> Hasher;
    }

The purpose of this trait is to emphasize that the one piece of functionality
for implementors is that new instances of `Hasher` can be created.  This
conceptually represents the two keys from which more instances of a
`SipHasher` can be created, and a `HashState` is what's stored in a
`HashMap`, not a `Hasher`.

Implementors of custom hash algorithms should implement the `Hasher` trait, and
only hash algorithms intended for use in hash maps need to implement or worry
about the `HashState` trait.

The entire module and `HashState` infrastructure remains `#[unstable]` due to it
being recently redesigned, but some other stability decision made for the
`std::hash` module are:

* The `Writer` trait remains `#[experimental]` as it's intended to be replaced
  with an `io::Writer` (more details soon).
* The top-level `hash` function is `#[unstable]` as it is intended to be generic
  over the hashing algorithm instead of hardwired to `SipHasher`
* The inner `sip` module is now private as its one export, `SipHasher` is
  reexported in the `hash` module.

And finally, a few changes were made to the default parameters on `HashMap`.

* The `RandomSipHasher` default type parameter was renamed to `RandomState`.
  This renaming emphasizes that it is not a hasher, but rather just state to
  generate hashers. It also moves away from the name "sip" as it may not always
  be implemented as `SipHasher`. This type lives in the
  `std::collections::hash_map` module as `#[unstable]`

* The associated `Hasher` type of `RandomState` is creatively called...
  `Hasher`! This concrete structure lives next to `RandomState` as an
  implemenation of the "default hashing algorithm" used for a `HashMap`. Under
  the hood this is currently implemented as `SipHasher`, but it draws an
  explicit interface for now and allows us to modify the implementation over
  time if necessary.

There are many breaking changes outlined above, and as a result this commit is
a:

[breaking-change]

9 years agorollup merge of #20611: simnalamburt/master
Alex Crichton [Thu, 8 Jan 2015 01:17:18 +0000 (17:17 -0800)]
rollup merge of #20611: simnalamburt/master

This PR fixes the issue #20460, and it doesn't touch any existing behavior except the bug of the SIMD types.

Closes #20460.

9 years agorollup merge of #20237: RustOS-Fork-Holding-Ground/master
Alex Crichton [Thu, 8 Jan 2015 01:17:15 +0000 (17:17 -0800)]
rollup merge of #20237: RustOS-Fork-Holding-Ground/master

libc is only used when the heap allocations are not defined externally, or defined in another crate. I assume these extern* configurations were added for the sake of those of us experimenting with freestanding Rust. Avoiding libc where possible is often very important for us.

9 years agoRFC 558: Require parentheses for chained comparisons
Daniel Grunwald [Thu, 8 Jan 2015 00:44:01 +0000 (01:44 +0100)]
RFC 558: Require parentheses for chained comparisons

Fixes #20724.

9 years agoallow box_syntax and unknown features in compiletest driver.
Felix S. Klock II [Thu, 8 Jan 2015 00:43:32 +0000 (01:43 +0100)]
allow box_syntax and unknown features in compiletest driver.

9 years agofix the `&mut _` patterns
Jorge Aparicio [Thu, 8 Jan 2015 00:26:00 +0000 (19:26 -0500)]
fix the `&mut _` patterns

9 years agorustdoc: Render associated type bindings
Tom Jakubowski [Thu, 8 Jan 2015 00:10:40 +0000 (16:10 -0800)]
rustdoc: Render associated type bindings

e.g. `Foo<Output=A>`

This does not work cross-crate unfortunately.

Part of #20646

9 years agoallow box_syntax and unknown features in the rustc_driver crate.
Felix S. Klock II [Thu, 8 Jan 2015 00:17:21 +0000 (01:17 +0100)]
allow box_syntax and unknown features in the rustc_driver crate.

9 years agoallow box_syntax and unknown features in the rustc_llvm crate.
Felix S. Klock II [Thu, 8 Jan 2015 00:03:46 +0000 (01:03 +0100)]
allow box_syntax and unknown features in the rustc_llvm crate.

9 years agoRemove the unneeded Sized bound on TypeId creation
Jonathan Reem [Tue, 6 Jan 2015 21:59:07 +0000 (22:59 +0100)]
Remove the unneeded Sized bound on TypeId creation

This bound is probably unintentional and is unnecessarily
constricting.

To facilitate this change, it was also necessary to modify
resolve to recurse on and resolve type parameters in extern { }
blocks. This fixes an ICE when using bounds on type parameters
during the declaration of intrinsics.

This also adds tests for TypeId on both Sized and Unsized
tests as well as a test for using type parameters and bounds
in extern { } blocks.

9 years agoallow unknown features in the log crate.
Felix S. Klock II [Wed, 7 Jan 2015 23:38:47 +0000 (00:38 +0100)]
allow unknown features in the log crate.

9 years agoSwitch to using `Box::new` in the tests in `alloc::boxed`.
Felix S. Klock II [Wed, 7 Jan 2015 22:04:12 +0000 (23:04 +0100)]
Switch to using `Box::new` in the tests in  `alloc::boxed`.

9 years agoTest that box syntax, both in expressions and patterns, is caught by
Felix S. Klock II [Wed, 7 Jan 2015 22:03:22 +0000 (23:03 +0100)]
Test that box syntax, both in expressions and patterns, is caught by
feature gate net.

fix typo in my feature-gate-box-expr.rs test.

9 years agoalternate version of coerce-match test that avoids box syntax.
Felix S. Klock II [Wed, 7 Jan 2015 21:22:11 +0000 (22:22 +0100)]
alternate version of coerce-match test that avoids box syntax.

9 years agocompile-fail tests: Add feature attributes to enable box pat/expr syntax in various...
Felix S. Klock II [Wed, 7 Jan 2015 21:35:56 +0000 (22:35 +0100)]
compile-fail tests: Add feature attributes to enable box pat/expr syntax in various tests.

9 years agorun-pass tests: Add feature attributes to enable box pat/expr syntax in various tests.
Felix S. Klock II [Wed, 7 Jan 2015 19:32:25 +0000 (20:32 +0100)]
run-pass tests: Add feature attributes to enable box pat/expr syntax in various tests.

9 years agoAllow unknown features to bootstrap rustc with box_syntax feature.
Felix S. Klock II [Wed, 7 Jan 2015 17:25:18 +0000 (18:25 +0100)]
Allow unknown features to bootstrap rustc with box_syntax feature.

Specifically added to the test, librustc_trans, librustc_typeck crates.

9 years agoAdded `box_syntax` feature gate; added to std and rustc crates for bootstrap.
Felix S. Klock II [Wed, 7 Jan 2015 14:15:34 +0000 (15:15 +0100)]
Added `box_syntax` feature gate; added to std and rustc crates for bootstrap.

To avoid using the feauture, change uses of `box <expr>` to
`Box::new(<expr>)` alternative, as noted by the feature gate message.

(Note that box patterns have no analogous trivial replacement, at
least not in general; you need to revise the code to do a partial
match, deref, and then the rest of the match.)

[breaking-change]

9 years agoremove some `slicing_syntax` feature gates
Jorge Aparicio [Wed, 7 Jan 2015 23:36:38 +0000 (18:36 -0500)]
remove some `slicing_syntax` feature gates

9 years agoremove slicing_syntax feature gate
Jorge Aparicio [Wed, 7 Jan 2015 23:28:28 +0000 (18:28 -0500)]
remove slicing_syntax feature gate

9 years agoPreliminary feature staging
Brian Anderson [Tue, 6 Jan 2015 14:26:08 +0000 (06:26 -0800)]
Preliminary feature staging

This partially implements the feature staging described in the
[release channel RFC][rc]. It does not yet fully conform to the RFC as
written, but does accomplish its goals sufficiently for the 1.0 alpha
release.

It has three primary user-visible effects:

* On the nightly channel, use of unstable APIs generates a warning.
* On the beta channel, use of unstable APIs generates a warning.
* On the beta channel, use of feature gates generates a warning.

Code that does not trigger these warnings is considered 'stable',
modulo pre-1.0 bugs.

Disabling the warnings for unstable APIs continues to be done in the
existing (i.e. old) style, via `#[allow(...)]`, not that specified in
the RFC. I deem this marginally acceptable since any code that must do
this is not using the stable dialect of Rust.

Use of feature gates is itself gated with the new 'unstable_features'
lint, on nightly set to 'allow', and on beta 'warn'.

The attribute scheme used here corresponds to an older version of the
RFC, with the `#[staged_api]` crate attribute toggling the staging
behavior of the stability attributes, but the user impact is only
in-tree so I'm not concerned about having to make design changes later
(and I may ultimately prefer the scheme here after all, with the
`#[staged_api]` crate attribute).

Since the Rust codebase itself makes use of unstable features the
compiler and build system to a midly elaborate dance to allow it to
bootstrap while disobeying these lints (which would otherwise be
errors because Rust builds with `-D warnings`).

This patch includes one significant hack that causes a
regression. Because the `format_args!` macro emits calls to unstable
APIs it would trigger the lint.  I added a hack to the lint to make it
not trigger, but this in turn causes arguments to `println!` not to be
checked for feature gates. I don't presently understand macro
expansion well enough to fix. This is bug #20661.

Closes #16678

[rc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md

9 years agostd: Tweak String implementations
Alex Crichton [Wed, 7 Jan 2015 22:58:31 +0000 (14:58 -0800)]
std: Tweak String implementations

This commit performs a pass over the implementations of the new `String` trait
in the formatting module. Some implementations were removed as a conservative
move pending an upcoming convention about `String` implementations, and some
were added in order to retain consistency across the libraries. Specifically:

* All "smart pointers" implement `String` now, adding missing implementations
  for `Arc` and `Rc`.
* The `Vec<T>` and `[T]` types no longer implement `String`.
* The `*const T` and `*mut T` type no longer implement `String`.
* The `()` type no longer implements `String`.
* The `Path` type's `Show` implementation does not surround itself with `Path
  {}` (a minor tweak).

All implementations of `String` in this PR were also marked `#[stable]` to
indicate that the types will continue to implement the `String` trait regardless
of what it looks like.

9 years agoRequire that types cannot implement both Drop and Copy.
Huon Wilson [Tue, 6 Jan 2015 23:07:56 +0000 (10:07 +1100)]
Require that types cannot implement both Drop and Copy.

Opt-in built-in traits allowed one to explicitly implement both `Drop`
and `Copy` for a type. This can theoretically make some sense, but the
current implementation means it is codegened totally incorrectly which
can lead to memory unsafety, so this feature is disabled for now.

Fixes #20126.

9 years agouse slicing sugar
Jorge Aparicio [Wed, 7 Jan 2015 16:58:31 +0000 (11:58 -0500)]
use slicing sugar

9 years agoAdd `Box::new` method. Prereq for feature-gating `box <expr>` itself.
Felix S. Klock II [Wed, 7 Jan 2015 00:10:50 +0000 (01:10 +0100)]
Add `Box::new` method.  Prereq for feature-gating `box <expr>` itself.

9 years agoFix precedence for ranges.
Nick Cameron [Wed, 7 Jan 2015 19:30:33 +0000 (08:30 +1300)]
Fix precedence for ranges.

Technically this is a

[breaking-change]

but it probably shouldn't affect your code.

Closes #20256

9 years agoShow, String, Eq impls for Ranges
Nick Cameron [Wed, 7 Jan 2015 04:21:09 +0000 (17:21 +1300)]
Show, String, Eq impls for Ranges

9 years agoregister new snapshots
Jorge Aparicio [Wed, 7 Jan 2015 21:29:48 +0000 (16:29 -0500)]
register new snapshots

9 years agomk: Remove RUST_NDEBUG and RUST_DEBUG defines. Unused
Brian Anderson [Wed, 7 Jan 2015 21:33:22 +0000 (13:33 -0800)]
mk: Remove RUST_NDEBUG and RUST_DEBUG defines. Unused

9 years agostd: Stablize the macros module
Alex Crichton [Tue, 6 Jan 2015 19:07:09 +0000 (11:07 -0800)]
std: Stablize the macros module

This commit performs a pass over the `std::macros` module, applying stability
attributes where necessary. In particular, this audits macros for patterns such
as:

* Standard use of forward-to-format-args via `$($arg:tt)*` (or `+`)
* Prevent macro-defined identifiers from leaking into expression arguments as
  hygiene is not perfectly implemented.
* Wherever possible, `$crate` is used now.

Specifically, the following actions were taken:

* The `std::macros` module itself is no longer public.
* The `panic!` macro is stable
* The `assert!` macro is stable
* The `assert_eq!` macro is stable
* The `debug_assert!` macro is stable
* The `debug_assert_eq!` macro is stable
* The `unreachable!` macro is stable after removing the extra forms to bring the
  definition in line with the `unimplemented!` macro.
* The `try!` macro is stable
* The `vec!` macro is stable

[breaking-change]

9 years agofix typo in the ownership guide
Thiago Pontes [Wed, 7 Jan 2015 20:42:15 +0000 (18:42 -0200)]
fix typo in the ownership guide

9 years agoFix #[stable] coming before } instead of after
Dabo Ross [Wed, 7 Jan 2015 20:37:07 +0000 (12:37 -0800)]
Fix #[stable] coming before } instead of after

This changes a line that has `\n#[stable]}` to instead have `}\n#[stable]`

9 years agostd: Stabilize the std::hash module
Alex Crichton [Tue, 9 Dec 2014 20:37:23 +0000 (12:37 -0800)]
std: Stabilize the std::hash module

This commit aims to prepare the `std::hash` module for alpha by formalizing its
current interface whileholding off on adding `#[stable]` to the new APIs.  The
current usage with the `HashMap` and `HashSet` types is also reconciled by
separating out composable parts of the design. The primary goal of this slight
redesign is to separate the concepts of a hasher's state from a hashing
algorithm itself.

The primary change of this commit is to separate the `Hasher` trait into a
`Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was
actually just a factory for various states, but hashing had very little control
over how these states were used. Additionally the old `Hasher` trait was
actually fairly unrelated to hashing.

This commit redesigns the existing `Hasher` trait to match what the notion of a
`Hasher` normally implies with the following definition:

    trait Hasher {
        type Output;
        fn reset(&mut self);
        fn finish(&self) -> Output;
    }

This `Hasher` trait emphasizes that hashing algorithms may produce outputs other
than a `u64`, so the output type is made generic. Other than that, however, very
little is assumed about a particular hasher. It is left up to implementors to
provide specific methods or trait implementations to feed data into a hasher.

The corresponding `Hash` trait becomes:

    trait Hash<H: Hasher> {
        fn hash(&self, &mut H);
    }

The old default of `SipState` was removed from this trait as it's not something
that we're willing to stabilize until the end of time, but the type parameter is
always required to implement `Hasher`. Note that the type parameter `H` remains
on the trait to enable multidispatch for specialization of hashing for
particular hashers.

Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is
simply used as part `derive` and the implementations for all primitive types.

With these definitions, the old `Hasher` trait is realized as a new `HashState`
trait in the `collections::hash_state` module as an unstable addition for
now. The current definition looks like:

    trait HashState {
        type Hasher: Hasher;
        fn hasher(&self) -> Hasher;
    }

The purpose of this trait is to emphasize that the one piece of functionality
for implementors is that new instances of `Hasher` can be created.  This
conceptually represents the two keys from which more instances of a
`SipHasher` can be created, and a `HashState` is what's stored in a
`HashMap`, not a `Hasher`.

Implementors of custom hash algorithms should implement the `Hasher` trait, and
only hash algorithms intended for use in hash maps need to implement or worry
about the `HashState` trait.

The entire module and `HashState` infrastructure remains `#[unstable]` due to it
being recently redesigned, but some other stability decision made for the
`std::hash` module are:

* The `Writer` trait remains `#[experimental]` as it's intended to be replaced
  with an `io::Writer` (more details soon).
* The top-level `hash` function is `#[unstable]` as it is intended to be generic
  over the hashing algorithm instead of hardwired to `SipHasher`
* The inner `sip` module is now private as its one export, `SipHasher` is
  reexported in the `hash` module.

And finally, a few changes were made to the default parameters on `HashMap`.

* The `RandomSipHasher` default type parameter was renamed to `RandomState`.
  This renaming emphasizes that it is not a hasher, but rather just state to
  generate hashers. It also moves away from the name "sip" as it may not always
  be implemented as `SipHasher`. This type lives in the
  `std::collections::hash_map` module as `#[unstable]`

* The associated `Hasher` type of `RandomState` is creatively called...
  `Hasher`! This concrete structure lives next to `RandomState` as an
  implemenation of the "default hashing algorithm" used for a `HashMap`. Under
  the hood this is currently implemented as `SipHasher`, but it draws an
  explicit interface for now and allows us to modify the implementation over
  time if necessary.

There are many breaking changes outlined above, and as a result this commit is
a:

[breaking-change]

9 years agoUpdate references to old snapshot
Aaron Turon [Wed, 7 Jan 2015 20:14:59 +0000 (12:14 -0800)]
Update references to old snapshot

9 years agoRename `target_word_size` to `target_pointer_width`
Nick Cameron [Wed, 7 Jan 2015 04:26:55 +0000 (17:26 +1300)]
Rename `target_word_size` to `target_pointer_width`

Closes #20421

[breaking-change]

9 years agoAdd isize, usize modules, deprecate int, uint modules
Aaron Turon [Wed, 7 Jan 2015 18:39:37 +0000 (10:39 -0800)]
Add isize, usize modules, deprecate int, uint modules

This PR introduces `isize` and `usize` modules to `core` and `std`, and
deprecates the existing `int` and `uint` modules. The rustdoc primitive
type links now point to these new modules.

Due to deprecation this is a:

[breaking-change]

9 years agoReject all uses of non-typaram bounds
Jared Roesch [Wed, 7 Jan 2015 09:04:08 +0000 (01:04 -0800)]
Reject all uses of non-typaram bounds

9 years agoFix warning in liballoc about unused constant MIN_ALIGN when cfg(feature = external_*)
John Ericson [Tue, 30 Dec 2014 05:13:08 +0000 (06:13 +0100)]
Fix warning in liballoc about unused constant MIN_ALIGN when cfg(feature = external_*)

9 years agoliballoc's "extern_funcs" impl mod had a duplicate and missing item
John Ericson [Fri, 26 Dec 2014 23:34:51 +0000 (00:34 +0100)]
liballoc's "extern_funcs" impl mod had a duplicate and missing item

9 years agoShorten cfg line lengths in liballoc
John Ericson [Fri, 26 Dec 2014 23:09:04 +0000 (00:09 +0100)]
Shorten cfg line lengths in liballoc

9 years agoliballoc's "external_funcs" and "external_crate" are now features
John Ericson [Fri, 26 Dec 2014 22:28:04 +0000 (23:28 +0100)]
liballoc's "external_funcs" and "external_crate" are now features

This allows the vanilla libary to built for kernel use with Cargo.

9 years agoliballoc does not need liblibc under certain configurations
John Ericson [Fri, 26 Dec 2014 00:38:07 +0000 (01:38 +0100)]
liballoc does not need liblibc under certain configurations

9 years agoAdd regression test for #20582. Fixes #20582.
Niko Matsakis [Wed, 7 Jan 2015 19:07:55 +0000 (14:07 -0500)]
Add regression test for #20582. Fixes #20582.

9 years agoBetter debug output in `decl_rust_fn`. The lack of output here has
Niko Matsakis [Wed, 7 Jan 2015 19:06:04 +0000 (14:06 -0500)]
Better debug output in `decl_rust_fn`. The lack of output here has
caused me quite a bit of hair-pulling.

9 years agoSolve rather subtle bug in `replace_late_bound_regions` -- we were passing the debrui...
Niko Matsakis [Wed, 7 Jan 2015 19:05:32 +0000 (14:05 -0500)]
Solve rather subtle bug in `replace_late_bound_regions` -- we were passing the debruijn index in so that callees could construct late-bound regions at the right depth, but then the result was cached. When the cached result was used, it might be at the wrong depth.  So now we don't pass the result in and instead simply adjust the depth to match the current nesting level as we go.

9 years agoUse the `erase_regions` helper within trans in deference to
Niko Matsakis [Wed, 7 Jan 2015 19:04:37 +0000 (14:04 -0500)]
Use the `erase_regions` helper within trans in deference to
`ty_fold::erase_regions`; also erase regions whenever we normalize
associated types.

9 years agoRename common::normalize to common::erase_regions
Niko Matsakis [Wed, 7 Jan 2015 14:36:11 +0000 (09:36 -0500)]
Rename common::normalize to common::erase_regions

9 years agoRemove assertion that substitutions are erased. It'd be nice if they
Niko Matsakis [Wed, 7 Jan 2015 18:59:02 +0000 (13:59 -0500)]
Remove assertion that substitutions are erased. It'd be nice if they
always were but it's dang annoying to weed out all the places that
fail to meet the assertion, and it doesn't really hurt things if we don't
always get it right.

9 years agoNormalize associated types in various parts of `adt`
Niko Matsakis [Wed, 7 Jan 2015 18:58:27 +0000 (13:58 -0500)]
Normalize associated types in various parts of `adt`

9 years agoRegister new snapshots
Alex Crichton [Wed, 7 Jan 2015 18:27:52 +0000 (10:27 -0800)]
Register new snapshots

9 years agoFix rustdoc fallout from #20092
Barosl Lee [Wed, 7 Jan 2015 18:10:02 +0000 (03:10 +0900)]
Fix rustdoc fallout from #20092

Due to the CSS changes done by the previous patch to make the line
numbers clickable (#20092), the sidebar became unclickable. This commit
reverts the changes and adopts an alternative approach.

9 years agotest: Move some tests to scoped instead of spawn
Alex Crichton [Wed, 7 Jan 2015 17:22:06 +0000 (09:22 -0800)]
test: Move some tests to scoped instead of spawn

These tests have all been failing spuroiusly on Windows from time to time, and
one suspicion is that the shilc thread outliving the main thread somehow causes
the problem. Switch all the tests over to using Thread::scoped instead of
Thread::spawn to see if it helps the issue.

cc #19120

9 years agoauto merge of #20655 : nikomatsakis/rust/carl-ice, r=aturon
bors [Wed, 7 Jan 2015 17:45:11 +0000 (17:45 +0000)]
auto merge of #20655 : nikomatsakis/rust/carl-ice, r=aturon

Remember to check the name of the associated type being projected when searching the environment. Fixes #20651.