summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-11-29Don't treat unnormalized function arguments as well-formedjackh726-30/+49
2021-11-26oops...Ellen-0/+30
2021-11-16Properly register text_direction_codepoint_in_comment lint.Hans Kratz-0/+9
(cherry picked from commit 9db9811ddf96dab53f4cd5b4b406d34572259f3c)
2021-11-16apply suggestions from code reviewNiko Matsakis-42/+42
(cherry picked from commit 4154e8acf045a13bf57bc9b3c487f838f17230c8)
2021-11-16handle case of a variable not capturedNiko Matsakis-0/+95
(cherry picked from commit fc8113d04e5ea4ae5c053388b503eb7013006e26)
2021-11-16rework diagnostic reporting to be more structuredNiko Matsakis-45/+56
(cherry picked from commit 76bc02715e3495f66860e1d470d224d2607336a6)
2021-11-16Apply adjustments for field expression even if inaccessibleGary Guo-0/+28
The adjustments are used later by ExprUseVisitor to build Place projections and without adjustments it can produce invalid result. (cherry picked from commit f5560754591532d7cde4c9f5dd51dfbd7670e98f)
2021-11-16add testsb-naber-0/+25
(cherry picked from commit 0199a81304fe7cf07f0d2c718a4243f47c1620ea)
2021-11-16Fix ICE when forgetting to `Box` a parameter to a `Self::func` callJakob Degen-0/+30
(cherry picked from commit 4b970231fd1254580fbddabab74a125404fea0de)
2021-11-16Add regresstion test for #90024.Jakob Degen-0/+37
Uses 2 MCVEs from the issue tracker that test opposite sides of the problem. (cherry picked from commit eae42fd9d0d6e568282a4c782405058b64f1ef0b)
2021-11-15Revert "Do not call getpid wrapper after fork in tests"Josh Stone-35/+7
This reverts commit 12fbabd27f700a59d0e7031f0839b220c3514bcb. It was only needed because of using raw `clone3` instead of `fork`, but we only do that now when a pidfd is requested. (cherry picked from commit e96a0a8681998caf78093b65e746bfd967cb87e9)
2021-11-15Feature gate and make must_not_suspend allow-by-defaultGus Wynn-14/+111
This lint is not yet ready for stable use, primarily due to false positives in edge cases; we want to test it out more before stabilizing. (cherry picked from commit 185fa5625656c5a5cb979397b131d1c8bbadeba9)
2021-10-31Lint against RTL unicode codepoints in literals and commentsEsteban Küber-0/+231
Address CVE-2021-42574.
2021-10-21Add a regression test for #89935Yuki Okushi-0/+18
2021-10-21Revert "Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebank"Yuki Okushi-67/+57
This reverts commit 36a1076d24697621a3bb67ef654b4eb79647aa54, reversing changes made to e1e9319d93aea755c444c8f8ff863b0936d7a4b6.
2021-10-21Fix issue 90038Gary Guo-0/+21
2021-10-17Auto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnrbors-1/+43
polymorphization: shims and predicates Supersedes #75737 and #75414. This pull request includes up some changes to polymorphization which hadn't landed previously and gets stage2 bootstrapping and the test suite passing when polymorphization is enabled. There are still issues with `type_id` and polymorphization to investigate but this should get polymorphization in a reasonable state to work on. - #75737 and #75414 both worked but were blocked on having the rest of the test suite pass (with polymorphization enabled) with and without the PRs. It makes more sense to just land these so that the changes are in. - #75737's changes remove the restriction of `InstanceDef::Item` on polymorphization, so that shims can now be polymorphized. This won't have much of an effect until polymorphization's analysis is more advanced, but it doesn't hurt. - #75414's changes remove all logic which marks parameters as used based on their presence in predicates - given #75675, this will enable more polymorphization and avoid the symbol clashes that predicate logic previously sidestepped. - Polymorphization now explicitly checks (and skips) foreign items, this is necessary for stage2 bootstrapping to work when polymorphization is enabled. - The conditional determining the emission of a note adding context to a post-monomorphization error has been modified. Polymorphization results in `optimized_mir` running for shims during collection where that wouldn't happen previously, some errors are emitted during `optimized_mir` and these were considered post-monomorphization errors with the existing logic (more errors and shims have a `DefId` coming from the std crate, not the local crate), adding a note that resulted in tests failing. It isn't particularly feasible to change where polymorphization runs or prevent it from using `optimized_mir`, so it seemed more reasonable to not change the conditional. - `characteristic_def_id_of_type` was being invoked during partitioning for self types of impl blocks which had projections that depended on the value of unused generic parameters of a function - this caused a ICE in a debuginfo test. If partitioning is enabled and the instance needs substitution then this is skipped. That test still fails for me locally, but not with an ICE, but it fails in a fresh checkout too, so 🤷‍♂️. r? `@lcnr`
2021-10-16Auto merge of #89860 - camsteffen:macro-semi, r=petrochenkovbors-548/+569
Remove trailing semicolon from macro call span Macro call site spans are now less surprising/more consistent since they no longer contain a semicolon after the macro call. The downside is that we need to do a little guesswork to get the semicolon in diagnostics. But this should not be noticeable since it is rare for the semicolon to not immediately follow the macro call.
2021-10-16Rollup merge of #89918 - JohnTitor:gats-tests, r=jackh726Matthias Krüger-0/+55
Add some GATs related regression tests Closes #88287, closes #88405
2021-10-16Rollup merge of #89914 - jackh726:gat_genericboundfailure, r=estebankMatthias Krüger-16/+19
Emit impl difference error for GenericBoundFailure too Fixes #86787 r? ````@estebank````
2021-10-16Rollup merge of #89912 - davidtwco:issue-89280-split-lines-multiple-lines, ↵Matthias Krüger-0/+33
r=oli-obk emitter: current substitution can be multi-line Fixes #89280. In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. r? ````@oli-obk````
2021-10-16Rollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, ↵Matthias Krüger-8/+5
r=oli-obk Stabilize `unreachable_unchecked` as `const fn` Closes #53188 This PR stabilizes `core::hint::unreachable_unchecked` as `const fn`. MIRI is able to detect when this method is called. Stabilization was delayed until `const_panic` was stabilized so as to avoid users calling this method in its place (thus resulting in runtime UB). With #89508, that is no longer an issue. ````@rustbot```` label +A-const-eval +A-const-fn +T-lang +S-blocked (not sure why it's T-lang, but that's what the tracking issue is)
2021-10-16Add some GATs related regression testsYuki Okushi-0/+55
2021-10-15Emit impl difference error for GenericBoundFailure toojackh726-16/+19
2021-10-15emitter: current substitution can be multi-lineDavid Wood-0/+33
In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. Signed-off-by: David Wood <david.wood@huawei.com>
2021-10-15Bless testsCameron Steffen-548/+569
2021-10-15Auto merge of #89903 - matthiaskrgr:rollup-s0c69xl, r=matthiaskrgrbors-74/+111
Rollup of 7 pull requests Successful merges: - #86011 (move implicit `Sized` predicate to end of list) - #89821 (Add a strange test for `unsafe_code` lint.) - #89859 (add dedicated error variant for writing the discriminant of an uninhabited enum variant) - #89870 (Suggest Box::pin when Pin::new is used instead) - #89880 (Use non-checking TLS relocation in aarch64 asm! sym test.) - #89885 (add long explanation for E0183) - #89894 (Remove unused dependencies from rustc_const_eval) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-15Rollup merge of #89885 - cameron1024:long-explanation-E0183, r=GuillaumeGomezMatthias Krüger-3/+4
add long explanation for E0183 Addresses #61137
2021-10-15Rollup merge of #89880 - adamgemmell:dev/nc-relocation, r=AmanieuMatthias Krüger-1/+1
Use non-checking TLS relocation in aarch64 asm! sym test. The checking variant ensures that the offset required is not larger than 12 bits - hence we wouldn't ever need the upper 12 bits. It's unlikely to ever fail in this small test but this is technically correct. This was noticed incidentally when we found that LLD doesn't support the `tprel_lo12` relocation, even though LLVM can apparently generate it when using `-mtls-size=12`.
2021-10-15Rollup merge of #89870 - tmandry:box-pin, r=estebankMatthias Krüger-13/+7
Suggest Box::pin when Pin::new is used instead This fixes an incorrect diagnostic. **Based on #89390**; only the last commit is specific to this PR. "Ignore whitespace changes" also helps here.
2021-10-15Rollup merge of #89821 - crlf0710:unsafe_code_lint_test, r=Mark-SimulacrumMatthias Krüger-0/+32
Add a strange test for `unsafe_code` lint. The current behavior is a little surprising to me. I'm not sure whether people would change it, but at least let me document the current behavior with a test. I learnt about this from the [totally-speedy-transmute](https://docs.rs/totally-speedy-transmute) crate. cc #10599 the original implementation pr.
2021-10-15Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebankMatthias Krüger-57/+67
move implicit `Sized` predicate to end of list In `Bounds::predicates()`, move the implicit `Sized` predicate to the end of the generated list. This means that if there is an explicit `Sized` bound, it will be checked first, and any resulting diagnostics will have a more useful span. Fixes #85998, at least partially. ~~Based on #85979, but only the last 2 commits are new for this pull request.~~ (edit: rebased) A full fix would need to deal with where-clauses, and that seems difficult. Basically, predicates are being collected in multiple stages, and there are two places where implicit `Sized` predicates can be inserted: once for generic parameters, and once for where-clauses. I think this insertion is happening too early, and we should actually do it only at points where we collect all of the relevant trait bounds for a type parameter. I could use some help interpreting the changes to the stderr output. It looks like reordering the predicates changed some diagnostics that don't obviously have anything to do with `Sized` bounds. Possibly some error reporting code is making assumptions about ordering of predicates? The diagnostics for src/test/ui/derives/derives-span-Hash-*.rs seem to have improved, no longer pointing at the type parameter identifier, but src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs became less verbose for some reason. I also ran into an instance of #84970 while working on this, but I kind of expected that could happen, because I'm reordering predicates. I can open a separate issue on that if it would be helpful. ``@estebank`` this seems likely to conflict (slightly?) with your work on #85947; how would you like to resolve that?
2021-10-15Auto merge of #89884 - Mark-Simulacrum:revert-enum-discr, r=wesleywiserbors-8/+114
Revert enum discriminants Reverts stabilization of arbitrary enum discriminants per https://github.com/rust-lang/rust/issues/88621#issuecomment-929482371. Reopens #60553.
2021-10-15Add a test for `unsafe_code` lint.Charles Lew-0/+32
2021-10-14add long explanation for E0183cameron1024-3/+4
2021-10-14Auto merge of #89882 - matthiaskrgr:rollup-1dh7pz8, r=matthiaskrgrbors-16/+46
Rollup of 6 pull requests Successful merges: - #89390 (Fix incorrect Box::pin suggestion) - #89433 (Fix ctrl-c causing reads of stdin to return empty on Windows.) - #89823 (Switch order of terms to prevent overflow) - #89865 (Allow static linking LLVM with ThinLTO) - #89873 (Add missing word to `FromStr` trait documentation) - #89878 (Fix missing remaining compiler specific cfg information) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-14Revert "Stabilize `arbitrary_enum_discriminant`"Mark Rousskov-8/+114
This reverts commit 7a62f29f3171767090949778ce0f161e930706b9.
2021-10-14Rollup merge of #89390 - tmandry:issue-72117, r=estebankMatthias Krüger-16/+46
Fix incorrect Box::pin suggestion The suggestion checked if `Pin<Box<T>>` could be coeerced to the expected type, but did not check predicates created by the coercion. We now look for predicates that definitely cannot be satisfied before giving the suggestion. The suggestion is still marked MaybeIncorrect because we allow predicates that are still ambiguous and can't be proven. Fixes #72117.
2021-10-14Auto merge of #88698 - Noble-Mushtak:master, r=nikomatsakis,oli-obkbors-0/+60
Add check that live_region is live in sanitize_promoted This pull request fixes #88434 by adding a check in `sanitize_promoted` to ensure that only regions which are actually live are added to the `liveness_constraints` of the `BorrowCheckContext`. To implement this change, I needed to add a method to `LivenessValues` which gets the elements contained by a region: /// Returns an iterator of all the elements contained by the region `r` crate fn get_elements(&self, row: N) -> impl Iterator<Item = Location> + '_ Then, inside `sanitize_promoted`, we check whether the iterator returned by this method is non-empty to ensure that the region is actually live at at least one location before adding that region to the `liveness_constraints` of the `BorrowCheckContext`. This is my first pull request to the Rust repo, so any feedback on how I can improve this pull request or if there is a better way to fix this issue would be very appreciated.
2021-10-14Use non-checking TLS relocation in aarch64 asm! sym test.Adam Gemmell-1/+1
The checking variant ensures that the offset required is not larger than 12 bits - hence we wouldn't ever need the upper 12 bits.
2021-10-14Auto merge of #89247 - fee1-dead:const-eval-select, r=oli-obkbors-0/+196
Add `const_eval_select` intrinsic Adds an intrinsic that calls a given function when evaluated at compiler time, but generates a call to another function when called at runtime. See https://github.com/rust-lang/const-eval/issues/7 for previous discussion. r? `@oli-obk.`
2021-10-14Fix const stabilityDeadbeef-0/+30
2021-10-14Avoid tupling at the calleeDeadbeef-30/+32
2021-10-14Suggest Box::pin when Pin::new is used insteadTyler Mandry-13/+7
2021-10-13Auto merge of #89858 - matthiaskrgr:rollup-evsnr2e, r=matthiaskrgrbors-0/+65
Rollup of 6 pull requests Successful merges: - #89347 (suggestion for typoed crate or module) - #89670 (Improve `std::thread::available_parallelism` docs) - #89757 (Use shallow clones for submodules) - #89759 (Assemble the compiler when running `x.py build`) - #89846 (Add `riscv32imc-esp-espidf` to 1.56 changelog) - #89853 (Update the 1.56.0 release header for consistency) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-13Move misplaced commentTyler Mandry-4/+4
2021-10-13Always check predicates in can_coerceTyler Mandry-12/+6
This only changed two tests and I consider both changes an improvement.
2021-10-13Fix incorrect Box::pin suggestionTyler Mandry-0/+36
The suggestion checked if Pin<Box<T>> could be coeerced to the expected type, but did not check predicates created by the coercion. We now look for predicates that definitely cannot be satisfied before giving the suggestion. The suggestion is marked MaybeIncorrect because we allow predicates that are still ambiguous and can't be proven.
2021-10-13Rollup merge of #89347 - TaKO8Ki:crate-or-module-typo, r=estebankMatthias Krüger-0/+65
suggestion for typoed crate or module Previously, the compiler didn't suggest similarly named crates or modules. This pull request adds a suggestion for typoed crates or modules. #76208 before: ``` error[E0433]: failed to resolve: use of undeclared type or module `chono` --> src/main.rs:2:5 | 2 | use chono::prelude::*; | ^^^^^ use of undeclared type or module `chono` ``` after: ``` error[E0433]: failed to resolve: use of undeclared type or module `chono` --> src/main.rs:2:5 | 2 | use chono::prelude::*; | ^^^^^ | | | use of undeclared crate or module `chono` | help: a similar crate or module exists: `chrono` ```
2021-10-13Auto merge of #89555 - oli-obk:nll_member_constraint_diag, r=estebankbors-354/+350
Remove textual span from diagnostic string This is an unnecessary repetition, as the diagnostic prints the span anyway in the source path right below the message. I further removed the identification of the node, as that does not give any new information in any of the cases that are changed in tests. EDIT: also inserted a suggestion that other diagnostics were already emitting