]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agolibstd: Remove all uses of `~str` from `libstd`
Patrick Walton [Tue, 20 May 2014 00:23:26 +0000 (17:23 -0700)]
libstd: Remove all uses of `~str` from `libstd`

10 years agolibtime: Remove the `tz_zone` field from times.
Patrick Walton [Tue, 20 May 2014 00:06:54 +0000 (17:06 -0700)]
libtime: Remove the `tz_zone` field from times.

It depends on `~str`.

10 years agolibstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.
Patrick Walton [Fri, 16 May 2014 17:45:16 +0000 (10:45 -0700)]
libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.

10 years agoauto merge of #14350 : zwarich/rust/let-suggestion, r=pcwalton
bors [Thu, 22 May 2014 20:31:24 +0000 (13:31 -0700)]
auto merge of #14350 : zwarich/rust/let-suggestion, r=pcwalton

10 years agoauto merge of #14346 : alexcrichton/rust/rustdoc-external-crates, r=pcwalton
bors [Thu, 22 May 2014 17:31:25 +0000 (10:31 -0700)]
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.

10 years agorustdoc: Fill in external trait methods
Alex Crichton [Sat, 3 May 2014 09:08:58 +0000 (02:08 -0700)]
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.

10 years agoauto merge of #14354 : EdorianDark/rust/master, r=huonw
bors [Thu, 22 May 2014 15:51:20 +0000 (08:51 -0700)]
auto merge of #14354 : EdorianDark/rust/master, r=huonw

It seemed to me, that [T] was deprecated and i am trying to help.

10 years agoauto merge of #14349 : richo/rust/docs/win64_calling_convention, r=alexcrichton
bors [Thu, 22 May 2014 14:16:22 +0000 (07:16 -0700)]
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

10 years agoauto merge of #14335 : tbu-/rust/pr_doc_strsplit, r=pnkfelix
bors [Thu, 22 May 2014 12:26:22 +0000 (05:26 -0700)]
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.

10 years agoRemove allow(deprecated_owned_vector) lint
Dirk Leifeld [Thu, 22 May 2014 11:19:44 +0000 (13:19 +0200)]
Remove allow(deprecated_owned_vector) lint

10 years agoauto merge of #14345 : alexcrichton/rust/rustdoc-many-impls, r=pcwalton
bors [Thu, 22 May 2014 09:51:21 +0000 (02:51 -0700)]
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.

10 years agoauto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichton
bors [Thu, 22 May 2014 08:06:25 +0000 (01:06 -0700)]
auto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichton

10 years agodocs: Add win64 calling convention
Richo Healey [Thu, 22 May 2014 04:22:58 +0000 (21:22 -0700)]
docs: Add win64 calling convention

10 years agoauto merge of #14321 : alexcrichton/rust/ices, r=pcwalton
bors [Thu, 22 May 2014 06:31:27 +0000 (23:31 -0700)]
auto merge of #14321 : alexcrichton/rust/ices, r=pcwalton

Also adding tests for fixed ICEs

10 years agoAdd a suggestion to use a `let` binding on some borrowck errors.
Cameron Zwarich [Thu, 22 May 2014 04:44:49 +0000 (21:44 -0700)]
Add a suggestion to use a `let` binding on some borrowck errors.

10 years agoauto merge of #14307 : kballard/rust/vim_prelude_mutablecloneablevector, r=cmr
bors [Thu, 22 May 2014 03:11:27 +0000 (20:11 -0700)]
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.

10 years agoauto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brson
bors [Thu, 22 May 2014 00:31:29 +0000 (17:31 -0700)]
auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brson

This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.

10 years agorustdoc: Show types for traits across crates
Alex Crichton [Wed, 21 May 2014 23:41:58 +0000 (16:41 -0700)]
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.

10 years agostd,green: Mark some queue types as NoShare
Alex Crichton [Wed, 21 May 2014 01:54:31 +0000 (18:54 -0700)]
std,green: Mark some queue types as NoShare

10 years agoalter `exchange_free` for sized deallocation
Daniel Micay [Wed, 21 May 2014 04:18:10 +0000 (00:18 -0400)]
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`.

10 years agomigrate from `exchange_malloc` to `allocate`
Daniel Micay [Wed, 21 May 2014 03:43:18 +0000 (23:43 -0400)]
migrate from `exchange_malloc` to `allocate`

This is now only used internally by the compiler.

10 years agoauto merge of #14334 : brson/rust/deoxidize, r=alexcrichton
bors [Wed, 21 May 2014 20:11:28 +0000 (13:11 -0700)]
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.

10 years agoauto merge of #14328 : Sawyer47/rust/remove-fixmes, r=alexcrichton
bors [Wed, 21 May 2014 18:36:29 +0000 (11:36 -0700)]
auto merge of #14328 : Sawyer47/rust/remove-fixmes, r=alexcrichton

10 years agoAdd examples for edge cases of str.split/str.splitn
Tobias Bucher [Wed, 21 May 2014 18:05:55 +0000 (20:05 +0200)]
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.

10 years agomk: Replace 'oxidize' with 'rustc'. Closes #13781
Brian Anderson [Wed, 21 May 2014 05:14:38 +0000 (22:14 -0700)]
mk: Replace 'oxidize' with 'rustc'. Closes #13781

10 years agoauto merge of #14320 : kballard/rust/fix_stdlib_inject_attrs, r=alexcrichton
bors [Wed, 21 May 2014 16:46:27 +0000 (09:46 -0700)]
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.

10 years agorustc: Fix an ICE with box-placement syntax
Alex Crichton [Wed, 21 May 2014 05:39:14 +0000 (22:39 -0700)]
rustc: Fix an ICE with box-placement syntax

Closes #14084

10 years agorustc: Turn a Box ICE into an error
Alex Crichton [Wed, 21 May 2014 05:07:45 +0000 (22:07 -0700)]
rustc: Turn a Box ICE into an error

Closes #14092

10 years agoauto merge of #14326 : huonw/rust/tiny-fixes, r=pnkfelix
bors [Wed, 21 May 2014 15:06:27 +0000 (08:06 -0700)]
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.

10 years agoRemove two outdated FIXMEs from complex.rs
Piotr Jawniak [Wed, 21 May 2014 14:04:35 +0000 (16:04 +0200)]
Remove two outdated FIXMEs from complex.rs

10 years agoauto merge of #14324 : zecozephyr/rust/docfix, r=luqmana
bors [Wed, 21 May 2014 13:21:25 +0000 (06:21 -0700)]
auto merge of #14324 : zecozephyr/rust/docfix, r=luqmana

10 years agorustc: improve error messages from wrong --pretty flowgraph use.
Huon Wilson [Wed, 21 May 2014 12:21:11 +0000 (22:21 +1000)]
rustc: improve error messages from wrong --pretty flowgraph use.

This defers to .fatal and .span_fatal for errors (rather than `fail!`
which prints the ICE message). It also adds the span lookup when an id
doesn't correspond to a block, to show what it is pointing at.

It also makes the argument parser slightly looser, so that passing
`--pretty flowgraph` recognises the `flowgraph` part and suggests to use
an integer.

10 years agorustc: ng -> gn, fix a typo in a string.
Huon Wilson [Wed, 21 May 2014 11:53:41 +0000 (21:53 +1000)]
rustc: ng -> gn, fix a typo in a string.

10 years agorustc: rename the lint `level` enum for style.
Huon Wilson [Wed, 21 May 2014 11:50:37 +0000 (21:50 +1000)]
rustc: rename the lint `level` enum for style.

CamelCase all the way!

10 years agoauto merge of #14319 : kballard/rust/rename_rng_choose_option, r=alexcrichton
bors [Wed, 21 May 2014 11:26:23 +0000 (04:26 -0700)]
auto merge of #14319 : kballard/rust/rename_rng_choose_option, r=alexcrichton

Rng.choose() is used so rarely that it doesn't necessitate having two
methods, especially since the failing, non-option variant also requires
Clone.

[breaking-change]

10 years agoUpdated doc with correct type.
Jonathan Bailey [Wed, 21 May 2014 09:48:23 +0000 (02:48 -0700)]
Updated doc with correct type.

10 years agoauto merge of #14316 : kballard/rust/range_inclusive_no_toprimitive, r=alexcrichton
bors [Wed, 21 May 2014 09:46:23 +0000 (02:46 -0700)]
auto merge of #14316 : kballard/rust/range_inclusive_no_toprimitive, r=alexcrichton

10 years agoauto merge of #14315 : kballard/rust/stdreader_isatty, r=alexcrichton
bors [Wed, 21 May 2014 08:11:25 +0000 (01:11 -0700)]
auto merge of #14315 : kballard/rust/stdreader_isatty, r=alexcrichton

StdWriter has .isatty(). StdReader can trivially vend the same function,
and someone asked today on IRC how to call isatty() on stdin.

10 years agoauto merge of #14259 : alexcrichton/rust/core-mem, r=brson
bors [Wed, 21 May 2014 06:31:30 +0000 (23:31 -0700)]
auto merge of #14259 : alexcrichton/rust/core-mem, r=brson

Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.

10 years agocore: Stabilize the mem module
Alex Crichton [Sat, 17 May 2014 07:56:00 +0000 (00:56 -0700)]
core: Stabilize the mem module

Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.

[breaking-change]

10 years agoChange std inject attributes to outer attributes
Kevin Ballard [Wed, 21 May 2014 04:25:42 +0000 (21:25 -0700)]
Change std inject attributes to outer attributes

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.

10 years agotest: Add test for fixed issue #12796
Alex Crichton [Wed, 21 May 2014 04:47:12 +0000 (21:47 -0700)]
test: Add test for fixed issue #12796

Doesn't close #12796 because the error message is awful.

10 years agotest: Add a test for fixed issue #12567
Alex Crichton [Wed, 21 May 2014 04:44:22 +0000 (21:44 -0700)]
test: Add a test for fixed issue #12567

Closes #12567

10 years agorustc: Avoid an unwrap() in check_match
Alex Crichton [Wed, 21 May 2014 04:42:30 +0000 (21:42 -0700)]
rustc: Avoid an unwrap() in check_match

Closes #12369

10 years agoauto merge of #14293 : alexcrichton/rust/weak-lang-items, r=brson
bors [Wed, 21 May 2014 04:36:25 +0000 (21:36 -0700)]
auto merge of #14293 : alexcrichton/rust/weak-lang-items, r=brson

This commit is part of the ongoing libstd facade efforts (cc #13851). The
compiler now recognizes some language items as "extern { fn foo(...); }" and
will automatically perform the following actions:

1. The foreign function has a pre-defined name.
2. The crate and downstream crates can only be built as rlibs until a crate
   defines the lang item itself.
3. The actual lang item has a pre-defined name.

This is essentially nicer compiler support for the hokey
core-depends-on-std-failure scheme today, but it is implemented the same way.
The details are a little more hidden under the covers.

In addition to failure, this commit promotes the eh_personality and
rust_stack_exhausted functions to official lang items. The compiler can generate
calls to these functions, causing linkage errors if they are left undefined. The
checking for these items is not as precise as it could be. Crates compiling with
`-Z no-landing-pads` will not need the eh_personality lang item, and crates
compiling with no split stacks won't need the stack exhausted lang item. For
ease, however, these items are checked for presence in all final outputs of the
compiler.

It is quite easy to define dummy versions of the functions necessary:

    #[lang = "stack_exhausted"]
    extern fn stack_exhausted() { /* ... */ }

    #[lang = "eh_personality"]
    extern fn eh_personality() { /* ... */ }

cc #11922, rust_stack_exhausted is now a lang item
cc #13851, libcollections is blocked on eh_personality becoming weak

10 years agorustc: Avoid out of bounds in check_match
Alex Crichton [Wed, 21 May 2014 04:34:10 +0000 (21:34 -0700)]
rustc: Avoid out of bounds in check_match

Closes #12116

10 years agotest: Add a test for fixed issue #11844
Alex Crichton [Wed, 21 May 2014 04:25:49 +0000 (21:25 -0700)]
test: Add a test for fixed issue #11844

Closes #11844

10 years agotest: Add test for fixed issue #11736
Alex Crichton [Wed, 21 May 2014 04:24:01 +0000 (21:24 -0700)]
test: Add test for fixed issue #11736

Closes #11736

10 years agotest: Add a test for fixed issue #10763
Alex Crichton [Wed, 21 May 2014 04:11:28 +0000 (21:11 -0700)]
test: Add a test for fixed issue #10763

Closes #10763

10 years agorustc: Fix a dynamic borrow error in resolve
Alex Crichton [Wed, 21 May 2014 04:00:56 +0000 (21:00 -0700)]
rustc: Fix a dynamic borrow error in resolve

Closes #8208
Closes #10980

10 years agoRemove Rng.choose(), rename Rng.choose_option() to .choose()
Kevin Ballard [Wed, 21 May 2014 03:44:45 +0000 (20:44 -0700)]
Remove Rng.choose(), rename Rng.choose_option() to .choose()

Rng.choose() is used so rarely that it doesn't necessitate having two
methods, especially since the failing, non-option variant also requires
Clone.

[breaking-change]

10 years agorustc: Prevant an out of bounds access in typeck
Alex Crichton [Wed, 21 May 2014 03:39:15 +0000 (20:39 -0700)]
rustc: Prevant an out of bounds access in typeck

Closes #7092

10 years agosyntax: Parse global paths in patterns
Alex Crichton [Wed, 21 May 2014 03:28:00 +0000 (20:28 -0700)]
syntax: Parse global paths in patterns

Closes #6449

10 years agoRemove useless ToPrimitive bound on range_inclusive()
Kevin Ballard [Wed, 21 May 2014 03:27:34 +0000 (20:27 -0700)]
Remove useless ToPrimitive bound on range_inclusive()

10 years agoAdd .isatty() method to StdReader
Kevin Ballard [Wed, 21 May 2014 03:04:16 +0000 (20:04 -0700)]
Add .isatty() method to StdReader

StdWriter has .isatty(). StdReader can trivially vend the same function,
and someone asked today on IRC how to call isatty() on stdin.

10 years agoauto merge of #13823 : pnkfelix/rust/fsk-fix-13805, r=alexcrichton
bors [Wed, 21 May 2014 02:16:15 +0000 (19:16 -0700)]
auto merge of #13823 : pnkfelix/rust/fsk-fix-13805, r=alexcrichton

Make configure script respect (and save) values for `CC`, `CXX`, `CFLAGS` etc.

I mostly tried to remain backwards compatible with old invocations of
the `configure` script; if you do not want to use `CC` et al., you
should not have to; you can keep using `--enable-clang` and/or
`--enable-ccache`.

The overall intention is to capture the following precedences for
guessing the C compiler:

 1. Value of `CC` at `make` invocation time.
 2. Value of `CC` at `configure` invocation time.
 3. Compiler inferred at configure invocation time (`gcc` or `clang`).

The strategy is to check (at `configure` time) if each of the
environment variables is set, and if so, save its value in a
corresponding `CFG_` variable (e.g. `CFG_CC`).

The `configure` script also does not attempt to infer the compiler if
`CC` is set; but if `--enable-clang` was passed, then it *does* still
attempt to validate that the clang version is compatible.

Then, in the makefiles, if `CC` is not set but `CFG_CC` is, then we
use the `CFG_CC` setting as `CC`.

Fix #13805.

10 years agogreen: Remove some unsafe code in BasicLoop
Alex Crichton [Wed, 21 May 2014 01:51:29 +0000 (18:51 -0700)]
green: Remove some unsafe code in BasicLoop

10 years agoauto merge of #14305 : tbu-/rust/pr_doc_bytes, r=huonw
bors [Wed, 21 May 2014 00:36:18 +0000 (17:36 -0700)]
auto merge of #14305 : tbu-/rust/pr_doc_bytes, r=huonw

Only an example was needed, as the ability to write uints into the string is
already mentioned.

Fix #7102.

10 years agoauto merge of #13975 : nikomatsakis/rust/issue-13794-fn-subtyping-and-static, r=pnkfelix
bors [Tue, 20 May 2014 22:41:20 +0000 (15:41 -0700)]
auto merge of #13975 : nikomatsakis/rust/issue-13794-fn-subtyping-and-static, r=pnkfelix

Tweak region inference to ignore constraints like `'a <= 'static`, since they
have no value. This also ensures that we can handle some obscure cases of fn
subtyping with bound regions that we didn't used to handle correctly.

Fixes #13974.

10 years agovim: Handle box expressions specially
Kevin Ballard [Tue, 20 May 2014 21:11:07 +0000 (14:11 -0700)]
vim: Handle box expressions specially

Attempt to highlight the placement expression in a `box (expr) foo`
expression. Also treat GC as a keyword within the placement expression.

This doesn't work correctly for arbitrary expressions. Notably, this
makes no attempt at balancing delimiters. I believe handling that will
require rewriting the syntax rules to add a region for every pair of
delimiters. That may be a desirable thing to do in the end, because we
can then rewrite our indent rules based on the syntax and get rid of
cindent(), but for the time being, we'll just live with the limitation.

10 years agoAdd non-utf8 byte to the bytes!() example
Tobias Bucher [Tue, 20 May 2014 20:53:30 +0000 (22:53 +0200)]
Add non-utf8 byte to the bytes!() example

Only an example was needed, as the ability to write uints into the string is
already mentioned.

Fix #7102.

10 years agoUpdate rust.vim for the latest prelude/keywords
Kevin Ballard [Tue, 20 May 2014 20:24:16 +0000 (13:24 -0700)]
Update rust.vim for the latest prelude/keywords

10 years agoauto merge of #14304 : brson/rust/moredocs, r=kballard
bors [Tue, 20 May 2014 20:21:18 +0000 (13:21 -0700)]
auto merge of #14304 : brson/rust/moredocs, r=kballard

Includes module docs for `cell`.

10 years agoMake configure respect (and save) values for `CC`, `CXX`, `CFLAGS`, etc.
Felix S. Klock II [Mon, 28 Apr 2014 16:57:26 +0000 (18:57 +0200)]
Make configure respect (and save) values for `CC`, `CXX`, `CFLAGS`, etc.

I mostly tried to remain backwards compatible with old invocations of
the `configure` script; if you do not want to use `CC` et al., you
should not have to; you can keep using `--enable-clang` and/or
`--enable-ccache`.

The overall intention is to capture the following precedences for
guessing the C compiler:

 1. Value of `CC` at make invocation time.
 2. Value of `CC` at configure invocation time.
 3. Compiler inferred at configure invocation time (`gcc` or `clang`).

The strategy is to check (at `configure` time) if each of the
environment variables is set, and if so, save its value in a
corresponding `CFG_` variable (e.g. `CFG_CC`).

Then, in the makefiles, if `CC` is not set but `CFG_CC` is, then we
use the `CFG_CC` setting as `CC`.

Also, I fold the potential user-provided `CFLAGS` and `CXXFLAGS`
values into all of the per-platform `CFLAGS` and `CXXFLAGS` settings.
(This was opposed to adding `$(CFLAGS)` in an ad-hoc manner to various
parts of the mk files.)

Fix #13805.

----

Note that if you try to set the compiler to clang via the `CC` and
`CXX` environment variables, you will probably need to also set
`CXXFLAGS` to `--enable-libcpp` so that LLVM will be configured
properly.

----

Introduce CFG_USING_CLANG, which is distinguished from
CFG_ENABLE_CLANG because the former represents "we think we're using
clang, choose appropriate warning-control options" while the latter
represents "we asked configure (or the host required) that we attempt
to use clang, so check that we have an appropriate version of clang."

The main reason I added this is that I wanted to allow the user to
choose clang via setting the `CC` environment variable, but I did not
want that method of selection to get confused with the user passing
the `--enable-clang` option.

----

A digression: The `configure` script does not infer the compiler
setting if `CC` is set; but if `--enable-clang` was passed, then it
*does* still attempt to validate that the clang version is compatible.

Supporting this required revising `CLANG_VERSION` check to be robust
in face of user-provided `CC` value.

In particular, on Travis, the `CC` is set to `gcc` and so the natural
thing to do is to attempt to use `gcc` as the compiler, but Travis is
also passing `--enable-clang` to configure.  So, what is the right
answer in the face of these contradictory requests?

One approach would be to have `--enable-clang` supersede the setting
for `CC` (and instead just call whatever we inferred for `CFG_CLANG`).
That sounds maximally inflexible to me (pnkfelix): a developer
requesting a `CC` value probably wants it respected, and should be
able to set it to something else; it is harder for that developer to
hack our configure script to change its inferred path to clang.

A second approach would be to blindly use the `CC` value but keep
going through the clang version check when `--enable-clang` is turned
on.  But on Travis (a Linux host), the `gcc` invocation won't print a
clang version, so we would not get past the CLANG_VERSION check in
that context.

A third approach would be to never run the CLANG_VERSION check if `CC`
is explicitly set.  That is not a terrible idea; but if the user uses
`CC` to pass in a path to some other version of clang that they want
to test, probably should still send that through the `CLANG_VERSION`
check.

So in the end I (pnkfelix) took a fourth approach: do the
CLANG_VERSION check if `CC` is unset *or* if `CC` is set to a string
ending with `clang`.  This way setting `CC` to things like
`path/to/clang` or `ccache clang` will still go through the
CLANG_VERSION check, while setting `CC` to `gcc` or some unknown
compiler will skip the CLANG_VERSION check (regardless of whether the
user passed --enable-clang to `configure`).

----

Drive-by fixes:

* The call that sets `CFG_CLANG_VERSION` was quoting `"$CFG_CC"` in
  its invocation, but that does not play nicely with someone who sets
  `$CFG_CC` to e.g. `ccache clang`, since you do not want to intepret
  that whole string as a command.

  (On the other hand, a path with spaces might need the quoted
  invocation.  Not sure which one of these corner use-cases is more
  important to support.)

* Fix chk_cc error message to point user at `gcc` not `cc`.

10 years agoAdd slice::MutableCloneableVector to the prelude
Kevin Ballard [Tue, 20 May 2014 19:12:44 +0000 (12:12 -0700)]
Add slice::MutableCloneableVector to the prelude

Every other trait in slice is in the prelude, so it makes sense to
provide MutableCloneableVector as well.

10 years agoauto merge of #14283 : Ryman/rust/commented_compile_fail_error, r=kballard
bors [Tue, 20 May 2014 18:46:24 +0000 (11:46 -0700)]
auto merge of #14283 : Ryman/rust/commented_compile_fail_error, r=kballard

Edit: This now only covers refactoring to regex.

10 years agoAddress review comments
Brian Anderson [Tue, 20 May 2014 18:39:40 +0000 (11:39 -0700)]
Address review comments

10 years agocore: Convert TODOs to FIXMEs
Brian Anderson [Tue, 20 May 2014 17:40:14 +0000 (10:40 -0700)]
core: Convert TODOs to FIXMEs

10 years agostd: Alphabetize crate reexports for rustdoc
Brian Anderson [Tue, 20 May 2014 17:38:05 +0000 (10:38 -0700)]
std: Alphabetize crate reexports for rustdoc

10 years agocore: Spruce up the crate description
Brian Anderson [Tue, 20 May 2014 04:53:00 +0000 (21:53 -0700)]
core: Spruce up the crate description

10 years agocore: More concise description for mod ops
Brian Anderson [Tue, 20 May 2014 04:52:24 +0000 (21:52 -0700)]
core: More concise description for mod ops

10 years agostd: Fix broken link
Brian Anderson [Tue, 20 May 2014 04:51:21 +0000 (21:51 -0700)]
std: Fix broken link

10 years agocore: Improve docs for cell
Brian Anderson [Mon, 19 May 2014 04:47:51 +0000 (21:47 -0700)]
core: Improve docs for cell

10 years agocompiletest: Refactor compile-fail to regex.
Kevin Butler [Tue, 20 May 2014 17:15:34 +0000 (18:15 +0100)]
compiletest: Refactor compile-fail to regex.

10 years agoauto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton
bors [Tue, 20 May 2014 17:11:20 +0000 (10:11 -0700)]
auto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton

The grammar for use declarations was outdated. Corrected some other mistakes.

10 years agoCorrect EBNF grammar in the manual
Piotr Czarnecki [Tue, 20 May 2014 13:50:03 +0000 (15:50 +0200)]
Correct EBNF grammar in the manual

The grammar for use declarations was outdated.

10 years agoauto merge of #14296 : kballard/rust/diagnostic_color_newline, r=alexcrichton
bors [Tue, 20 May 2014 06:41:20 +0000 (23:41 -0700)]
auto merge of #14296 : kballard/rust/diagnostic_color_newline, r=alexcrichton

When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.

10 years agoauto merge of #14289 : TyOverby/rust/master, r=alexcrichton
bors [Tue, 20 May 2014 05:01:21 +0000 (22:01 -0700)]
auto merge of #14289 : TyOverby/rust/master, r=alexcrichton

Closes #14278.

Previously the type signatures of the ordering functions in `core::iter::order` took two iterators, but only if they were the same type of iterator.  This commit loosens that restriction and allows different kinds of iterators (but with the same type of elements) to be compared.

10 years agoauto merge of #14265 : Ryman/rust/issue-14254, r=alexcrichton
bors [Tue, 20 May 2014 02:11:24 +0000 (19:11 -0700)]
auto merge of #14265 : Ryman/rust/issue-14254, r=alexcrichton

This is hard coding `Box` into this, as it doesn't seem to parse as `TyUniq` like `~` did. This may not be correct for all usages of the box keyword.

Closes #14254.

10 years agoReset the terminal color before the newline for diagnostics
Kevin Ballard [Mon, 19 May 2014 21:37:52 +0000 (14:37 -0700)]
Reset the terminal color before the newline for diagnostics

When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.

10 years agogreen: Remove usage of UnsafeArc
Alex Crichton [Tue, 20 May 2014 01:08:44 +0000 (18:08 -0700)]
green: Remove usage of UnsafeArc

10 years agorustuv: Remove usage of UnsafeArc
Alex Crichton [Tue, 20 May 2014 01:08:33 +0000 (18:08 -0700)]
rustuv: Remove usage of UnsafeArc

10 years agonative: Remove UnsafeArc in favor of just Arc
Alex Crichton [Tue, 20 May 2014 01:00:52 +0000 (18:00 -0700)]
native: Remove UnsafeArc in favor of just Arc

10 years agostd: Remove UnsafeArc
Alex Crichton [Tue, 20 May 2014 00:51:50 +0000 (17:51 -0700)]
std: Remove UnsafeArc

This type has been superseded by Arc<Unsafe<T>>. The UnsafeArc type is a relic
of an era that has long since past, and with the introduction of liballoc the
standard library is able to use the Arc smart pointer. With little need left for
UnsafeArc, it was removed.

All existing code using UnsafeArc should either be reevaluated to whether it can
use only Arc, or it should transition to Arc<Unsafe<T>>

[breaking-change]

10 years agostd: Move comm primitives away from UnsafeArc
Alex Crichton [Tue, 20 May 2014 00:50:57 +0000 (17:50 -0700)]
std: Move comm primitives away from UnsafeArc

They currently still use `&mut self`, this migration was aimed towards moving
from UnsafeArc<T> to Arc<Unsafe<T>>

10 years agocore::iter::order functions now take two types of iterators.
TyOverby [Mon, 19 May 2014 06:31:23 +0000 (23:31 -0700)]
core::iter::order functions now take two types of iterators.

Previously the type signatures of the ordering functions in
`core::iter::order` took two iterators, but only if they were
the same type of iterator.  This commit loosens that restriction
and allows different kinds of iterators (but with the same type
of elements) to be compared.

10 years agostd: Build Exclusive on Arc<Unsafe<T>>
Alex Crichton [Tue, 20 May 2014 00:36:04 +0000 (17:36 -0700)]
std: Build Exclusive on Arc<Unsafe<T>>

This removes the usage of UnsafeArc

10 years agostd: Use Arc instead of UnsafeArc in BlockedTask
Alex Crichton [Tue, 20 May 2014 00:33:40 +0000 (17:33 -0700)]
std: Use Arc instead of UnsafeArc in BlockedTask

10 years agostd: Rebuild spsc with Unsafe/&self
Alex Crichton [Tue, 20 May 2014 00:32:04 +0000 (17:32 -0700)]
std: Rebuild spsc with Unsafe/&self

This removes the incorrect usage of `&mut self` in a concurrent setting.

10 years agostd: Rebuild mpsc queue with Unsafe/&self
Alex Crichton [Tue, 20 May 2014 00:27:52 +0000 (17:27 -0700)]
std: Rebuild mpsc queue with Unsafe/&self

This removes the incorrect `&mut self` taken because it can alias among many
threads.

10 years agorustc: Better resolve errors for &T, &mut T, remove failure condition.
Kevin Butler [Mon, 19 May 2014 21:27:03 +0000 (22:27 +0100)]
rustc: Better resolve errors for &T, &mut T, remove failure condition.

10 years agoauto merge of #14295 : aturon/rust/hide-init_to_vec, r=alexcrichton
bors [Tue, 20 May 2014 00:06:36 +0000 (17:06 -0700)]
auto merge of #14295 : aturon/rust/hide-init_to_vec, r=alexcrichton

The `init_to_vec` function in `collections::bitv` was exposed as an
inherent method, but appears to just be a helper function for the
`to_vec` method. This patch inlines the definition, removing
`init_to_vec` from the public API.

[breaking-change]

10 years agostd: Rebuild mpmc queues on Unsafe/Arc
Alex Crichton [Mon, 19 May 2014 23:01:48 +0000 (16:01 -0700)]
std: Rebuild mpmc queues on Unsafe/Arc

This removes usage of UnsafeArc and uses proper self mutability for concurrent
types.

10 years agostd: Rebuild sync::deque on Arc
Alex Crichton [Mon, 19 May 2014 22:51:31 +0000 (15:51 -0700)]
std: Rebuild sync::deque on Arc

This also removes the `&mut self` requirement, using the correct `&self`
requirement for concurrent types.

10 years agoauto merge of #14286 : cmr/rust/shard-benches, r=alexcrichton
bors [Mon, 19 May 2014 22:31:34 +0000 (15:31 -0700)]
auto merge of #14286 : cmr/rust/shard-benches, r=alexcrichton

This has no tests because it's near impossible to test -- since TestFn uses
`proc`s, they can not be cloned or tested for equality. The only way to really
test this is making sure that for a given number of shards `a`, sharding from
1 to `a` yields the complete set of tests. But `filter_tests` takes its vector
by value and `proc`s cannot be compared.

[breaking-change]

Closes #10898

10 years agotest: index shards at 1, not 0
Corey Richardson [Mon, 19 May 2014 02:35:45 +0000 (19:35 -0700)]
test: index shards at 1, not 0

This has no tests because it's near impossible to test -- since TestFn uses
`proc`s, they can not be cloned or tested for equality. The only way to really
test this is making sure that for a given number of shards `a`, sharding from
1 to `a` yields the complete set of tests. But `filter_tests` takes its vector
by value and `proc`s cannot be compared.

[breaking-change]

Closes #10898

10 years agolibcollections: remove `init_to_vec`
Aaron Turon [Mon, 19 May 2014 18:46:29 +0000 (11:46 -0700)]
libcollections: remove `init_to_vec`

The `init_to_vec` function in `collections::bitv` was exposed as an
inherent method, but appears to just be a helper function for the
`to_vec` method. This patch inlines the definition, removing
`init_to_vec` from the public API.

[breaking-change]

10 years agoauto merge of #14294 : kballard/rust/result_unwrap_or_else, r=alexcrichton
bors [Mon, 19 May 2014 20:36:22 +0000 (13:36 -0700)]
auto merge of #14294 : kballard/rust/result_unwrap_or_else, r=alexcrichton

Result.unwrap_or_handle() is the equivalent of Option.unwrap_or_else().
In the interests of naming consistency, call it the same thing.

[breaking-change]

10 years agoRename Result.unwrap_or_handle() to .unwrap_or_else()
Kevin Ballard [Mon, 19 May 2014 20:11:49 +0000 (13:11 -0700)]
Rename Result.unwrap_or_handle() to .unwrap_or_else()

Result.unwrap_or_handle() is the equivalent of Option.unwrap_or_else().
In the interests of naming consistency, call it the same thing.

[breaking-change]

10 years agoauto merge of #14292 : limeburst/rust/master, r=alexcrichton
bors [Mon, 19 May 2014 18:56:32 +0000 (11:56 -0700)]
auto merge of #14292 : limeburst/rust/master, r=alexcrichton