Ralf Jung
303dbccf04
CTFE: dynamically make sure we do not call non-const-fn
2018-11-16 18:05:08 +01:00
bors
485397e49a
Auto merge of #55589 - oli-obk:min_length_ 💣 , r=pnkfelix
...
Add `VariantIdx` type and use instead of `usize`
2018-11-13 07:04:14 +00:00
bors
65204a97d4
Auto merge of #55278 - Centril:constification-1, r=alexcrichton
...
Minor standard library constification
This PR makes some bits of the standard library into `const fn`s.
I've tried to be as aggressive as I possibly could in the constification.
The list is rather small due to how restrictive `const fn` is at the moment.
r? @oli-obk cc @rust-lang/libs
Stable public APIs affected:
+ [x] `Cell::as_ptr`
+ [x] `UnsafeCell::get`
+ [x] `char::is_ascii`
+ [x] `iter::empty`
+ [x] `ManuallyDrop::{new, into_inner}`
+ [x] `RangeInclusive::{start, end}`
+ [x] `NonNull::as_ptr`
+ [x] `{[T], str}::as_ptr`
+ [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}`
+ [x] `CStr::as_ptr`
+ [x] `Ipv4Addr::is_unspecified`
+ [x] `Ipv6Addr::new`
+ [x] `Ipv6Addr::octets`
Unstable public APIs affected:
+ [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}`
+ [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}`
+ [x] `core::convert::identity`
--------------------------
## Removed from list in first pass:
Stable public APIs affected:
+ [ ] `BTree{Map, Set}::{len, is_empty}`
+ [ ] `VecDeque::is_empty`
+ [ ] `String::{is_empty, len}`
+ [ ] `FromUtf8Error::utf8_error`
+ [ ] `Vec<T>::{is_empty, len}`
+ [ ] `Layout::size`
+ [ ] `DecodeUtf16Error::unpaired_surrogate`
+ [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}`
+ [ ] `panic::Location::{file, line, column}`
+ [ ] `{ChunksExact, RChunksExact}::remainder`
+ [ ] `Utf8Error::valid_up_to`
+ [ ] `VacantEntry::key`
+ [ ] `NulError::nul_position`
+ [ ] `IntoStringError::utf8_error`
+ [ ] `IntoInnerError::error`
+ [ ] `io::Chain::get_ref`
+ [ ] `io::Take::{limit, get_ref}`
+ [ ] `SocketAddrV6::{flowinfo, scope_id}`
+ [ ] `PrefixComponent::{kind, as_os_str}`
+ [ ] `Path::{ancestors, display}`
+ [ ] `WaitTimeoutResult::timed_out`
+ [ ] `Receiver::{iter, try_iter}`
+ [ ] `thread::JoinHandle::thread`
+ [ ] `SystemTimeError::duration`
Unstable public APIs affected:
+ [ ] `core::fmt::Arguments::new_v1`
+ [ ] `core::fmt::Arguments::new_v1_formatted`
+ [ ] `Pin::{get_ref, into_ref}`
+ [ ] `Utf8Lossy::chunks`
+ [ ] `LocalWaker::as_waker`
+ [ ] `panic::PanicInfo::{internal_constructor, message, location}`
+ [ ] `panic::Location::{internal_constructor }`
## Removed from list in 2nd pass:
Stable public APIs affected:
+ [ ] `LinkedList::{new, iter, is_empty, len}`
+ [ ] `mem::forget`
+ [ ] `Cursor::{new, get_ref, position}`
+ [ ] `io::{empty, repeat, sink}`
+ [ ] `PoisonError::new`
+ [ ] `thread::Builder::new`
+ [ ] `process::Stdio::{piped, inherit, null}`
Unstable public APIs affected:
+ [ ] `io::Initializer::{zeroing, should_initialize}`
2018-11-12 18:54:11 +00:00
Oliver Scherer
b174b0b955
miri-engine value visitor update to VariantIdx
2018-11-12 14:24:45 +01:00
Pietro Albini
0f1c1eb480
Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb
...
Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`
cc @pnkfelix
fixes #55806
2018-11-11 00:21:23 +01:00
Pietro Albini
e121305abd
Rollup merge of #55792 - oli-obk:propsicle, r=RalfJung
...
Prevent ICE in const-prop array oob check
fixes https://github.com/rust-lang/rust/issues/55772
fixes https://github.com/rust-lang/rust/issues/54541
2018-11-11 00:21:14 +01:00
Mazdak Farrokhzad
ac1c6b0378
adjust ui/../mod-static-with-const-fn.rs
2018-11-10 02:36:19 +01:00
Oliver Scherer
c8e23d8c4c
Tidy ♪ all ♪ the ♪ way ♪♪♪♪ with ♪ a ♪ newline ♪ missing ♪ cry ♪♪
2018-11-10 01:11:06 +01:00
Oliver Scherer
56768235e1
Add a few tests around raw pointers and interior mutability
2018-11-10 01:11:06 +01:00
Mazdak Farrokhzad
53fe629417
fix mod-static-with-const-fn.rs.
2018-11-10 01:10:07 +01:00
Mazdak Farrokhzad
88da279e45
--bless mod-static-with-const-fn.stderr
2018-11-10 01:10:07 +01:00
Mazdak Farrokhzad
5b89877dda
constify parts of libcore.
2018-11-10 01:07:32 +01:00
Oliver Scherer
f4c9dd55d6
Add missing rustc_promotable attribute to unsigned min_value and max_value
2018-11-09 17:55:24 +01:00
Oliver Scherer
1206549d1b
Fix tidy
2018-11-09 10:11:20 +01:00
Oliver Scherer
ffa7ce4290
Add more regression tests
2018-11-08 20:18:26 +01:00
Oliver Scherer
df10965dc0
Prevent ICE in const-prop array oob check
2018-11-08 20:15:13 +01:00
bors
653da4fd00
Auto merge of #55532 - pnkfelix:rustc_error-survey, r=nikomatsakis
...
#[rustc_error] survey
Fix #55505
2018-11-08 09:38:49 +00:00
Ralf Jung
3ec89746ba
test diagnostics for more ranges
2018-11-07 14:06:38 +01:00
Ralf Jung
b42b9b34d5
pretty-print scalar range that only has an upper bound
2018-11-07 13:58:43 +01:00
Ralf Jung
9dba743a6a
do not print wrapping ranges like normal ranges in diagnostics
2018-11-07 13:46:49 +01:00
Felix S. Klock II
a2e090624e
Removed #[rustc_error] from tests that are all // compile-pass.
...
I also added `// skip-codegen` to each one, to address potential concerns
that this change would otherwise slow down our test suite spending time
generating code for files that are really just meant to be checks of
compiler diagnostics.
(However, I will say: My preference is to not use `// skip-codegen` if
one can avoid it. We can use all the testing of how we drive LLVM that
we can get...)
(Updated post rebase.)
2018-11-07 13:09:52 +01:00
bors
8315b11b63
Auto merge of #55549 - RalfJung:miri-visitor, r=oli-obk
...
Value visitors for miri
Generalize the traversal part of validation to a `ValueVisitor`.
~~This includes https://github.com/rust-lang/rust/pull/55316 , [click here](https://github.com/RalfJung/rust/compare/retagging...RalfJung:miri-visitor ) for just the new commits.~~
2018-11-07 09:14:12 +00:00
bors
ddd4b194a0
Auto merge of #55262 - oli-obk:dangling_alloc_id_ice, r=RalfJung
...
Change the ICE from #55223 to a hard error
cc @SimonSapin
r? @RalfJung
fixes https://github.com/rust-lang/rust/issues/55287
2018-11-06 23:36:13 +00:00
Ralf Jung
996a42557e
the visitor can already load the value for visit_primitive
2018-11-05 09:40:05 +01:00
Ralf Jung
77c283465c
Also test for undef in enum discriminant
...
The error message is sub-par, but fixing that requries moving ScalarMaybeUndef
to librustc which would conflict badly with another PR that is in flight.
2018-11-05 09:17:48 +01:00
Ralf Jung
fa01e04fbb
fix validation error on non-integer enum discriminants
2018-11-05 09:17:48 +01:00
Ralf Jung
7d7bd9b6c2
reduce the amount of traversal/projection code that the visitor has to implement itself
2018-11-05 09:17:48 +01:00
Samuel Holland
283f2be142
Fix double_check tests on big-endian targets
...
Since the enums get optimized down to 1 byte long, the bits
set in the usize member don't align with the enums on big-endian
machines. Avoid this issue by shrinking the integer member to the
same size as the enums.
2018-11-01 01:03:20 +00:00
kennytm
3176239d34
Rollup merge of #55474 - oli-obk:const_eval_promoted, r=RalfJung
...
Fix validation false positive
Fixes #55454
r? @RalfJung
2018-10-30 18:55:32 +08:00
Oliver Scherer
3ad154f484
Fix wrong validation clasisfication of Option<&T>::Some values
2018-10-29 15:22:47 +01:00
Oliver Scherer
e70b63458a
Turn ICE for dangling pointers into error
2018-10-29 13:14:17 +01:00
memoryruins
fc2aa3fe0e
Add UI test for #49296
2018-10-29 00:09:32 -04:00
Oliver Scherer
c04893afbb
Fix an ICE in the min_const_fn analysis
2018-10-27 13:34:35 +02:00
bors
3e6f30ec3e
Auto merge of #55382 - kennytm:rollup, r=kennytm
...
Rollup of 21 pull requests
Successful merges:
- #54816 (Don't try to promote already promoted out temporaries)
- #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
- #54921 (Add line numbers option to rustdoc)
- #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
- #55258 (Fix Rustdoc ICE when checking blanket impls)
- #55264 (Compile the libstd we distribute with -Ccodegen-unit=1)
- #55271 (Unimplement ExactSizeIterator for MIR traversing iterators)
- #55292 (Macro diagnostics tweaks)
- #55298 (Point at macro definition when no rules expect token)
- #55301 (List allowed tokens after macro fragments)
- #55302 (Extend the impl_stable_hash_for! macro for miri.)
- #55325 (Fix link to macros chapter)
- #55343 (rustbuild: fix remap-debuginfo when building a release)
- #55346 (Shrink `Statement`.)
- #55358 (Remove redundant clone (2))
- #55370 (Update mailmap for estebank)
- #55375 (Typo fixes in configure_cmake comments)
- #55378 (rustbuild: use configured linker to build boostrap)
- #55379 (validity: assert that unions are non-empty)
- #55383 (Use `SmallVec` for the queue in `coerce_unsized`.)
- #55391 (bootstrap: clean up a few clippy findings)
2018-10-26 17:26:56 +00:00
kennytm
68d5fddeef
Rollup merge of #54816 - oli-obk:double_promotion, r=alexreg
...
Don't try to promote already promoted out temporaries
fixes #53201
r? @eddyb
2018-10-26 18:24:54 +08:00
Oliver Schneider
1c5ff292fc
Rebase fallout
2018-10-25 17:20:39 +02:00
Ralf Jung
7ed7fc881e
add the lint back to the list, and fix tests
2018-10-25 16:48:15 +02:00
Ralf Jung
94586bc133
fix ui tests (rebase fallout)
2018-10-25 16:48:15 +02:00
Alexander Regueiro
7c34f2da57
Addressed minor issues brought up in review.
2018-10-25 16:47:35 +02:00
Oliver Schneider
bf8471aeda
Rebase fallout in ui output
2018-10-25 16:47:35 +02:00
Oliver Schneider
6a6b3309e6
update tests to changes on rustc master
2018-10-25 16:47:35 +02:00
Oliver Schneider
0f97048618
Deduplicate all the ~~things~~ errors
2018-10-25 16:47:35 +02:00
Oliver Schneider
7fdf06cdde
Report const eval error inside the query
2018-10-25 16:46:19 +02:00
Matthew Jasper
2a3969a3f7
Use new region infer errors for explaining borrows
...
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:
* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
to a captured variable.
2018-10-21 12:35:00 +01:00
Niko Matsakis
a66ab2bedc
skip user-type annotations if they don't have regions
2018-10-19 09:34:28 -04:00
Niko Matsakis
d5d5e8c5f5
lowering casts in constants now creates multiple uses
...
This can trigger more errors than before. Not sure what is the best
fix here.
2018-10-19 09:34:28 -04:00
bors
74ff7dcb13
Auto merge of #55194 - kennytm:rollup, r=kennytm
...
Rollup of 7 pull requests
Successful merges:
- #54300 (Updated RELEASES.md for 1.30.0)
- #55013 ([NLL] Propagate bounds from generators)
- #55071 (Fix ICE and report a human readable error)
- #55144 (Cleanup resolve)
- #55166 (Don't warn about parentheses on `match (return)`)
- #55169 (Add a `copysign` function to f32 and f64)
- #55178 (Stabilize slice::chunks_exact(), chunks_exact_mut(), rchunks(), rchunks_mut(), rchunks_exact(), rchunks_exact_mut())
2018-10-19 09:29:48 +00:00
kennytm
89ebc6ce4f
Rollup merge of #55071 - oli-obk:const_cast_ 🍨 , r=RalfJung
...
Fix ICE and report a human readable error
fixes #55063
r? @RalfJung
2018-10-19 16:47:42 +08:00
bors
cb5e1b93e3
Auto merge of #55004 - oli-obk:sized_static, r=cramertj
...
Check the type of statics and constants for `Sized`ness
fixes #54410
2018-10-19 00:22:25 +00:00
David Wood
539404b77d
Update output for borrowck=migrate compare mode.
...
This commit updates the test output for the updated NLL compare mode
that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The
previous commit changes `compiletest` and this commit only updates
`.nll.stderr` files.
2018-10-17 00:57:32 +02:00