about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-01-17Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fnLeSeulArtichaut-16/+39
2021-01-17Skip linking if it is not requiredMiguel Ojeda-0/+7
This allows to use `--emit=metadata,obj` and other metadata + non-link combinations. Fixes #81117. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-17rustc_parse_format: Fix character indices in find_skipsÖmer Sinan Ağacan-0/+24
Fixes #81006
2021-01-17Add regression testoli-0/+44
2021-01-17Rollup merge of #81080 - bugadani:vec-diag, r=oli-obk,m-ou-seMara Bos-33/+21
Force vec![] to expression position only r? `@oli-obk` I went with the lazy way of only changing what broke. I moved the test to ui/macros because the diagnostics no longer give suggestions. Closes #61933
2021-01-17Rollup merge of #80765 - petrochenkov:traitsinscope, r=matthewjasperMara Bos-32/+58
resolve: Simplify collection of traits in scope "Traits in scope" for a given location are collected by walking all scopes in type namespace, collecting traits in them and pruning traits that don't have an associated item with the given name and namespace. Previously we tried to prune traits using some kind of hygienic resolution for associated items, but that was complex and likely incorrect, e.g. in #80762 correction to visibilites of trait items caused some traits to not be in scope anymore. I previously had some comments and concerns about this in https://github.com/rust-lang/rust/pull/65351. In this PR we are doing some much simpler pruning based on `Symbol` and `Namespace` comparisons, it should be enough to throw away 99.9% of unnecessary traits. It is not necessary for pruning to be precise because for trait aliases, for example, we don't do any pruning at all, and precise hygienic resolution for associated items needs to be done in typeck anyway. The somewhat unexpected effect is that trait imports introduced by macros 2.0 now bring traits into scope due to the removed hygienic check on associated item names. I'm not sure whether it is desirable or not, but I think it's acceptable for now. The old check was certainly incorrect because macros 2.0 did bring trait aliases into scope. If doing this is not desirable, then we should come up with some other way to avoid bringing traits from macros 2.0 into scope, that would accommodate for trait aliases as well. --- The PR also contains a couple of pure refactorings - Scope walk is done by using `visit_scopes` instead of a hand-rolled version. - Code is restructured to accomodate for rustdoc that also wants to query traits in scope, but doesn't want to filter them by associated items at all. r? ```@matthewjasper```
2021-01-17Rollup merge of #80635 - sexxi-goose:use-place-instead-of-symbol, ↵Mara Bos-0/+251
r=nikomatsakis` Improve diagnostics when closure doesn't meet trait bound Improves the diagnostics when closure doesn't meet trait bound by modifying `TypeckResuts::closure_kind_origins` such that `hir::Place` is used instead of `Symbol`. Using `hir::Place` to describe which capture influenced the decision of selecting a trait a closure satisfies to (Fn/FnMut/FnOnce, Copy) allows us to show precise path in the diagnostics when `capture_disjoint_field` feature is enabled. Closes rust-lang/project-rfc-2229/issues/21 r? ```@nikomatsakis```
2021-01-17Rollup merge of #80031 - petrochenkov:builtina, r=estebankMara Bos-2/+20
resolve: Reject ambiguity built-in attr vs different built-in attr Fixes https://github.com/rust-lang/rust/issues/79798. Resolution ensures that inert attributes cannot be used through imports like this, but built-in attributes don't go through initial resolution (only through resolution validation), so we have to keep some extra data (the built-in attribute name) to prevent it from happening.
2021-01-17Rollup merge of #79298 - lcnr:new-elysium, r=matthewjasperMara Bos-0/+34
correctly deal with late-bound lifetimes in anon consts adds support for using late bound lifetimes of the parent context in anon consts. ```rust #![feature(const_generics)] const fn inner<'a>() -> usize where &'a (): Sized { 3 } fn test<'a>() { let _: [u8; inner::<'a>()]; } ``` The lifetime `'a` is late bound in `test` so it's not included in its generics but is instead dealt with separately in borrowck. This didn't previously work for anon consts as they have to use the late bound lifetimes of their parent which has to be explicitly handled. r? ```@matthewjasper``` cc ```@varkor``` ```@eddyb```
2021-01-17Force vec! to expressions onlyDániel Buga-33/+21
2021-01-17Auto merge of #78818 - scottmcm:as_rchunks, r=KodrAusbors-0/+33
Add `as_rchunks` (and friends) to slices `@est31` mentioned (https://github.com/rust-lang/rust/issues/76354#issuecomment-717027175) that, for completeness, there needed to be an `as_chunks`-like method that chunks from the end (with the remainder at the beginning) like `rchunks` does. So here's a PR for `as_rchunks: &[T] -> (&[T], &[[T; N]])` and `as_rchunks_mut: &mut [T] -> (&mut [T], &mut [[T; N]])`. But as I was doing this and copy-pasting `from_raw_parts` calls, I thought that I should extract that into an unsafe method. It started out a private helper, but it seemed like `as_chunks_unchecked` could be reasonable as a "real" method, so I added docs and made it public. Let me know if you think it doesn't pull its weight.
2021-01-17Auto merge of #80942 - c410-f3r:tests-tests-tests, r=petrochenkovbors-66/+0
Move some tests to more reasonable directories - 2 All tests with a score equal or greater than 1.0 were moved to their respective directories by issuing ```bash cat FILE | tr -s " " | tr -d '():' | sort -k3 | awk '$3 >= 1' | cut -d " " -f1-2 | sed 's;\\;/;g' | xargs -n2 git mv ``` **Observation**: The first column values is the only column with results greater zero To attest the confidentiality of the model, some manual revision of at least of tests is needed and this process will be tracked in the following list: * `src/test/ui/abi/issue-28676.rs` OK #28676 * `src/test/ui/array-slice-vec/issue-15730.rs` OK * `src/test/ui/associated-types/issue-24338.rs` OK #54823 * `src/test/ui/associated-types/issue-48551.rs` Looks OK #48551 * `src/test/ui/associated-types/issue-50301.rs` Looks OK #63577 ... cc #73494 r? `@petrochenkov`
2021-01-16don't suggest erroneous trailing comma after `..`Zack M. Davis-5/+44
In #76612, suggestions were added for missing fields in patterns. However, the suggestions are being inserted just at the end of the last field in the pattern—before any trailing comma after the last field. This resulted in the "if you don't care about missing fields" suggestion to recommend code with a trailing comma after the field ellipsis (`..,`), which is actually not legal ("`..` must be at the end and cannot have a trailing comma")! Incidentally, the doc-comment on `error_unmentioned_fields` was using `you_cant_use_this_field` as an example field name (presumably copy-paste inherited from the description of Issue #76077), but the present author found this confusing, because unmentioned fields aren't necessarily unusable. The suggested code in the diff this commit introduces to `destructuring-assignment/struct_destructure_fail.stderr` doesn't work, but it didn't work beforehand, either (because of the "found reserved identifier `_`" thing), so you can't really call it a regression; it could be fixed in a separate PR. Resolves #78511.
2021-01-16fold_with not super_fold_with in TypeFoldable impl for PredicateJack Huey-1/+1
2021-01-16Remove PredicateKind::AtomJack Huey-1/+1
2021-01-16Try ignore-debug in the codegen testScott McMurray-0/+1
This fixed things the last time I had a problem like this. And plausibly will here too -- the check it's failing on is for the high bit being set in the length of the slice, which is a check that's only in a debug_assert.
2021-01-17resolve: Reject ambiguity built-in attr vs different built-in attrVadim Petrochenkov-2/+20
2021-01-16Move some tests to more reasonable directories - 2Caio-66/+0
Address comments Update limits
2021-01-16Auto merge of #81089 - m-ou-se:rollup-z7iac6i, r=m-ou-sebors-2/+163
Rollup of 17 pull requests Successful merges: - #78455 (Introduce {Ref, RefMut}::try_map for optional projections in RefCell) - #80144 (Remove giant badge in README) - #80614 (Explain why borrows can't be held across yield point in async blocks) - #80670 (TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips) - #80681 (Clarify what the effects of a 'logic error' are) - #80764 (Re-stabilize Weak::as_ptr and friends for unsized T) - #80901 (Make `x.py --color always` apply to logging too) - #80902 (Add a regression test for #76281) - #80941 (Do not suggest invalid code in pattern with loop) - #80968 (Stabilize the poll_map feature) - #80971 (Put all feature gate tests under `feature-gates/`) - #81021 (Remove doctree::Import) - #81040 (doctest: Reset errors before dropping the parse session) - #81060 (Add a regression test for #50041) - #81065 (codegen_cranelift: Fix redundant semicolon warn) - #81069 (Add sample code for Rc::new_cyclic) - #81081 (Add test for #34792) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-16correctly deal with late-bound lifetimes in anon constsBastian Kauschke-0/+34
2021-01-16Rollup merge of #81081 - bugadani:double-partialeq, r=Mark-SimulacrumMara Bos-0/+16
Add test for #34792 Closes #34792
2021-01-16Rollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-SimulacrumMara Bos-0/+34
Add a regression test for #50041 AFAICT the test case never landed alongside the fix for the issue.
2021-01-16Rollup merge of #81040 - osa1:fix_80992, r=jyn514Mara Bos-0/+17
doctest: Reset errors before dropping the parse session The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes #80992
2021-01-16Rollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514Mara Bos-2/+5
Remove doctree::Import Per the title. Part of cleaning up doctree
2021-01-16Rollup merge of #80971 - camelid:feature-gate-testsuite-organization, ↵Mara Bos-0/+0
r=Mark-Simulacrum Put all feature gate tests under `feature-gates/` There was one directory that had only a single test and there was also a test in the top-level directory. This moves both of them to `feature-gates/`.
2021-01-16Rollup merge of #80941 - JohnTitor:ref-mut-pat-in-loops, r=varkorMara Bos-0/+25
Do not suggest invalid code in pattern with loop Fixes #80913
2021-01-16Rollup merge of #80902 - JohnTitor:issue-76281, r=Mark-SimulacrumMara Bos-0/+12
Add a regression test for #76281 This has been fixed between 1.47.0-nightly (663d2f5cd 2020-08-22) and 1.47.0-nightly (5180f3da5 2020-08-23). Maybe fixed by #73526? Created `wasm` dir, it currently has only one test but I'll move some wasm-related tests there as a follow-up. Closes #76281
2021-01-16Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandryMara Bos-0/+54
Explain why borrows can't be held across yield point in async blocks For https://github.com/rust-lang/rust/issues/78938.
2021-01-16Auto merge of #80290 - RalfJung:less-intrinsic-write, r=lcnrbors-312/+0
implement ptr::write without dedicated intrinsic This makes `ptr::write` more consistent with `ptr::write_unaligned`, `ptr::read`, `ptr::read_unaligned`, all of which are implemented in terms of `copy_nonoverlapping`. This means we can also remove `move_val_init` implementations in codegen and Miri, and its special handling in the borrow checker. Also see [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/ptr.3A.3Aread.20vs.20ptr.3A.3Awrite).
2021-01-16Add test for #34792Dániel Buga-0/+16
2021-01-16Target stack-probe support configurable finelySimonas Kazlauskas-0/+1
This adds capability to configure the target's stack probe support in a more precise manner than just on/off. In particular now we allow choosing between always inline-asm, always call or either one of those depending on the LLVM version on a per-target basis.
2021-01-16Add a regression test for #76281Yuki Okushi-0/+12
This has been fixed between 1.47.0-nightly (663d2f5cd 2020-08-22) and 1.47.0-nightly (5180f3da5 2020-08-23).
2021-01-15Add `as_rchunks` (and friends) to slicesScott McMurray-0/+32
2021-01-16fix line numbersChris Pardy-25/+25
2021-01-16Add a testÖmer Sinan Ağacan-0/+17
2021-01-16Auto merge of #77885 - erikdesjardins:probeasm, r=cuviperbors-1/+44
Use probe-stack=inline-asm in LLVM 11+ Fixes (?) #74405, related to #43241 r? `@cuviper`
2021-01-15fix tidyChris Pardy-5/+2
2021-01-15Improve diagnostics for Precise CaptureChris Pardy-2/+436
2021-01-16Add a regression test for #50041Simonas Kazlauskas-0/+34
AFAICT the test case never landed alongside the fix for the issue.
2021-01-15Don't mark `ineffective_unstable_trait_impl` as an internal lintJoshua Nelson-2/+2
It's not an internal lint: - It's not in the rustc::internal lint group - It's on unconditionally, because it actually lints `staged_api`, not the compiler This fixes a bug where `#[deny(rustc::internal)]` would warn that `rustc::internal` was an unknown lint.
2021-01-15Make hitting the recursion limit in projection non-fatalMatthew Jasper-1/+60
This is relied on by wundergraph.
2021-01-15Add warning to compare.py about error messagesRune Tynan-0/+3
2021-01-15Fix JSON testRune Tynan-2/+2
2021-01-15Add test for #59352Dániel Buga-0/+139
2021-01-15Rollup merge of #81008 - tmiasko:generator-layout-err, r=tmandryYuki Okushi-0/+37
Don't ICE when computing a layout of a generator tainted by errors Fixes #80998.
2021-01-15Rollup merge of #80834 - bugadani:vecdeque, r=oli-obkYuki Okushi-0/+19
Remove unreachable panics from VecDeque::{front/back}[_mut] `VecDeque`'s `front`, `front_mut`, `back` and `back_mut` methods are implemented in terms of the index operator, which causes these functions to contain [unreachable panic calls](https://rust.godbolt.org/z/MTnq1o). This PR reimplements these methods in terms of `get[_mut]` instead.
2021-01-15Rollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebankYuki Okushi-0/+37
Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv` Fixes #80233 We already have logic in `evaluate_predicates` that tries to add unimplemented predicates to our `ParamEnv`. Trying to add a predicate that already holds can lead to errors later on, since projection will prefer trait candidates from the `ParamEnv` to predicates from an impl.
2021-01-14Use probe-stack=inline-asm in LLVM 11+Erik Desjardins-1/+44
2021-01-14Auto merge of #81018 - m-ou-se:rollup-7202dc7, r=m-ou-sebors-2/+239
Rollup of 17 pull requests Successful merges: - #79982 (Add missing methods to unix ExitStatusExt) - #80017 (Suggest `_` and `..` if a pattern has too few fields) - #80169 (Recommend panic::resume_unwind instead of panicking.) - #80217 (Add a `std::io::read_to_string` function) - #80444 (Add as_ref and as_mut methods for Bound) - #80567 (Add Iterator::intersperse_with) - #80829 (Get rid of `DepConstructor`) - #80895 (Fix handling of malicious Readers in read_to_end) - #80966 (Deprecate atomic::spin_loop_hint in favour of hint::spin_loop) - #80969 (Use better ICE message when no MIR is available) - #80972 (Remove unstable deprecated Vec::remove_item) - #80973 (Update books) - #80980 (Fixed incorrect doc comment) - #80981 (Fix -Cpasses=list and llvm version print with -vV) - #80985 (Fix stabilisation version of slice_strip) - #80990 (llvm: Remove the unused context from CreateDebugLocation) - #80991 (Fix formatting specifiers doc links) Failed merges: - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`) r? `@ghost` `@rustbot` modify labels: rollup
2021-01-14Remove unreachable panics from VecDequeDániel Buga-0/+19