about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-11-22Auto merge of #56147 - petrochenkov:impice, r=nikomatsakisbors-0/+67
resolve: Fix some asserts in import validation The asserts are not actually correct in presence of ambiguity errors. Fixes https://github.com/rust-lang/rust/issues/56125
2018-11-21Auto merge of #56065 - oli-obk:min_const_fn_loop_ice, r=davidtwcobors-0/+13
Replace the ICEing on const fn loops with an error fixes #56035
2018-11-22resolve: Fix some asserts in import validationVadim Petrochenkov-0/+67
2018-11-21Auto merge of #56117 - petrochenkov:iempty, r=eddybbors-0/+11
resolve: Make "empty import canaries" invisible from other crates Empty imports `use prefix::{};` are desugared into `use prefix::{self as _};` to make sure the prefix is checked for privacy/stability/etc. This caused issues in cross-crate scenarios because gensyms are lost in crate metadata (the `_` is a gensym). Fixes https://github.com/rust-lang/rust/issues/55811
2018-11-21resolve: Make "empty import canaries" invisible from other cratesVadim Petrochenkov-0/+11
2018-11-21Add a couple more testsVadim Petrochenkov-3/+33
2018-11-21Stabilize `extern_crate_item_prelude`Vadim Petrochenkov-130/+0
2018-11-20Auto merge of #55720 - RalfJung:const-eval-raw, r=oli-obkbors-28/+36
Make const_eval_raw query return just an AllocId r? @oli-obk
2018-11-20Auto merge of #55663 - varkor:must_use-traits, r=estebankbors-0/+36
Allow #[must_use] on traits Addresses https://github.com/rust-lang/rust/issues/55506, but we'll probably want to add it to some library traits like `Iterator` before the issue is considered fixed. Fixes https://github.com/rust-lang/rust/issues/51560. `#[must_use]` is already permitted on traits, with no effect, so this seems like a bug fix, but I might be overlooking something. This currently warns for `impl Trait` or `dyn Trait` when the `Trait` is `#[must_use]` (although I don't think the latter is currently possible, so it's simply future-proofed).
2018-11-20Auto merge of #55983 - oli-obk:static_, r=Mark-Simulacrumbors-0/+33
Fix stability hole with `static _` The `underscore_const_names` only gated const items with `_` as the name. `static _: () = ();` works on beta without feature gates right now, this PR fixes that.
2018-11-19we now do proper validation on scalarsRalf Jung-14/+14
2018-11-19Make const_eval_raw query return just an AllocIdRalf Jung-19/+27
2018-11-19Auto merge of #55971 - SergioBenitez:skip-non-semantic, r=alexcrichtonbors-0/+112
Ignore non-semantic tokens for 'probably_eq' streams. Improves the situation in #43081 by skipping typically non-semantic tokens when checking for 'probably_eq'. r? @alexcrichton
2018-11-19Test for #[must_use] on traitsvarkor-0/+36
2018-11-19Auto merge of #56051 - pietroalbini:rollup, r=pietroalbinibors-246/+632
Rollup of 25 pull requests Successful merges: - #55562 (Add powerpc- and powerpc64-unknown-linux-musl targets) - #55564 (test/linkage-visibility: Ignore on musl targets) - #55827 (A few tweaks to iterations/collecting) - #55834 (Forward the ABI of the non-zero sized fields of an union if they have the same ABI) - #55857 (remove unused dependency) - #55862 (in which the E0618 "expected function" diagnostic gets a makeover) - #55867 (do not panic just because cargo failed) - #55894 (miri enum discriminant handling: Fix treatment of pointers, better error when it is undef) - #55916 (Make miri value visitor useful for mutation) - #55919 (core/tests/num: Simplify `test_int_from_str_overflow()` test code) - #55923 (reword #[test] attribute error on fn items) - #55949 (ty: return impl Iterator from Predicate::walk_tys) - #55952 (Update to Clang 7 on CI.) - #55953 (#53488 Refactoring UpvarId) - #55962 (rustdoc: properly calculate spans for intra-doc link resolution errors) - #55963 (Stress test for MPSC) - #55968 (Clean up some non-mod-rs stuff.) - #55970 (Miri backtrace improvements) - #56007 (CTFE: dynamically make sure we do not call non-const-fn) - #56011 (Replace data.clone() by Arc::clone(&data) in mutex doc.) - #56012 (avoid shared ref in UnsafeCell::get) - #56016 (Add VecDeque::resize_with) - #56027 (docs: Add missing backtick in object_safety.rs docs) - #56043 (remove "approx env bounds" if we already know from trait) - #56059 (Increase `Duration` approximate equal threshold to 1us)
2018-11-19Rollup merge of #56059 - alexcrichton:fix-tests, r=sfacklerkennytm-0/+27
Increase `Duration` approximate equal threshold to 1us Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes #56034
2018-11-19Rollup merge of #56043 - nikomatsakis:issue-55756-via-outlives, r=eddybPietro Albini-0/+37
remove "approx env bounds" if we already know from trait Alternative to https://github.com/rust-lang/rust/pull/55988 that fixes #55756 -- smaller fix that I cannot see having (correctness) repercussions beyond the test at hand, and hence better for backporting. (Famous last words, I know.) r? @eddyb
2018-11-19Rollup merge of #56007 - RalfJung:non-const-call, r=oli-obkPietro Albini-6/+49
CTFE: dynamically make sure we do not call non-const-fn I'd love to have a test case for this, but I don't know how. I am also really surprised by this test case that changed behavior: Why did it even start execution if it already determined that it shouldn't?!? r? @oli-obk
2018-11-19Rollup merge of #55970 - RalfJung:miri-backtrace, r=@oli-obkPietro Albini-51/+51
Miri backtrace improvements Nicer pretty-printing of the `RUST_CTFE_BACKTRACE`-backtraces: ``` 0: backtrace::backtrace::libunwind::trace::hc410fcb66fe85b11 at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/libunwind.rs:53 backtrace::backtrace::trace::h2106294a22648407 at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/mod.rs:42 1: backtrace::capture::Backtrace::new_unresolved::h5d8d98b993d092ba at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:88 2: <rustc::mir::interpret::error::EvalError<'tcx> as core::convert::From<rustc::mir::interpret::error::EvalErrorKind<'tcx, u64>>>::from::h6355269b2a661412 at librustc/mir/interpret/error.rs:236 3: <T as core::convert::Into<U>>::into::h70fcb917509539bd at /home/r/src/rust/rustc.2/src/libcore/convert.rs:455 4: <rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, miri::Evaluator<'tcx>> as miri::fn_call::EvalContextExt<'tcx, 'mir>>::emulate_foreign_item::h9cde0e3ce7455a4a at src/fn_call.rs:292 5: <rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, miri::Evaluator<'tcx>> as miri::fn_call::EvalContextExt<'tcx, 'mir>>::find_fn::h83f89524b9d1a49a at src/fn_call.rs:74 6: <miri::Evaluator<'tcx> as rustc_mir::interpret::machine::Machine<'a, 'mir, 'tcx>>::find_fn::hf9980473c4775f0c at src/lib.rs:345 rustc_mir::interpret::terminator::<impl rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, M>>::eval_fn_call::h401dec4a687f96e9 at /home/r/src/rust/rustc.2/src/librustc_mir/interpret/terminator.rs:285 ``` Indentation is now consistent with `RUST_BACKTRACE`, and the frame number is not repeated when there are multiple symbols for a frame. Also preserve the `ty::Instance` for the internal backtrace (showing which frames in the user code where on the interpreter stack when the error happened), used by miri to avoid printing spans for libstd internals: ``` error[E0080]: constant evaluation error: the evaluated program panicked --> /home/r/src/rust/rustc.2/src/libstd/panicking.rs:525:9 | 525 | __rust_start_panic(obj as usize) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked | = note: inside call to `std::panicking::rust_panic` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:496:5 = note: inside call to `std::panicking::rust_panic_with_hook` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:390:5 = note: inside call to `std::panicking::continue_panic_fmt` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:345:5 note: inside call to `std::rt::begin_panic_fmt` at <::std::macros::panic macros>:8:1 --> tests/compile-fail/panic.rs:4:5 | 4 | assert_eq!(5, 6); | ^^^^^^^^^^^^^^^^^ = note: inside call to `main` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:74:34 = note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/rt.rs:59:75 = note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/sys_common/backtrace.rs:136:5 = note: inside call to `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1/1:1913 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:59:13 = note: inside call to closure at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:310:40 = note: inside call to `std::panicking::try::do_call::<[closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/panicking.rs:306:5 = note: inside call to `std::panicking::try::<i32, [closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/src/rust/rustc.2/src/libstd/panic.rs:398:9 = note: inside call to `std::panic::catch_unwind::<[closure@DefId(1/1:1912 ~ std[78f0]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:58:25 = note: inside call to `std::rt::lang_start_internal` at /home/r/src/rust/rustc.2/src/libstd/rt.rs:74:5 = note: inside call to `std::rt::lang_start::<()>` ``` Also notice that we show filenames and line numbers here now. r? @oli-obk
2018-11-19Rollup merge of #55968 - ehuss:non-mod-rs-tests, r=petrochenkovPietro Albini-150/+44
Clean up some non-mod-rs stuff. This includes the following: - Remove unused `non_modrs_mods` from `ParseSess` which as only used for feature gate diagnostics. - Remove the vestiges of the feature gate tests in `test/ui`, they were only partially removed during stabilization. - Fix the run-pass test, it was accidentally removed during stabilization. - Add a ui test to verify error behavior for missing inline-nested mods. - Add some tests for `#[path]` for inline-nested mods (both mod and non-mod-rs). - Enable the diagnostic tests on windows, they should be fixed by #49478. cc @cramertj
2018-11-19Rollup merge of #55963 - stepancheg:mpsc-take-2, r=alexcrichtonPietro Albini-0/+172
Stress test for MPSC `concurrent_recv_timeout_and_upgrade` reproduces a problem 100% times on my MacBook with command: ``` ./x.py test --stage 0 ./src/test/run-pass/mpsc_stress.rs ``` Thus it is commented out. Other tests cases were useful for catching another test cases which may arise during the fix. This diff is a part of my previous rewrite attempt: #42883 CC #39364
2018-11-19Rollup merge of #55962 - QuietMisdreavus:tricky-spans, r=GuillaumeGomezPietro Albini-0/+37
rustdoc: properly calculate spans for intra-doc link resolution errors Fixes https://github.com/rust-lang/rust/issues/55723 When rustdoc is reporting a resolution error for intra-doc links, it needs to convert a span from one relative to the *markdown* (as the links are only found on the final markdown text) to one relative to the *source code* (as the error reporting is meant to show where the line is in the source, so the user can fix it). However, a calculation for how much "offset" to apply had a subtle error: it trimmed the whole line when attempting to account for leading indentation. This caused it to add in *trailing* whitespace into this calculation, which created an incorrect span. In a lot of situations, this isn't a problem - the span will be shifted in the code slightly, but the warning will still be displayed and mostly legible. However, there is one important situation where this can cause an ICE: multi-byte codepoints. If a shifted span now has a starting point in the middle of a multi-byte codepoint, libsyntax will panic when trying to track what source item it corresponds to. This flew under our radar because trailing whitespace and multi-byte codepoints are both situations that we don't run into in the compiler repo. (There is one more situation where this can error, that will be much harder to fix: block-style doc comments. Lines in a block-style doc comment have a zero-or-more (usually one) character offset per line, causing this calculation to be way off. I'm punting that to another issue, though...)
2018-11-19Replace the ICEing on const fn loops with an errorOliver Scherer-0/+13
2018-11-19Auto merge of #56042 - petrochenkov:nuni, r=petrochenkovbors-613/+1203
[nightly] resolve: Implement uniform paths 2.0 Forward-port of https://github.com/rust-lang/rust/pull/55884 to nightly. r? @ghost
2018-11-18Rollup merge of #55923 - Zeegomo:master, r=estebankPietro Albini-0/+39
reword #[test] attribute error on fn items fix of [#55787](https://github.com/rust-lang/rust/issues/55787) Reworded error message from "#[test] attribute is only allowed on fn items" to "#[test] attribute is only allowed on non associated functions"
2018-11-18Rollup merge of #55894 - RalfJung:validation-enums, r=oli-obkPietro Albini-20/+33
miri enum discriminant handling: Fix treatment of pointers, better error when it is undef r? @oli-obk
2018-11-18Rollup merge of #55862 - zackmdavis:but_will_they_come_when_you_call_them, ↵Pietro Albini-28/+97
r=estebank in which the E0618 "expected function" diagnostic gets a makeover A woman of wisdom once told me, "Better late than never." (Can't reopen the previously-closed pull request from six months ago [due to GitHub limitations](https://github.com/rust-lang/rust/pull/51098#issuecomment-437647157).) Now the main span focuses on the erroneous not-a-function callee, while showing the entire call expression is relegated to a secondary span. In the case where the erroneous callee is itself a call, we point out the definition, and, if the call expression spans multiple lines, tentatively suggest a semicolon (because we suspect that the "outer" call is actually supposed to be a tuple). ![not_a_fn_1](https://user-images.githubusercontent.com/1076988/48309935-96755000-e538-11e8-9390-02a048abb0c2.png) ![not_a_fn_2](https://user-images.githubusercontent.com/1076988/48309936-98d7aa00-e538-11e8-8b9b-257bc77d6261.png) The new `bug!` assertion is, in fact, safe (`confirm_builtin_call` is only called by `check_call`, which is only called with a first arg of kind `ExprKind::Call` in `check_expr_kind`). Resolves #51055. r? @estebank
2018-11-18Rollup merge of #55834 - ogoffart:union-abi, r=eddybPietro Albini-0/+80
Forward the ABI of the non-zero sized fields of an union if they have the same ABI This is supposed to fix the performence regression of using MaybeUninit in https://github.com/rust-lang/rust/pull/54668
2018-11-18Rollup merge of #55564 - smaeul:test-fixes-2, r=alexcrichtonPietro Albini-0/+2
test/linkage-visibility: Ignore on musl targets DynamicLibrary uses libc's dlsym() function internally to find symbols. Some implementations of dlsym(), like musl's, only look at dynamically- exported symbols, as found in shared libraries. To also export symbols from the main executable, pass --export-dynamic to the linker. (Plus see [here](https://stackoverflow.com/questions/4184017) and [here](https://stackoverflow.com/questions/6121838) for examples of where this is necessary on glibc as well.)
2018-11-18Auto merge of #55672 - RalfJung:miri-extern-types, r=eddybbors-0/+27
miri: accept extern types in structs if they are the only field Fixes https://github.com/rust-lang/rust/issues/55541 Cc @oli-obk @eddyb https://github.com/rust-lang/rust/issues/43467
2018-11-18remove "approx env bounds" if we already know from traitNiko Matsakis-0/+37
2018-11-18Fix rebaseVadim Petrochenkov-1/+1
2018-11-18Add a couple more tests + address review commentsVadim Petrochenkov-4/+154
2018-11-18resolve: Future-proof against imports referring to local variables and ↵Vadim Petrochenkov-0/+99
generic parameters
2018-11-18resolve: Avoid sentence breaks in diagnosticsVadim Petrochenkov-174/+174
2018-11-18resolve: Support resolving macros without leaving tracesVadim Petrochenkov-0/+13
2018-11-18resolve: Reintroduce feature gate for uniform paths in importsVadim Petrochenkov-52/+110
2018-11-18Fix ICEs from imports of items not defined in modulesVadim Petrochenkov-15/+163
2018-11-18resolve: Tweak some articles in ambiguity diagnosticsVadim Petrochenkov-63/+63
2018-11-18resolve: Recover "did you mean" suggestions in importsVadim Petrochenkov-12/+6
2018-11-18resolve: Check resolution consistency for import paths and multi-segment ↵Vadim Petrochenkov-63/+159
macro paths
2018-11-18resolve: Resolve single-segment imports using in-scope resolution on 2018 ↵Vadim Petrochenkov-3/+15
edition
2018-11-18resolve: More precise determinacy tracking during import/macro resolutionVadim Petrochenkov-6/+6
2018-11-18resolve: Improve diagnostics for resolution ambiguitiesVadim Petrochenkov-283/+303
2018-11-18resolve: Simplify ambiguity checking for built-in attributesVadim Petrochenkov-6/+6
2018-11-17tidy check fixgiacomo-10/+19
2018-11-17add test for #[test] attribute only allowed on non associated functionsgiacomo-0/+30
2018-11-16Ignore non-semantic tokens for 'probably_eq' streams.Sergio Benitez-0/+112
2018-11-16adjust remaining testsRalf Jung-4/+39
2018-11-16CTFE: dynamically make sure we do not call non-const-fnRalf Jung-2/+10