Commit Graph

40782 Commits

Author SHA1 Message Date
Felix S. Klock II 41b3c86e9a Test cases for checking arithmetic overflow during const eval. 2015-04-01 02:56:07 +02:00
Felix S. Klock II 8d54ea3ec9 Fallout from changes for overflow-checking during constant evaluation. 2015-04-01 02:56:07 +02:00
Felix S. Klock II 6808e414c7 rustc_trans::trans::consts add overflow checking 2015-04-01 02:56:07 +02:00
Felix S. Klock II b02f7d2fac rustc::middle::const_eval : add overflow-checking for {+, -, *}.
The overflow-checking attempts to accommodate early evaluation where
we do not have type information yet.

Also, add fixme note about something that has been bothering me.
2015-04-01 02:56:07 +02:00
Felix S. Klock II 2e93e386fd rust_llvm: Add way to reflectively ask if a ValueRef is a known constant int.
Add option-returning variants to `const_to_int`/`const_to_uint` that
never assert fail. (These will be used for overflow checking from
rustc_trans::trans::consts.)
2015-04-01 02:56:07 +02:00
Felix S. Klock II 7875dae83f ty.rs improve error feedback when const-eval errs during repeat count eval. 2015-04-01 02:56:07 +02:00
Felix S. Klock II 2f7658a528 Refactored ty::ctxt so node_types mutations must go through ty methods. 2015-04-01 02:56:07 +02:00
Felix S. Klock II 60289ac7e7 Added overflowing_{div,rem,shl,shr} method implementations to WrappingOps. 2015-04-01 02:56:07 +02:00
Felix S. Klock II 792f6aa425 Fix #23890: const-eval `_ as usize`, `_ as isize` must dispatch to target type. 2015-04-01 02:55:13 +02:00
Felix S. Klock II 0b57df77b3 fix post rebase. 2015-04-01 02:55:13 +02:00
Felix S. Klock II 36b6d0ecdc Added tests for discriminant overflows. 2015-04-01 02:55:13 +02:00
Felix S. Klock II 4e04d57efa Added type-specific overflow checks when computing enum discriminant values.
Moved such overflow checking into one place (in `rustc::middle::ty`,
since it needs to be run on-demand during `const_eval` in some
scenarios), and revised `rustc_typeck` accordingly.

(Note that we only check for overflow if program did not provide a
discriminant value explicitly.)

Fix #23030

Fix #23221

Fix #23235
2015-04-01 02:55:13 +02:00
Alex Crichton 72f59732d7 Test fixes and rebase conflicts, round 3 2015-03-31 17:39:24 -07:00
Steve Klabnik bfc2f5de85 Improvements to PhantomData<T>'s docs 👻
Fixes #22914
2015-03-31 20:18:32 -04:00
Steve Klabnik 371ba00da2 Add description of + for multiple trait bounds
Fixes #23688
2015-03-31 19:45:09 -04:00
Nick Cameron a5479622ea Pretty print ids for assoc items 2015-04-01 12:40:54 +13:00
Aaron Turon 55e531dc26 Add test for #17746
Closes #17746
2015-03-31 16:22:23 -07:00
Alex Crichton 50b3ecf3bc rollup merge of #23919: alexcrichton/stabilize-io-error
Conflicts:
	src/libstd/fs/tempdir.rs
	src/libstd/io/error.rs
2015-03-31 16:18:55 -07:00
Alex Crichton 85e997adff rollup merge of #23899: steveklabnik/gh23851
Conflicts:
	src/libcore/iter.rs
2015-03-31 16:18:27 -07:00
Alex Crichton ac77392f8a std: Stabilize last bits of io::Error
This commit stabilizes a few remaining bits of the `io::Error` type:

* The `Error::new` method is now stable. The last `detail` parameter was removed
  and the second `desc` parameter was generalized to `E: Into<Box<Error>>` to
  allow creating an I/O error from any form of error. Currently there is no form
  of downcasting, but this will be added in time.

* An implementation of `From<&str> for Box<Error>` was added to liballoc to
  allow construction of errors from raw strings.

* The `Error::raw_os_error` method was stabilized as-is.

* Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it
  is not possible to use them with trait objects.

This is a breaking change due to the modification of the `new` method as well as
the removal of the trait implementations for the `Error` type.

[breaking-change]
2015-03-31 16:12:48 -07:00
Alex Crichton 66598656a5 rollup merge of #23920: steveklabnik/gh23881
Fixes #23881
2015-03-31 16:12:38 -07:00
Alex Crichton 9ab6cc9f32 rollup merge of #23901: steveklabnik/fix_links_str
Remove broken links that should just point to the current page, and while we're at it, re-wrap to 100 chars.
2015-03-31 16:12:36 -07:00
Steve Klabnik 8da08317a6 Move benchmark tests to unstable section
Fixes #23881
2015-03-31 19:02:32 -04:00
Alex Crichton 3422be3666 rollup merge of #23288: alexcrichton/issue-19470
This is a deprecated attribute that is slated for removal, and it also affects
all implementors of the trait. This commit removes the attribute and fixes up
implementors accordingly. The primary implementation which was lost was the
ability to compare `&[T]` and `Vec<T>` (in that order).

This change also modifies the `assert_eq!` macro to not consider both directions
of equality, only the one given in the left/right forms to the macro. This
modification is motivated due to the fact that `&[T] == Vec<T>` no longer
compiles, causing hundreds of errors in unit tests in the standard library (and
likely throughout the community as well).

Closes #19470
[breaking-change]
2015-03-31 15:59:35 -07:00
Alex Crichton 30283d45bb rollup merge of #23908: aturon/stab-more-stragglers
* The `io::Seek` trait.
* The `Iterator::{partition, unsip}` methods.
* The `Vec::into_boxed_slice` method.
* The `LinkedList::append` method.
* The `{or_insert, or_insert_with` methods in the `Entry` APIs.

r? @alexcrichton
2015-03-31 15:58:58 -07:00
Alex Crichton a37311d486 rollup merge of #23907: alexcrichton/impl-exit
This commit is an implementation of [RFC #1011][rfc] which adds an `exit`
function to the standard library for immediately terminating the current process
with a specified exit code.

[rfc]: https://github.com/rust-lang/rfcs/pull/1011

Closes #23914
2015-03-31 15:58:57 -07:00
Alex Crichton 0cac5b6158 rollup merge of #23906: steveklabnik/spellin 2015-03-31 15:58:57 -07:00
Alex Crichton 82889f709e rollup merge of #23902: freebroccolo/master 2015-03-31 15:58:57 -07:00
Alex Crichton 30532884f8 Test fixes and rebase conflicts, round 2 2015-03-31 15:56:33 -07:00
Alex Crichton 554946c81e rollup merge of #23873: alexcrichton/remove-deprecated
Conflicts:
	src/libcollectionstest/fmt.rs
	src/libcollectionstest/lib.rs
	src/libcollectionstest/str.rs
	src/libcore/error.rs
	src/libstd/fs.rs
	src/libstd/io/cursor.rs
	src/libstd/os.rs
	src/libstd/process.rs
	src/libtest/lib.rs
	src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31 15:54:44 -07:00
Alex Crichton e10ee2c857 rollup merge of #23879: seanmonstar/del-from-error
Conflicts:
	src/libcore/error.rs
2015-03-31 15:53:39 -07:00
Alex Crichton da04788efc rollup merge of #23875: aturon/revise-convert-2
* Marks `#[stable]` the contents of the `std::convert` module.

* Added methods `PathBuf::as_path`, `OsString::as_os_str`,
  `String::as_str`, `Vec::{as_slice, as_mut_slice}`.

* Deprecates `OsStr::from_str` in favor of a new, stable, and more
  general `OsStr::new`.

* Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes,
  to_cstring}` for ergonomic FFI usage.

[breaking-change]

r? @alexcrichton
2015-03-31 15:53:26 -07:00
Alex Crichton 94137a37e9 Test fixes and rebase conflicts, round 1 2015-03-31 15:53:25 -07:00
Alex Crichton e3f2d45cb3 rollup merge of #23872: huonw/eager-lexing
Conflicts:
	src/libsyntax/parse/lexer/mod.rs
2015-03-31 15:53:10 -07:00
Alex Crichton d4a2c94180 std: Clean out #[deprecated] APIs
This commit cleans out a large amount of deprecated APIs from the standard
library and some of the facade crates as well, updating all users in the
compiler and in tests as it goes along.
2015-03-31 15:49:57 -07:00
Alex Crichton acdb0f9c78 rollup merge of #23893: frewsxcv/patch-6 2015-03-31 15:49:11 -07:00
Alex Crichton 6d2c640cf0 rollup merge of #23886: demelev/remove_as_slice_usage 2015-03-31 15:49:11 -07:00
Alex Crichton 5e0bda0448 rollup merge of #23885: steveklabnik/doc_std_env
Just one or two things to finish this module off
2015-03-31 15:49:11 -07:00
Alex Crichton 095f1fbde6 rollup merge of #23882: wettowelreactor/patch-2
Removed duplicate words
2015-03-31 15:49:11 -07:00
Alex Crichton f6bd6b4f3d rollup merge of #23878: Ryman/stable_extremes
`min`-like functions now return the leftmost element/input for equal elements.
`max`-like return the rightmost.

Closes #23687.

cc @HeroesGrave, @aturon, @alexcrichton
2015-03-31 15:49:11 -07:00
Alex Crichton d03120afd3 rollup merge of #23876: alexcrichton/stabilize-any
This commit stabilizes the following APIs:

* `TypeId::of` - now that it has an `Any` bound it's ready to be stable.
* `Box<Any>::downcast` - now that an inherent impl on `Box<Any>` as well as
  `Box<Any+Send>` is allowed the `BoxAny` trait is removed in favor of these
  inherent methods.

This is a breaking change due to the removal of the `BoxAny` trait, but
consumers can simply remove imports to fix crates.

[breaking-change]
2015-03-31 15:49:11 -07:00
Alex Crichton 890f0ab10a rollup merge of #23766: alexcrichton/stabilize-raw-fd
This commit stabilizes the platform-specific `io` modules, specifically around
the traits having to do with the raw representation of each object on each
platform.

Specifically, the following material was stabilized:

* `AsRaw{Fd,Socket,Handle}`
* `RawFd` (renamed from `Fd`)
* `RawHandle` (renamed from `Handle`)
* `RawSocket` (renamed from `Socket`)
* `AsRaw{Fd,Socket,Handle}` implementations
* `std::os::{unix, windows}::io`

The following material was added as `#[unstable]`:

* `FromRaw{Fd,Socket,Handle}`
* Implementations for various primitives

There are a number of future improvements that are possible to make to this
module, but this should cover a good bit of functionality desired from these
modules for now. Some specific future additions may include:

* `IntoRawXXX` traits to consume the raw representation and cancel the
  auto-destructor.
* `Fd`, `Socket`, and `Handle` abstractions that behave like Rust objects and
  have nice methods for various syscalls.

At this time though, these are considered backwards-compatible extensions and
will not be stabilized at this time.

This commit is a breaking change due to the addition of `Raw` in from of the
type aliases in each of the platform-specific modules.

[breaking-change]
2015-03-31 15:49:10 -07:00
Alex Crichton 1829974735 rollup merge of #23704: hirschenberger/simd-intdiv-ice
Fixes #23339
2015-03-31 15:49:10 -07:00
Aaron Turon b9ab5fe7c2 Stabilize a few remaining stragglers
* The `io::Seek` trait, and `SeekFrom` enum.
* The `Iterator::{partition, unsip}` methods.
* The `Vec::into_boxed_slice` method.
* The `LinkedList::append` method.
* The `{or_insert, or_insert_with` methods in the `Entry` APIs.
2015-03-31 15:22:21 -07:00
Alex Crichton 71982aa657 std: Add a process::exit function
This commit is an implementation of [RFC #1011][rfc] which adds an `exit`
function to the standard library for immediately terminating the current process
with a specified exit code.

[rfc]: https://github.com/rust-lang/rfcs/pull/1011
2015-03-31 14:46:11 -07:00
Steve Klabnik e48c7c61eb Fix spelling 2015-03-31 17:44:45 -04:00
Alex Crichton 608fff8582 rustc: Remove old_orphan_check entirely 2015-03-31 13:41:19 -07:00
Alex Crichton 5cf126ae2f std: Remove #[old_orphan_check] from PartialEq
This is a deprecated attribute that is slated for removal, and it also affects
all implementors of the trait. This commit removes the attribute and fixes up
implementors accordingly. The primary implementation which was lost was the
ability to compare `&[T]` and `Vec<T>` (in that order).

This change also modifies the `assert_eq!` macro to not consider both directions
of equality, only the one given in the left/right forms to the macro. This
modification is motivated due to the fact that `&[T] == Vec<T>` no longer
compiles, causing hundreds of errors in unit tests in the standard library (and
likely throughout the community as well).

cc #19470
[breaking-change]
2015-03-31 13:39:14 -07:00
Steve Klabnik d9a6e86275 Fixup primitive.str docs
Remove broken links that should just point to the current page, and while we're at it, re-wrap to 100 chars.
2015-03-31 16:19:52 -04:00
Darin Morrison 9ba7974b35 book: reword timer bit 2015-03-31 14:17:13 -06:00