Commit Graph

36608 Commits

Author SHA1 Message Date
Alex Crichton
5d342acba2 rollup merge of #20709: thiagopnts/ownership-guide-typo
I was reading the ownership guide and found this small typo :bowtie:
2015-01-07 17:18:05 -08:00
Alex Crichton
dd38f46d71 rollup merge of #20708: aturon/new-int-modules
Conflicts:
	src/libserialize/lib.rs
2015-01-07 17:18:01 -08:00
Alex Crichton
b21a0cee19 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
2015-01-07 17:17:34 -08:00
Alex Crichton
188bfbfd5d 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.
2015-01-07 17:17:32 -08:00
Alex Crichton
f257848992 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.
2015-01-07 17:17:31 -08:00
Alex Crichton
cedaf4696f rollup merge of #20695: frewsxcv/patch-2
This should be rollup
2015-01-07 17:17:29 -08:00
Alex Crichton
5b1a285b73 rollup merge of #20693: EchoAce/intro-oboe
Issue #20686, proposed by nstoddard.
2015-01-07 17:17:27 -08:00
Alex Crichton
3800f6417b rollup merge of #20688: jroesch/reject-non-param-bounds-followup
This is a follow up to my recent PR. r? @nikomatsakis
2015-01-07 17:17:25 -08:00
Alex Crichton
6301c7878e rollup merge of #20680: nick29581/target-word
Closes #20421

[breaking-change]

r? @brson
2015-01-07 17:17:23 -08:00
Alex Crichton
f3b67afcab 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'.
2015-01-07 17:17:22 -08:00
Alex Crichton
8bf3ee7c5c 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]
2015-01-07 17:17:19 -08:00
Alex Crichton
b1c23f6d25 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.
2015-01-07 17:17:18 -08:00
Alex Crichton
ebe8411874 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.
2015-01-07 17:17:15 -08:00
Jonathan Reem
2606f99871 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.
2015-01-08 00:49:19 +01:00
Brian Anderson
c27133e2ce 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
2015-01-07 15:34:56 -08:00
Thiago Pontes
9fcf097648 fix typo in the ownership guide 2015-01-07 18:42:15 -02:00
Alex Crichton
511f0b8a3d 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]
2015-01-07 12:18:08 -08:00
Aaron Turon
321d9ddff2 Update references to old snapshot 2015-01-07 12:14:59 -08:00
Nick Cameron
dd3e89aaf2 Rename target_word_size to target_pointer_width
Closes #20421

[breaking-change]
2015-01-08 09:07:55 +13:00
Aaron Turon
7deb9abd1b 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]
2015-01-07 11:40:11 -08:00
Jared Roesch
120a52034d Reject all uses of non-typaram bounds 2015-01-07 11:27:36 -08:00
John Ericson
b1b4bc90b8 Fix warning in liballoc about unused constant MIN_ALIGN when cfg(feature = external_*) 2015-01-07 19:22:22 +00:00
John Ericson
ea9d5c9653 liballoc's "extern_funcs" impl mod had a duplicate and missing item 2015-01-07 19:19:01 +00:00
John Ericson
2b84e44b07 Shorten cfg line lengths in liballoc 2015-01-07 19:19:01 +00:00
John Ericson
efaa43ade5 liballoc's "external_funcs" and "external_crate" are now features
This allows the vanilla libary to built for kernel use with Cargo.
2015-01-07 19:19:00 +00:00
John Ericson
f67a7227b7 liballoc does not need liblibc under certain configurations 2015-01-07 19:18:59 +00:00
Alex Crichton
b53e9f17d3 Register new snapshots 2015-01-07 10:27:52 -08:00
Barosl Lee
29ff43bbbb 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.
2015-01-08 03:10:02 +09:00
Alex Crichton
99b39cc98e 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
2015-01-07 10:06:27 -08:00
bors
9f1ead8fad 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.
2015-01-07 17:45:11 +00:00
Niko Matsakis
ea441e16b4 Remember to check the name of the associated type being projected when searching the environment. Fixes #20651. 2015-01-07 11:24:50 -05:00
bors
2a8cb678e6 Merge pull request #20689 from huonw/editor-_size
Update editor syntax files for isize/usize.

Reviewed-by: nikomatsakis
2015-01-07 15:35:34 +00:00
bors
f7105bfade Merge pull request #20682 from sfackler/fix-impls
Fix JS error

Reviewed-by: alexcrichton
2015-01-07 15:35:33 +00:00
bors
847bb37515 Merge pull request #20679 from geekcraik/master
unused variable 'i'

Reviewed-by: sfackler
2015-01-07 15:35:31 +00:00
bors
eb02f2d7e5 Merge pull request #20675 from jbcrail/fix-test-comments
Fix misspelled comments in tests.

Reviewed-by: steveklabnik
2015-01-07 15:35:30 +00:00
bors
c0216c8945 Merge pull request #20674 from jbcrail/fix-misspelled-comments
Fix misspelled comments.

Reviewed-by: steveklabnik
2015-01-07 15:35:30 +00:00
bors
7377c0b1a9 Merge pull request #20672 from vrana/patch-3
Fix a typo in guide

Reviewed-by: steveklabnik
2015-01-07 15:35:28 +00:00
bors
5064c8d9dc Merge pull request #20670 from vrana/patch-2
Fix type annotation in guide

Reviewed-by: steveklabnik
2015-01-07 15:35:27 +00:00
bors
2e2a2cdb59 Merge pull request #20669 from vrana/patch-1
Use a better word in the guide

Reviewed-by: steveklabnik
2015-01-07 15:35:26 +00:00
Corey Farwell
4f801c433f Bump copyright year in doc footer 2015-01-07 09:23:31 -05:00
FakeKane
da83e4d98a oboe removed 2015-01-07 09:09:37 -05:00
bors
dfd557bd73 auto merge of #20606 : alexcrichton/rust/stabilize-libc, r=brson
This commit prepares the liblibc library to be moved to crates.io. Unlike the
log, serialize, term, etc crates, the source for this crate will *not* be
duplicated out-of-tree. Instead a new rust-lang/libc repository will be created
with a submodule to this repository and it will use the source directly.

In order to compile within the stable ecosystem of Rust, this crate cannot link
to libcore, and it also needs some tweaks for the other attributes that it has.
As a result this commit tweaks the source of the crate to link to libcore when
built in tree but link to libstd when built via cargo.

Note that the rust-lang/libc crate isn't quite prepared just yet, there's a
Cargo bug or two that I'd like to iron out before publishing it. This is simply
preparing the in-tree source.
2015-01-07 12:25:15 +00:00
Huon Wilson
6c7291ece4 Update editor syntax files for isize/usize.
Yay, syntax highlighting.
2015-01-07 20:19:58 +11:00
Alex Crichton
01ce6efd85 libc: Prepare for movement to crates.io
This commit prepares the liblibc library to be moved to crates.io. Unlike the
log, serialize, term, etc crates, the source for this crate will *not* be
duplicated out-of-tree. Instead a new rust-lang/libc repository will be created
with a submodule to this repository and it will use the source directly.

In order to compile within the stable ecosystem of Rust, this crate cannot link
to libcore, and it also needs some tweaks for the other attributes that it has.
As a result this commit tweaks the source of the crate to link to libcore when
built in tree but link to libstd when built via cargo.

Note that the rust-lang/libc crate isn't quite prepared just yet, there's a
Cargo bug or two that I'd like to iron out before publishing it. This is simply
preparing the in-tree source.
2015-01-07 00:43:49 -08:00
bors
a3a16e9610 auto merge of #20620 : brson/rust/relnotes, r=huonw
A whole lot happened this cycle. I tried to highlight the best stuff. Please review and note important stuff I'm missing or foolish mistakes.
2015-01-07 08:32:46 +00:00
Brian Anderson
9d8de1f42c Sync -> Send 2015-01-06 22:16:34 -08:00
Brian Anderson
ef6126a495 Merge pull request #25 from aturon/relnotes-updates
Add int discussion, tweak wording
2015-01-06 22:15:10 -08:00
bors
9e4e524e0e auto merge of #20677 : alexcrichton/rust/rollup, r=alexcrichton 2015-01-07 05:31:23 +00:00
Alex Crichton
a64000820f More test fixes 2015-01-06 21:26:48 -08:00
Aaron Turon
a63bb9ba7f Add int discussion, tweak wording 2015-01-06 20:53:55 -08:00