summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2016-02-26Don't assume color=always when explicitally specifiedSteven Allen-6/+6
Fixes #31546
2016-02-23Revert "Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturon"Niko Matsakis-511/+227
This reverts commit c14b615534ebcd5667f594c86d18eebff6afc7cb, reversing changes made to dda25f2221cc7dd68ed28254665dc7d25e2648ed. This caused a regression in compiler performance and backporting the fix to beta was deemed too risky and too challenging, since it is non-trivial and builds on prior commits in various ways. Conflicts: src/librustc/middle/traits/fulfill.rs src/librustc_data_structures/lib.rs
2016-02-18Split dummy in region inference graph into distinct source and sink nodes.Felix S. Klock II-3/+10
Why do this: The RegionGraph representation previously conflated all of the non-variable regions (i.e. the concrete regions such as lifetime parameters to the current function) into a single dummy node. A single dummy node leads DFS on a graph `'a -> '_#1 -> '_#0 -> 'b` to claim that `'_#1` is reachable from `'_#0` (due to `'a` and `'b` being conflated in the graph representation), which is incorrect (and can lead to soundness bugs later on in compilation, see #30438). Splitting the dummy node ensures that DFS will never introduce new ancestor relationships between nodes for variable regions in the graph.
2016-02-03std: Stabilize custom hasher support in HashMapAlex Crichton-4/+2
This commit implements the stabilization of the custom hasher support intended for 1.7 but left out due to some last-minute questions that needed some decisions. A summary of the actions done in this PR are: Stable * `std::hash::BuildHasher` * `BuildHasher::Hasher` * `BuildHasher::build_hasher` * `std::hash::BuildHasherDefault` * `HashMap::with_hasher` * `HashMap::with_capacity_and_hasher` * `HashSet::with_hasher` * `HashSet::with_capacity_and_hasher` * `std::collections::hash_map::RandomState` * `RandomState::new` Deprecated * `std::collections::hash_state` * `std::collections::hash_state::HashState` - this trait was also moved into `std::hash` with a reexport here to ensure that we can have a blanket impl to prevent immediate breakage on nightly. Note that this is unstable in both location. * `HashMap::with_hash_state` - renamed * `HashMap::with_capacity_and_hash_state` - renamed * `HashSet::with_hash_state` - renamed * `HashSet::with_capacity_and_hash_state` - renamed Closes #27713
2016-01-18fix path to region inference documentationBenjamin Peterson-1/+1
2016-01-18Auto merge of #30953 - KalitaAlexey:17823-get-rid-of-duplicate-error, r=nrcbors-3/+21
2016-01-18simplify E0308 message for primitive typeskalita.alexey-3/+21
2016-01-17Auto merge of #30978 - nikomatsakis:fulfillment-tree-add-fixme, r=aturonbors-1/+1
r? @aturon
2016-01-17add fixme number into codeNiko Matsakis-1/+1
2016-01-17Rollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturonManish Goregaokar-15/+15
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-16std: Stabilize APIs for the 1.7 releaseAlex Crichton-15/+15
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_neg` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-16Auto merge of #30934 - oli-obk:simplify_const_eval, r=alexcrichtonbors-20/+6
the `None` and the `DefVariant` paths were unused anyway.
2016-01-16Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturonbors-227/+511
This PR introduces an `ObligationForest` data structure that the fulfillment context can use to track what's going on, instead of the current flat vector. This enables a number of improvements: 1. transactional support, at least for pushing new obligations 2. remove the "errors will be reported" hack -- instead, we only add types to the global cache once their entire subtree has been proven safe. Before, we never knew when this point was reached because we didn't track the subtree. - this in turn allows us to limit coinductive reasoning to structural traits, which sidesteps #29859 3. keeping the backtrace should allow for an improved error message, where we give the user full context - we can also remove chained obligation causes This PR is not 100% complete. In particular: - [x] Currently, types that embed themselves like `struct Foo { f: Foo }` give an overflow when evaluating whether `Foo: Sized`. This is not a very user-friendly error message, and this is a common beginner error. I plan to special-case this scenario, I think. - [x] I should do some perf. measurements. (Update: 2% regression.) - [x] More tests targeting #29859 - [ ] The transactional support is not fully integrated, though that should be easy enough. - [ ] The error messages are not taking advantage of the backtrace. I'd certainly like to do 1 through 3 before landing, but 4 and 5 could come as separate PRs. r? @aturon // good way to learn more about this part of the trait system f? @arielb1 // already knows this part of the trait system :)
2016-01-16simplify some codeOliver 'ker' Schneider-20/+6
2016-01-16Document `ObligationForest` better.Niko Matsakis-1/+1
2016-01-16Pacify tidy.Niko Matsakis-1/+2
2016-01-16Implement a hacky version of the DAG support we ultimately want, leavingNiko Matsakis-6/+52
a FIXME for later.
2016-01-16Detect cycles and specialize error reporting for Sized. It is importantNiko Matsakis-7/+224
to get the `Sized` error usable, since that hits new users frequently. Further work is needed for the error reporting for non-Sized cycle cases; those currently just fallback to the old path. Also adjust tests.
2016-01-16Permit coinductive match only for purely OIBIT backtraces.Niko Matsakis-11/+38
Better safe than sorry.
2016-01-16Fix bug in new stall checking code, it should consider integer variablesNiko Matsakis-1/+1
too.
2016-01-16fallout from removing the `errors_will_be_reported` flagNiko Matsakis-30/+35
2016-01-16only insert global predicates into the global cache once we'veNiko Matsakis-36/+27
completely proven them to be true
2016-01-16enable coinductive reasoning for structural traits, this isNiko Matsakis-0/+13
potentially just a stopgap measure
2016-01-16Auto merge of #30930 - oli-obk:fix/30887, r=arielb1bors-102/+7
this makes sure the checks run before typeck (which might use the constant or const function to calculate an array length) and gives prettier error messages in case of for loops and such (since they aren't expanded yet). fixes #30887 r? @pnkfelix
2016-01-16Auto merge of #30896 - petrochenkov:vkindmeta, r=alexcrichtonbors-8/+3
Also add tests for use of empty structs in cross-crate scenarios Some tests are commented out, they depend on fixes from https://github.com/rust-lang/rust/pull/30882
2016-01-15Auto merge of #30878 - brson:raw-pointer-derive, r=brsonbors-36/+157
This adds back the raw_pointer_derive lint as a 'removed' lint, so that its removal does not cause errors (#30346) but warnings. In the process I discovered regressions in the code for renamed and removed lints, which didn't appear to have any tests. The addition of a second lint pass (ast vs. hir) meant that attributes were being inspected twice, renamed and removed warnings printed twice. I restructured the code so these tests are only done once and added tests. Unfortunately it makes the patch more complicated for the needed beta backport. r? @nikomatsakis
2016-01-15Auto merge of #30446 - michaelwu:associated-const-type-params-pt1, ↵bors-21/+30
r=nikomatsakis This provides limited support for using associated consts on type parameters. It generally works on things that can be figured out at trans time. This doesn't work for array lengths or match arms. I have another patch to make it work in const expressions. CC @eddyb @nikomatsakis
2016-01-15Preserve struct/variant kinds in metadataVadim Petrochenkov-8/+3
Add tests for use of empty structs in cross-crate scenarios
2016-01-15Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichtonbors-15/+1
This wasn't done in https://github.com/rust-lang/rust/pull/29083 because attributes weren't parsed on fields of tuple variant back then. r? @alexcrichton
2016-01-15move const block checks before lowering stepOliver Schneider-102/+7
this makes sure the checks run before typeck (which might use the constant or const function to calculate an array length) and gives prettier error messages in case of for loops and such (since they aren't expanded yet).
2016-01-15Rollup merge of #30787 - nikomatsakis:future-incompatible-lint, r=brsonManish Goregaokar-10/+38
There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details. Example message: ``` type-parameter-invalid-lint.rs:14:8: 14:9 error: defaults for type parameters are only allowed on type definitions, like `struct` or `enum` type-parameter-invalid-lint.rs:14 fn avg<T=i32>(_: T) {} ^ type-parameter-invalid-lint.rs:14:8: 14:9 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! type-parameter-invalid-lint.rs:14:8: 14:9 note: for more information, see PR 30742 <https://github.com/rust-lang/rust/pull/30724> type-parameter-invalid-lint.rs:11:9: 11:28 note: lint level defined here type-parameter-invalid-lint.rs:11 #![deny(future_incompatible)] ^~~~~~~~~~~~~~~~~~~ error: aborting due to previous error ``` r? @brson I would really like feedback also on the specific messages! Fixes #30746
2016-01-15Auto merge of #30711 - nrc:json-errs, r=huonwbors-72/+124
The compiler can emit errors and warning in JSON format. This is a more easily machine readable form then the usual error output. Closes #10492, closes #14863.
2016-01-15Address reviewer commentsNick Cameron-61/+61
[breaking-change] `OptLevel` variants are no longer `pub use`ed by rust::session::config. If you are using these variants, you must change your code to prefix the variant name with `OptLevel`.
2016-01-14Support generic associated constsMichael Wu-21/+30
2016-01-14rustc: Fix bugs in renamed and removed lints and re-add raw_pointer_deriveBrian Anderson-36/+157
cc #30346
2016-01-15Implement JSON error emissionNick Cameron-2/+2
[breaking-change] syntax::errors::Handler::new has been renamed to with_tty_emitter Many functions which used to take a syntax::errors::ColorConfig, now take a rustc::session::config::ErrorOutputType. If you previously used ColorConfig::Auto as a default, you should now use ErrorOutputType::default().
2016-01-15Add an --output option for specifying an error emitterNick Cameron-54/+106
2016-01-14Revert "Link with ld.gold by default"Brian Anderson-2/+0
This reverts commit 34dc0e0739e19811850f82f1e45b61ba97adc96e.
2016-01-14switch the fulfillment context to use the new obligation forest;Niko Matsakis-129/+90
this commit won't build because, as of this version, no coinductive reasoning at all is really supported
2016-01-14modify trait checker to track the variables on which trait resolution isNiko Matsakis-46/+69
stalled rather than keeping this annoying mark; I checked that the original compile-time regression that the mark was intended to fix (https://github.com/rust-lang/rust/issues/18208) was still reasonable, but I've not done exhaustive measurements to see how important this "optimization" really is anymore
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-15/+1
2016-01-14Rollup merge of #30835 - kraai:show-span, r=sanxiynManish Goregaokar-4/+2
I think this will fix #30656.
2016-01-13improve use of `,` vs `;`Niko Matsakis-2/+2
2016-01-13s/HARD ERROR/hard error/ -- perhaps the warning is enoughNiko Matsakis-1/+1
2016-01-12use fileline_ and not full span_ for the followon messagesNiko Matsakis-2/+2
2016-01-12Revamp the "future incompatible" section to clarify the situationNiko Matsakis-10/+38
better
2016-01-11Replace --show-span with -Z show-spanMatt Kraai-4/+2
2016-01-11Rollup merge of #30768 - steveklabnik:gh28953, r=alexcrichtonSimonas Kazlauskas-0/+24
Fixes #28953
2016-01-11Rollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoeristerSimonas Kazlauskas-2/+11
Previously it was returning a clone, mostly for the two reasons: * Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection); * There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)). However, I’m now convinced this is an invalid approach. Namely the users which want a mutable reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR, since the Lvalue modified is merely a clone. Instead, we have two accessors `destination` and `destination_mut` which return a reference to the destination in desired mode. r? @nikomatsakis
2016-01-11Rollup merge of #30737 - Ms2ger:MutateMode, r=sanxiynSimonas Kazlauskas-10/+12