Commit Graph

862 Commits

Author SHA1 Message Date
awlnx 951ef9d1f1 fix for new attributes failing. issue #22964 2015-03-05 11:53:51 -05:00
Manish Goregaokar c8c4d85b50 Rollup merge of #22764 - ivanradanov:fileline_help, r=huonw
When warnings and errors occur, the associated help message should not print the same code snippet.
https://github.com/rust-lang/rust/issues/21938
2015-03-05 12:38:32 +05:30
Ivan Radanov Ivanov 7496539a00 Change span_help calls to fileline_help where appropriate 2015-03-03 15:18:33 +02:00
Florian Zeitz f35f973cb7 Use `const`s instead of `static`s where appropriate
This changes the type of some public constants/statics in libunicode.
Notably some `&'static &'static [(char, char)]` have changed
to `&'static [(char, char)]`. The regexp crate seems to be the
sole user of these, yet this is technically a [breaking-change]
2015-03-02 17:11:51 +01:00
Manish Goregaokar 24086987f9 Rollup merge of #22736 - nikomatsakis:issue-22382, r=eddyb
Apply borrowck to fns that appear in const declarations.
Fixes #22382.

r? @eddyb
2015-02-25 03:21:43 +05:30
Manish Goregaokar d7df353377 Rollup merge of #22580 - pnkfelix:guard-pat-cfg2, r=pnkfelix
aatch's cfg revisions, namely to match expressions

Revise handling of match expressions so that arms branch to next arm.

Update the graphviz tests accordingly.

Fixes #22073. (Includes regression test for the issue.)
2015-02-24 12:08:35 +05:30
Niko Matsakis d443f98f22 Apply borrowck to fns that appear in const declarations.
Fixes #22382.
2015-02-23 17:22:51 -05:00
Manish Goregaokar af81ec2f43 Rollup merge of #22559 - kmcallister:borrowck-readme, r=nikomatsakis
And minor fixes to other docs.

r? @nikomatsakis
2015-02-23 23:28:46 +05:30
James Miller 85defffea5 Improve borrowck error when a second move is due to a loop.
(Factoring of aatch CFG code, Part 5.)
2015-02-22 12:43:09 +01:00
James Miller 97c1711894 Distinguish between AST and various Dummy nodes in CFG.
(Factoring of aatch CFG code, Part 1.)
2015-02-22 12:01:58 +01:00
Niko Matsakis 68e5bb3f2c Remove remaining uses of `[]`. This time I tried to use deref coercions where possible. 2015-02-20 14:08:14 -05:00
Keegan McAllister 1597f915c5 borrowck/README.md: Normalize types in examples 2015-02-18 20:46:21 -08:00
Keegan McAllister f051e13238 Fix references to doc.rs throughout the code 2015-02-18 19:54:45 -08:00
Keegan McAllister ac6cab0887 borrowck/README.md: Fix display of code on GitHub 2015-02-18 19:54:45 -08:00
Keegan McAllister 160cf962e7 borrowck/README.md: Remove SCOPE (mostly unused)
Only one case is used in the text.  All of them are pretty straightforward, so
I don't think the code needs an explicit link to the README.
2015-02-18 19:54:38 -08:00
Keegan McAllister 0c1fc1ca7b borrowck/README.md: Clarify MUTABILITY and ALIASABLE 2015-02-18 18:07:03 -08:00
Keegan McAllister bb22c100db borrowck/README.md: Remove most references to &const 2015-02-18 17:59:47 -08:00
Alex Crichton 231eeaa35b rollup merge of #22502: nikomatsakis/deprecate-bracket-bracket
Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/librustc/middle/lang_items.rs
	src/librustc_back/rpath.rs
	src/librustc_typeck/check/regionck.rs
	src/libstd/ffi/os_str.rs
	src/libsyntax/diagnostic.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/util/interner.rs
	src/test/run-pass/regions-refcell.rs
2015-02-18 15:48:40 -08:00
Niko Matsakis 9ea84aeed4 Replace all uses of `&foo[]` with `&foo[..]` en masse. 2015-02-18 17:36:03 -05:00
Alex Crichton 9774b7e64b rollup merge of #22480: alexcrichton/hashv3
This commit is an implementation of [RFC 823][rfc] which is another pass over
the `std::hash` module for stabilization. The contents of the module were not
entirely marked stable, but some portions which remained quite similar to the
previous incarnation are now marked `#[stable]`. Specifically:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0823-hash-simplification.md

* `std::hash` is now stable (the name)
* `Hash` is now stable
* `Hash::hash` is now stable
* `Hasher` is now stable
* `SipHasher` is now stable
* `SipHasher::new` and `new_with_keys` are now stable
* `Hasher for SipHasher` is now stable
* Many `Hash` implementations are now stable

All other portions of the `hash` module remain `#[unstable]` as they are less
commonly used and were recently redesigned.

This commit is a breaking change due to the modifications to the `std::hash` API
and more details can be found on the [RFC][rfc].

Closes #22467
[breaking-change]
2015-02-18 14:32:03 -08:00
Niko Matsakis 2939e483fd Extend the implicator so it produces general obligations and also so
that it produces "outlives" relations for associated types. Add
several tests relating to #22246.
2015-02-18 15:23:34 -05:00
Alex Crichton f83e23ad7c std: Stabilize the `hash` module
This commit is an implementation of [RFC 823][rfc] which is another pass over
the `std::hash` module for stabilization. The contents of the module were not
entirely marked stable, but some portions which remained quite similar to the
previous incarnation are now marked `#[stable]`. Specifically:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0823-hash-simplification.md

* `std::hash` is now stable (the name)
* `Hash` is now stable
* `Hash::hash` is now stable
* `Hasher` is now stable
* `SipHasher` is now stable
* `SipHasher::new` and `new_with_keys` are now stable
* `Hasher for SipHasher` is now stable
* Many `Hash` implementations are now stable

All other portions of the `hash` module remain `#[unstable]` as they are less
commonly used and were recently redesigned.

This commit is a breaking change due to the modifications to the `std::hash` API
and more details can be found on the [RFC][rfc].

Closes #22467
[breaking-change]
2015-02-18 08:26:20 -08:00
bors b6d91a2bda Auto merge of #22126 - steveklabnik:gh21281, r=nikomatsakis
This is super black magic internals at the moment, but having it
somewhere semi-public seems good. The current versions weren't being
rendered, and they'll be useful for some people.

Fixes #21281

r? @nikomatsakis @kmcallister
2015-02-15 07:53:07 +00:00
Steve Klabnik ad2efdc67d Instead of putting them in the book, make them READMEs. 2015-02-13 12:32:37 -05:00
Felix S. Klock II 6cc3b00d3f Add a couple FIXME notes inspired during my review. 2015-02-12 13:55:49 +01:00
Kevin Butler 32d0dbd49a librustc: Forbid partial reinitialization of uninitialized structures or
enumerations that implement the `Drop` trait.

This breaks code like:

    struct Struct {
        f: String,
        g: String,
    }

    impl Drop for Struct { ... }

    fn main() {
        let x = Struct { ... };
        drop(x);
        x.f = ...;
    }

Change this code to not create partially-initialized structures. For
example:

    struct Struct {
        f: String,
        g: String,
    }

    impl Drop for Struct { ... }

    fn main() {
        let x = Struct { ... };
        drop(x);
        x = Struct {
            f: ...,
            g: ...,
        }
    }

Closes #18571.

[breaking-change]

----

(Joint authorship by pcwalton and Ryman; thanks all!)
2015-02-12 13:55:08 +01:00
Alex Crichton 84e5c11785 rollup merge of #22127: alexcrichton/stability-holes
There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local:👿:Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Closes #8962
Closes #16360
Closes #20327
2015-02-11 14:02:04 -08:00
Alex Crichton bbbb571fee rustc: Fix a number of stability lint holes
There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local:👿:Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Additionally, the compiler now has special logic to ignore its own generated
`__test` module for the `--test` harness in terms of stability.

Closes #8962
Closes #16360
Closes #20327

[breaking-change]
2015-02-11 12:14:59 -08:00
Felix S. Klock II 81383bd869 Added DestructionScope variant to CodeExtent, representing the area
immediately surrounding a node that is a terminating_scope
(e.g. statements, looping forms) during which the destructors run (the
destructors for temporaries from the execution of that node, that is).

Introduced DestructionScopeData newtype wrapper around ast::NodeId, to
preserve invariant that FreeRegion and ScopeChain::BlockScope carry
destruction scopes (rather than arbitrary CodeExtents).

Insert DestructionScope and block Remainder into enclosing CodeExtents
hierarchy.

Add more doc for DestructionScope, complete with ASCII art.

Switch to constructing DestructionScope rather than Misc in a number
of places, mostly related to `ty::ReFree` creation, and use
destruction-scopes of node-ids at various calls to
liberate_late_bound_regions.

middle::resolve_lifetime: Map BlockScope to DestructionScope in `fn resolve_free_lifetime`.

Add the InnermostDeclaringBlock and InnermostEnclosingExpr enums that
are my attempt to clarify the region::Context structure, and that
later commmts build upon.

Improve the debug output for `CodeExtent` attached to `ty::Region::ReScope`.

Loosened an assertion in `rustc_trans::trans::cleanup` to account for
`DestructionScope`.  (Perhaps this should just be switched entirely
over to `DestructionScope`, rather than allowing for either `Misc` or
`DestructionScope`.)

----

Even though the DestructionScope is new, this particular commit should
not actually change the semantics of any current code.
2015-02-11 08:50:27 +01:00
Steve Klabnik 005a2506a6 Move rustc docs to the book
This is super black magic internals at the moment, but having it
somewhere semi-public seems good. The current versions weren't being
rendered, and they'll be useful for some people.

Fixes #21281
2015-02-10 22:02:53 -05:00
Felix S. Klock II 3513c97302 Add error message (i.e. do not ICE) when moving out of unsafe pointers.
Fix #20801.
2015-02-10 15:01:31 +01:00
Felix S. Klock II cc8f35f874 Restrictions on moves out-from and into fixed-length arrays.
No longer legal: `fn foo(a: [D; 5]) { drop(a); a[2] = D::new(); }`;
one must first initialize the entirety of `a` before assigning to its
individual elements.

No longer legal: `fn foo(arr: [D; 5]) -> D { arr[2] }`, unless `D`
implements `Copy`. This "move out-from" restriction only affects
`expr[i]`, and not destructuring (e.g. `f([a, b, c]: Array) { ... }`).

uses mem_categorization to distinguish destructuring-bind from array
indexing.

See discussion on RFC PR 533.

[breaking-change]
2015-02-07 13:44:00 +01:00
bors 7ebf9bc5c2 Auto merge of #21505 - GuillaumeGomez:interned_string, r=alexcrichton
It's in order to make the code more homogeneous.
2015-02-07 02:04:47 +00:00
GuillaumeGomez 7b973ba827 Update to last version, remove "[]" as much as possible 2015-02-06 12:03:46 +01:00
GuillaumeGomez 0f09021b37 librustc_borrowck has been updated 2015-02-06 11:59:11 +01:00
Manish Goregaokar 67b51291f0 Rollup merge of #21925 - sfackler:allow-missing-copy, r=alexcrichton
This was particularly helpful in the time just after OIBIT's
implementation to make sure things that were supposed to be Copy
continued to be, but it's now creates a lot of noise for types that
intentionally don't want to be Copy.

r? @alexcrichton
2015-02-06 16:21:08 +05:30
Manish Goregaokar 08a2bef632 Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnik
The spelling corrections were made in both documentation comments and
regular comments.
2015-02-06 16:21:06 +05:30
Jorge Aparicio 17bc7d8d5b cleanup: replace `as[_mut]_slice()` calls with deref coercions 2015-02-05 13:45:01 -05:00
Joseph Crail dc2e444e50 Fix for misspelled comments.
The spelling corrections were made in both documentation comments and
regular comments.
2015-02-04 23:00:02 -05:00
Jorge Aparicio 571cc7f8e9 remove all kind annotations from closures 2015-02-04 20:06:08 -05:00
Steven Fackler 85a85c2070 Switch missing_copy_implementations to default-allow
This was particularly helpful in the time just after OIBIT's
implementation to make sure things that were supposed to be Copy
continued to be, but it's now creates a lot of noise for types that
intentionally don't want to be Copy.
2015-02-03 23:31:07 -08:00
Niko Matsakis 0431134119 Remove the explicit closure kind syntax from the parser and AST;
upgrade the inference based on expected type so that it is able to
infer the fn kind in isolation even if the full signature is not
available (and we could perhaps do better still in some cases, such as
extracting just the types of the arguments but not the return value).
2015-02-03 11:56:16 -05:00
Jorge Aparicio d5f61b4332 `for x in xs.iter_mut()` -> `for x in &mut xs`
Also `for x in option.iter_mut()` -> `if let Some(ref mut x) = option`
2015-02-02 13:40:18 -05:00
Jorge Aparicio d5d7e6565a `for x in xs.iter()` -> `for x in &xs` 2015-02-02 13:40:18 -05:00
Alex Crichton 3a2530d611 Test fixes and rebase conflicts
Also some tidying up of a bunch of crate attributes
2015-01-30 14:53:34 -08:00
bors 7ea93abfb2 Auto merge of #21691 - edwardw:double-closure, r=nikomatsakis
It was considered to be impossible but actually it can
happen for nested closures. Also, because there must
be nested closures when this happens, we can use more
targeted help message.

Closes #21390
Closes #21600
2015-01-29 19:36:03 +00:00
Jorge Aparicio 788181d405 s/Show/Debug/g 2015-01-29 07:49:02 -05:00
Jorge Aparicio 7d661af9c8 `for x in range(a, b)` -> `for x in a..b`
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29 07:47:37 -05:00
Edward Wang 2c6440e2a2 borrowck: aliasability violation with closure captures can happen
It was considered to be impossible but actually it can
happen for nested closures. Also, because there must
be nested closures when this happens, we can use more
targeted help message.

Closes #21390
Closes #21600
2015-01-27 23:55:07 +08:00
Brian Anderson 5a6fb8eb98 Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	src/librustc/lint/builtin.rs
	src/librustc/lint/context.rs
2015-01-26 15:42:32 -08:00
Eduard Burtescu 11ef6f1349 Remove "unboxed" attribute in code referring to new closures. 2015-01-26 04:15:09 +02:00
Brian Anderson 63fcbcf3ce Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	mk/tests.mk
	src/liballoc/arc.rs
	src/liballoc/boxed.rs
	src/liballoc/rc.rs
	src/libcollections/bit.rs
	src/libcollections/btree/map.rs
	src/libcollections/btree/set.rs
	src/libcollections/dlist.rs
	src/libcollections/ring_buf.rs
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/libcollections/vec_map.rs
	src/libcore/any.rs
	src/libcore/array.rs
	src/libcore/borrow.rs
	src/libcore/error.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/ops.rs
	src/libcore/result.rs
	src/libcore/slice.rs
	src/libcore/str/mod.rs
	src/libregex/lib.rs
	src/libregex/re.rs
	src/librustc/lint/builtin.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/poison.rs
	src/libstd/sync/rwlock.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/test.rs
2015-01-25 01:20:55 -08:00
Brian Anderson cd6d9eab5d Set unstable feature names appropriately
* `core` - for the core crate
* `hash` - hashing
* `io` - io
* `path` - path
* `alloc` - alloc crate
* `rand` - rand crate
* `collections` - collections crate
* `std_misc` - other parts of std
* `test` - test crate
* `rustc_private` - everything else
2015-01-23 13:28:40 -08:00
Brian Anderson d3c0bb416e Put #[staged_api] behind the 'staged_api' gate 2015-01-22 13:47:56 -08:00
Brian Anderson 41278c5441 Remove 'since' from unstable attributes 2015-01-21 19:25:55 -08:00
Brian Anderson 7b73ec4698 Tie stability attributes to feature gates 2015-01-21 16:16:21 -08:00
Brian Anderson 94ca8a3610 Add 'feature' and 'since' to stability attributes 2015-01-21 16:16:18 -08:00
Alex Crichton 886c6f3534 rollup merge of #21258: aturon/stab-3-index
Conflicts:
	src/libcore/ops.rs
	src/librustc_typeck/astconv.rs
	src/libstd/io/mem.rs
	src/libsyntax/parse/lexer/mod.rs
2015-01-21 11:53:49 -08:00
Aaron Turon a506d4cbfe Fallout from stabilization. 2015-01-21 08:11:07 -08:00
Alex Crichton 3cb9fa26ef std: Rename Show/String to Debug/Display
This commit is an implementation of [RFC 565][rfc] which is a stabilization of
the `std::fmt` module and the implementations of various formatting traits.
Specifically, the following changes were performed:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md

* The `Show` trait is now deprecated, it was renamed to `Debug`
* The `String` trait is now deprecated, it was renamed to `Display`
* Many `Debug` and `Display` implementations were audited in accordance with the
  RFC and audited implementations now have the `#[stable]` attribute
  * Integers and floats no longer print a suffix
  * Smart pointers no longer print details that they are a smart pointer
  * Paths with `Debug` are now quoted and escape characters
* The `unwrap` methods on `Result` now require `Display` instead of `Debug`
* The `Error` trait no longer has a `detail` method and now requires that
  `Display` must be implemented. With the loss of `String`, this has moved into
  libcore.
* `impl<E: Error> FromError<E> for Box<Error>` now exists
* `derive(Show)` has been renamed to `derive(Debug)`. This is not currently
  warned about due to warnings being emitted on stage1+

While backwards compatibility is attempted to be maintained with a blanket
implementation of `Display` for the old `String` trait (and the same for
`Show`/`Debug`) this is still a breaking change due to primitives no longer
implementing `String` as well as modifications such as `unwrap` and the `Error`
trait. Most code is fairly straightforward to update with a rename or tweaks of
method calls.

[breaking-change]
Closes #21436
2015-01-20 22:36:13 -08:00
Alex Crichton 3121c04043 Fix typedef/module name conflicts in the compiler 2015-01-18 18:26:34 -08:00
Brian Anderson 6f3a80e411 Set allow(unstable) in crates that use unstable features
Lets them build with the -dev, -nightly, or snapshot compiler
2015-01-17 16:38:04 -08:00
bors 00b112c45a auto merge of #20760 : alexcrichton/rust/rollup, r=alexcrichton 2015-01-08 18:40:04 +00:00
Alex Crichton 4281bd1932 rollup merge of #20754: nikomatsakis/int-feature
Conflicts:
	src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs
	src/test/compile-fail/issue-2590.rs
	src/test/compile-fail/lint-stability.rs
	src/test/compile-fail/slice-mut-2.rs
	src/test/compile-fail/std-uncopyable-atomics.rs
2015-01-08 09:24:08 -08:00
Alex Crichton 8ed88c11af rollup merge of #20751: nikomatsakis/issue-20232
Issue #20232. Fun.

r? @eddyb you prob know this system best
2015-01-08 09:22:10 -08:00
Huon Wilson 4f5a57e80e Remove warning from the libraries.
This adds the int_uint feature to *every* library, whether or not it
needs it.
2015-01-08 11:02:23 -05:00
Niko Matsakis 2387651f7d Update the "English-language" to-string function of a `cmt` to use
more modern terminology and update tests accordingly.
2015-01-08 09:19:27 -05:00
Brian Anderson 1f70acbf4c Improvements to feature staging
This gets rid of the 'experimental' level, removes the non-staged_api
case (i.e. stability levels for out-of-tree crates), and lets the
staged_api attributes use 'unstable' and 'deprecated' lints.

This makes the transition period to the full feature staging design
a bit nicer.
2015-01-08 03:07:23 -08:00
Manish Goregaokar 7e87ea9fc5 librustc::session : Make DebuggingOpts use the options! macro 2015-01-08 13:38:43 +05:30
Alex Crichton 6e806bdefd 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
2015-01-07 17:26:58 -08: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
Jorge Aparicio 517f1cc63c use slicing sugar 2015-01-07 17:35:56 -05:00
Alex Crichton e2f97f51ad Register new snapshots
Conflicts:
	src/librbml/lib.rs
	src/libserialize/json_stage0.rs
	src/libserialize/serialize_stage0.rs
	src/libsyntax/ast.rs
	src/libsyntax/ext/deriving/generic/mod.rs
	src/libsyntax/parse/token.rs
2015-01-06 15:24:24 -08:00
Alex Crichton 5c3ddcb15d rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts:
	src/compiletest/runtest.rs
	src/libcore/fmt/mod.rs
	src/libfmt_macros/lib.rs
	src/libregex/parse.rs
	src/librustc/middle/cfg/construct.rs
	src/librustc/middle/dataflow.rs
	src/librustc/middle/infer/higher_ranked/mod.rs
	src/librustc/middle/ty.rs
	src/librustc_back/archive.rs
	src/librustc_borrowck/borrowck/fragments.rs
	src/librustc_borrowck/borrowck/gather_loans/mod.rs
	src/librustc_resolve/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/save/mod.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/callee.rs
	src/librustc_trans/trans/common.rs
	src/librustc_trans/trans/consts.rs
	src/librustc_trans/trans/controlflow.rs
	src/librustc_trans/trans/debuginfo.rs
	src/librustc_trans/trans/expr.rs
	src/librustc_trans/trans/monomorphize.rs
	src/librustc_typeck/astconv.rs
	src/librustc_typeck/check/method/mod.rs
	src/librustc_typeck/check/mod.rs
	src/librustc_typeck/check/regionck.rs
	src/librustc_typeck/collect.rs
	src/libsyntax/ext/format.rs
	src/libsyntax/ext/source_util.rs
	src/libsyntax/ext/tt/transcribe.rs
	src/libsyntax/parse/mod.rs
	src/libsyntax/parse/token.rs
	src/test/run-pass/issue-8898.rs
2015-01-06 15:22:24 -08:00
Nick Cameron 0c7f7a5fb8 fallout 2015-01-07 12:02:52 +13:00
Sean McArthur 44440e5c18 core: split into fmt::Show and fmt::String
fmt::Show is for debugging, and can and should be implemented for
all public types. This trait is used with `{:?}` syntax. There still
exists #[derive(Show)].

fmt::String is for types that faithfully be represented as a String.
Because of this, there is no way to derive fmt::String, all
implementations must be purposeful. It is used by the default format
syntax, `{}`.

This will break most instances of `{}`, since that now requires the type
to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the
correct fix. Types that were being printed specifically for users should
receive a fmt::String implementation to fix this.

Part of #20013

[breaking-change]
2015-01-06 14:49:42 -08:00
Nick Cameron f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Alex Crichton 7975fd9cee rollup merge of #20482: kmcallister/macro-reform
Conflicts:
	src/libflate/lib.rs
	src/libstd/lib.rs
	src/libstd/macros.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/show_span.rs
	src/test/auxiliary/macro_crate_test.rs
	src/test/compile-fail/lint-stability.rs
	src/test/run-pass/intrinsics-math.rs
	src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05 19:01:17 -08:00
Keegan McAllister 60be2f52d2 Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
Jorge Aparicio 5f7f2c9a05 remove ty_closure 2015-01-05 17:22:15 -05:00
Keegan McAllister 1c2fddc6bf Remove unused if_ok! macro 2015-01-05 11:38:12 -08:00
bors 56795ad8c3 Merge pull request #20457 from frewsxcv/rm-reexports
Remove graphviz::LabelText::* public reexport

Reviewed-by: cmr
2015-01-04 21:36:36 +00:00
Jorge Aparicio 351409a622 sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
Jorge Aparicio 56dcbd17fd sed -i -s 's/\bmod,/self,/g' **/*.rs 2015-01-03 22:42:21 -05:00
Niko Matsakis 7474be0660 Make `ty::ParameterEnvironment`, not `ty::ctxt`, implement `Typer` and
`UnboxedClosureTyper`. This requires adding a `tcx` field to
`ParameterEnvironment` but generally simplifies everything since we
only need to pass along an `UnboxedClosureTyper` or `Typer`.
2015-01-03 07:01:21 -05:00
Corey Farwell f031285c3a Remove graphviz::LabelText::* public reexport
Part of #19253

[breaking-change]
2015-01-02 19:35:56 -08:00
Alex Crichton 735c308aed rollup merge of #20416: nikomatsakis/coherence
Conflicts:
	src/test/run-pass/issue-15734.rs
	src/test/run-pass/issue-3743.rs
2015-01-02 09:23:42 -08:00
Alex Crichton 56290a0044 std: Stabilize the prelude module
This commit is an implementation of [RFC 503][rfc] which is a stabilization
story for the prelude. Most of the RFC was directly applied, removing reexports.
Some reexports are kept around, however:

* `range` remains until range syntax has landed to reduce churn.
* `Path` and `GenericPath` remain until path reform lands. This is done to
  prevent many imports of `GenericPath` which will soon be removed.
* All `io` traits remain until I/O reform lands so imports can be rewritten all
  at once to `std::io::prelude::*`.

This is a breaking change because many prelude reexports have been removed, and
the RFC can be consulted for the exact list of removed reexports, as well as to
find the locations of where to import them.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md
[breaking-change]

Closes #20068
2015-01-02 08:54:06 -08:00
Niko Matsakis c61a0092bc Fix orphan checking (cc #19470). (This is not a complete fix of #19470 because of the backwards compatibility feature gate.)
This is a [breaking-change]. The new rules require that, for an impl of a trait defined
in some other crate, two conditions must hold:

1. Some type must be local.
2. Every type parameter must appear "under" some local type.

Here are some examples that are legal:

```rust
struct MyStruct<T> { ... }

// Here `T` appears "under' `MyStruct`.
impl<T> Clone for MyStruct<T> { }

// Here `T` appears "under' `MyStruct` as well. Note that it also appears
// elsewhere.
impl<T> Iterator<T> for MyStruct<T> { }
```

Here is an illegal example:

```rust
// Here `U` does not appear "under" `MyStruct` or any other local type.
// We call `U` "uncovered".
impl<T,U> Iterator<U> for MyStruct<T> { }
```

There are a couple of ways to rewrite this last example so that it is
legal:

1. In some cases, the uncovered type parameter (here, `U`) should be converted
   into an associated type. This is however a non-local change that requires access
   to the original trait. Also, associated types are not fully baked.
2. Add `U` as a type parameter of `MyStruct`:
   ```rust
   struct MyStruct<T,U> { ... }
   impl<T,U> Iterator<U> for MyStruct<T,U> { }
   ```
3. Create a newtype wrapper for `U`
   ```rust
   impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { }
   ```

Because associated types are not fully baked, which in the case of the
`Hash` trait makes adhering to this rule impossible, you can
temporarily disable this rule in your crate by using
`#![feature(old_orphan_check)]`. Note that the `old_orphan_check`
feature will be removed before 1.0 is released.
2015-01-02 04:06:09 -05:00
Nick Cameron 7e2b9ea235 Fallout - change array syntax to use `;` 2015-01-02 10:28:19 +13:00
Jorge Aparicio 28ea99eaa6 rustc_borrowck: unbox closures used in let bindings 2014-12-31 22:50:26 -05:00
Jorge Aparicio bcc2120c21 rustc_borrowck: unbox closures used in function arguments 2014-12-31 22:50:26 -05:00
Aaron Turon 6abfac083f Fallout from stabilization 2014-12-30 17:06:08 -08:00
Niko Matsakis 0b64e5796b Make ExprUseVisitor<..> use inherited parameter environments. 2014-12-30 09:32:42 -05:00
Huon Wilson 4f2b0f032a Store Substs in an arena in the tcx.
This current inflates memory use more than 3 times.
2014-12-29 23:55:24 +11:00
bors 4a4c89c7a4 auto merge of #20119 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakis
More work on opt-in built in traits. `Send` and `Sync` are not opt-in, `OwnedPtr` renamed to `UniquePtr` and the `Send` and `Sync` traits are now unsafe.

NOTE: This likely needs to be rebased on top of the yet-to-land snapshot.

r? @nikomatsakis 

cc #13231
2014-12-27 13:11:48 +00:00
bors 16e4fef9bf auto merge of #20158 : nikomatsakis/rust/fn-inference-refactor, r=eddyb
Various refactorings simplifying the mem-categorization and regionck interface. This is working towards an improvement for closure-and-upvar-mode inference.

r? @eddyb
2014-12-27 06:58:35 +00:00
Nick Cameron dbde7419cc Fix fallout 2014-12-27 09:55:25 +13:00
Flavio Percoco 7df17a2868 Rename `UniquePtr` to `Unique`
Mostly following the convention in RFC 356
2014-12-26 17:26:33 +01:00
Flavio Percoco 686ce664da Rename `OwnedPtr` to `UniquePtr` 2014-12-26 17:26:33 +01:00
Niko Matsakis a583ba2fa0 Remove `McResult` from the mem-categorization interface. 2014-12-25 07:04:07 -05:00
Alex Crichton 082bfde412 Fallout of std::str stabilization 2014-12-21 23:31:42 -08:00
Eduard Burtescu 5193d542f6 Fix the fallout of removing feature(import_shadowing). 2014-12-20 07:49:37 +02:00
Eduard Burtescu d5267d5845 Remove feature(import_shadowing) from all crates. 2014-12-20 06:37:14 +02:00
Jorge Aparicio 392ea799b8 librustc_borrowck: use `#[deriving(Copy)]` 2014-12-19 10:51:00 -05:00
Patrick Walton ddb2466f6a librustc: Always parse `macro!()`/`macro![]` as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Pedro Larroy 2e74291290 remove explicit if_let and tuple_indexing feature enables as they now trigger warnings 2014-12-15 15:01:26 +01:00
Niko Matsakis d258d68db6 Remove `proc` types/expressions from the parser, compiler, and
language. Recommend `move||` instead.
2014-12-14 04:21:56 -05:00
Jorge Aparicio 821b836634 librustc: use tuple indexing 2014-12-13 20:04:41 -05:00
Jorge Aparicio b8e0b81dd5 librustc_borrowck: add `#![feature(unboxed_closures)]` 2014-12-13 17:40:34 -05:00
Jorge Aparicio 1195708f64 librustc: use unboxed closures 2014-12-13 17:03:47 -05:00
Niko Matsakis 2854d1bfc2 Separate borrowck into its own crate and remove dead code as well. 2014-12-13 06:01:19 -05:00