summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-03-15Revert PR 81473 to resolve (on beta) issues 81626 and 81658.Felix S. Klock II-47/+0
Revert "Add missing brace" This reverts commit 85ad773049536d7fed9a94ae0ac74f97135c8655. Revert "Simplify base_expr" This reverts commit 899aae465eb4ef295dc1eeb2603f744568e0768c. Revert "Warn write-only fields" This reverts commit d3c69a4c0dd98af2611b7553d1a65afef6a6ccb0.
2021-03-10Substitute erased lifetimes on bad placeholder typeEsteban Küber-2/+32
Fix #82455. (cherry picked from commit 5ad60888275852136adea38aebc7fcce69b52474)
2021-03-10Fix popping singleton paths in when generating E0433Ömer Sinan Ağacan-0/+12
Fixes #82156 (cherry picked from commit 9889e44470cbc6ae3c8e2fcfb6016ed15ed8cf51)
2021-02-13parser: Fix panic in 'const impl' recoveryÖmer Sinan Ağacan-0/+22
The panic happens when in recovery parsing a full `impl` (`parse_item_impl`) fails and we drop the `DiagnosticBuilder` for the recovery suggestion and return the `parse_item_impl` error. We now raise the original error "expected identifier found `impl`" when parsing the `impl` fails. Note that the regression test is slightly simplified version of the original repro in #81806, to make the error output smaller and more resilient to unrelated changes in parser error messages. Fixes #81806
2021-02-05Auto merge of #81257 - ↵bors-379/+257
pnkfelix:issue-80949-short-term-resolution-via-revert-of-pr-78373, r=matthewjasper Revert 78373 ("dont leak return value after panic in drop") Short term resolution for issue #80949. Reopen #47949 after this lands. (We plan to fine-tune PR #78373 to not run into this problem.)
2021-02-05Rollup merge of #81730 - RustyYato:object-safe-allocator, r=AmanieuMara Bos-0/+13
Make `Allocator` object-safe This allows rust-lang/wg-allocators#83: polymorphic allocators
2021-02-05Rollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkovMara Bos-103/+142
Handle `Span`s for byte and raw strings and add more detail CC #81208.
2021-02-05Rollup merge of #80726 - lcnr:unsize-query, r=oli-obkMara Bos-0/+36
relax adt unsizing requirements Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change. This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive. An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967 ```rust struct A<T, U: ?Sized>(T, B<T, U>); // previously ERR // struct A<T, U: ?Sized>(T, B<[u32; 1], U>); // ok struct B<T, U: ?Sized>(T, U); fn main() { let x = A([0; 1], B([0; 1], [0; 1])); let y: &A<[u32; 1], [u32]> = &x; assert_eq!(y.1.1.len(), 1); } ```
2021-02-05Rollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, ↵Mara Bos-37/+897
r=jackh726 Generic associated types in trait paths This is the second part of https://github.com/rust-lang/rust/pull/78978 This should fix: Fixes #67510 Fixes #68648 Fixes #68649 Fixes #68650 Fixes #68652 Fixes #74684 Fixes #76535 Fixes #79422 Fixes #80433 and implement the remaining functionality needed for https://github.com/rust-lang/rust/issues/44265 r? ``@matthewjasper``
2021-02-04regression test for issue 80949.Felix S. Klock II-0/+34
2021-02-04Revert "Avoid leaking block expression values"Felix S. Klock II-379/+223
This reverts commit 4fef39113a514bb270f5661a82fdba17d3e41dbb.
2021-02-04add testsb-naber-37/+897
2021-02-04Rollup merge of #81725 - mark-i-m:mv-test, r=Mark-SimulacrumMara Bos-0/+0
Move test to be with the others No functional changes. I just created this test in the wrong place in a past PR. All of the other or-pattern tests are in the `or-patterns` directory.
2021-02-04Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995Mara Bos-47/+142
Add lint for `panic!(123)` which is not accepted in Rust 2021. This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021. It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized `std::panic::panic_any()` function as an alternative. It renames the lint to `non_fmt_panic` to match the lint naming guidelines. ![image](https://user-images.githubusercontent.com/783247/106520928-675ea680-64d5-11eb-81f7-d8fa48b93a0b.png) This is part of #80162. r? ```@estebank```
2021-02-04Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelixMara Bos-24/+417
introduce future-compatibility warning for forbidden lint groups We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect. r? ``@Mark-Simulacrum``
2021-02-04Rollup merge of #74304 - yoshuawuyts:stabilize-wake, r=KodrAusMara Bos-1/+0
Stabilize the Wake trait This PR proposes stabilizing the `wake_trait` feature, tracking issue https://github.com/rust-lang/rust/issues/69912. ## Motivation The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable [`std::task::RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWaker.html) it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this. Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a [`RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWakerVTable.html). I believe the intent was always to introduce a `Wake` counterpart to `RawWaker` in order to safely construct `Waker` instances. And the `Wake` trait feels like it does that job as intended. ## Implementation notes This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal `block_on` example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for both `task::Wake` and futures alike.
2021-02-03make Allocator object-safeRustyYato-0/+13
add test to ensure object-safety This allows for runtime polymorphic allocators
2021-02-04add `relaxed_struct_unsize` feature gateBastian Kauschke-0/+25
2021-02-04relax adt unsizing requirementsBastian Kauschke-0/+11
2021-02-03Allow/fix non_fmt_panic in tests.Mara Bos-25/+32
2021-02-03Add lint for `panic!(123)` which is not accepted in Rust 2021.Mara Bos-22/+110
This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021. It suggests to add `"{}", ` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized `std::panic::panic_any()` function as an alternative. It renames the lint to `non_fmt_panic` to match the lint naming guidelines.
2021-02-03Handle `Span`s for byte and raw strings and add more detailEsteban Küber-103/+142
2021-02-03Auto merge of #81717 - Aaron1011:fix/closure-diag, r=estebankbors-0/+18
Fix panic when emitting diagnostic for closure mutable binding error Fixes #81700 The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is still a mutable borrow for the purposes of this diagnostic code.
2021-02-03move test to be with the othersmark-0/+0
2021-02-03Auto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-sebors-265/+972
Rollup of 5 pull requests Successful merges: - #80394 (make const_err a future incompat lint) - #81532 (Remove incorrect `delay_span_bug`) - #81692 (Update clippy) - #81715 (Reduce tab formatting assertions to debug only) - #81716 (Fix non-existent-field ICE for generic fields.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-03Rollup merge of #81716 - m-ou-se:fix-ice, r=eddybMara Bos-4/+4
Fix non-existent-field ICE for generic fields. I mentioned this ICE in a chat and it took about 3 milliseconds before `@eddyb` found the problem and said this change would fix it. :) This also changes one the field types in the related test to one that triggered the ICE. Fixes #81627. Fixes #81672. Fixes #81709. Cc https://github.com/rust-lang/rust/pull/81480 `@b-naber` `@estebank.`
2021-02-03Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelixMara Bos-0/+20
Remove incorrect `delay_span_bug` The following code is supposed to compile ```rust use std::ops::BitOr; pub trait IntWrapper { type InternalStorage; } impl<T> BitOr for dyn IntWrapper<InternalStorage = T> where Self: Sized, T: BitOr + BitOr<Output = T>, { type Output = Self; fn bitor(self, _other: Self) -> Self { todo!() } } ``` Before this change it would ICE. In #70998 the removed logic was added to provide better suggestions, and the `delay_span_bug` guard was added to protect against a potential logic error when returning traits. As it happens, there are cases, like the one above, where traits can indeed be returned, so valid code was being rejected. Fix (but not close) #80207.
2021-02-03Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obkMara Bos-261/+948
make const_err a future incompat lint This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong. This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts). ~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~ Cc `@rust-lang/wg-const-eval`
2021-02-03Fix non-existent-field ICE for generic fields.Mara Bos-4/+4
Co-authored-by: eddyb <eddyb@lyken.rs>
2021-02-03Fix panic when emitting diagnostic for closure mutable binding errorAaron Hill-0/+18
Fixes #81700 The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is still a mutable borrow for the purposes of this diagnostic code.
2021-02-03Remove incorrect `delay_span_bug`Esteban Küber-0/+20
The following code is supposed to compile ```rust use std::ops::BitOr; pub trait IntWrapper { type InternalStorage; } impl<T> BitOr for dyn IntWrapper<InternalStorage = T> where Self: Sized, T: BitOr + BitOr<Output = T>, { type Output = Self; fn bitor(self, _other: Self) -> Self { todo!() } } ``` Before this change it would ICE. In #70998 the removed logic was added to provide better suggestions, and the `delay_span_bug` guard was added to protect against a potential logic error when returning traits. As it happens, there are cases, like the one above, where traits can indeed be returned, so valid code was being rejected. Fix #80207.
2021-02-03Stabilize the Wake traitYoshua Wuyts-1/+0
Co-Authored-By: Ashley Mannix <kodraus@hey.com>
2021-02-03Auto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obkbors-0/+262
Use ufcs in derive(Debug) Cc #81211. (Arguably this *is* the fix for it.)
2021-02-03make const_err a future incompat lintRalf Jung-261/+948
2021-02-03Auto merge of #81699 - jethrogb:fix-81531, r=petrochenkovbors-0/+5
Really fix early lints inside an async desugaring Fixes #81531 cc `@Aaron1011` r? `@petrochenkov`
2021-02-03Really fix early lints inside an async desugaringJethro Beekman-0/+5
2021-02-03Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievinkbors-2/+96
Add a new ABI to support cmse_nonsecure_call This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call. See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928). This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃 I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now). On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-03Auto merge of #81535 - nikic:update-test-various, r=sanxiynbors-0/+1
Update test-various to Ubuntu 20.04 The test command-setgroups.rs is adjusted to skip on musl, where `sysconf(_SC_NGROUPS_MAX)` always returns a dummy value of 32, even though the actual value is 65536. I'm not sure why this only became a problem now, as the information I found indicates that this value changed in kernel version 2.6.4, which is ages ago. I'm a bit unsure whether this one will go through, because I locally also saw a failure in std-backtrace.rs which went away on subsequent runs, and also had port assignment failures, but I think those might be on my side. I'm kind of curious how the code in https://github.com/rust-lang/rust/blob/b122908617436af187252572ed5db96850551380/library/std/src/net/test.rs#L43-L56 is supposed to work, as the directory names it checks don't seem to appear anywhere else. r? `@Mark-Simulacrum`
2021-02-02introduce future-compatibility warning for forbidden lint groupsNiko Matsakis-24/+417
We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect.
2021-02-02Auto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726bors-20/+260
Rollup of 14 pull requests Successful merges: - #80593 (Upgrade Chalk) - #81260 (Add .editorconfig) - #81455 (Add AArch64 big-endian and ILP32 targets) - #81517 (Remove remnants of the santizer runtime crates from bootstrap) - #81530 (sys: use `process::abort()` instead of `arch::wasm32::unreachable()`) - #81544 (Add better diagnostic for unbounded Abst. Const) - #81588 (Add doc aliases for "delete") - #81603 (rustbuild: Don't build compiler twice for error-index-generator.) - #81634 (Add long explanation e0521) - #81636 (Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on) - #81647 (Fix bug with assert!() calling the wrong edition of panic!().) - #81655 (Improve wording of suggestion about accessing field) - #81665 (Fix out of date `Scalar` documentation) - #81671 (Add more associated type tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-02Rollup merge of #81671 - jackh726:atb-tests, r=estebankJack Huey-0/+95
Add more associated type tests Closes #24159 Closes #37808 Closes #39532 Closes #37883 r? ``@estebank``
2021-02-02Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebankJack Huey-12/+12
Improve wording of suggestion about accessing field Follow-up to #81504 The compiler at this moment suggests "you might have meant to use field `b` of type `B`", sounding like it's type `B` which has the field `b`. r? ```@estebank```
2021-02-02Rollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkovJack Huey-0/+51
Fix bug with assert!() calling the wrong edition of panic!(). The span of `panic!` produced by the `assert` macro did not carry the right edition. This changes `assert` to call the right version. Also adds tests for the 2021 edition of panic and assert, that would've caught this.
2021-02-02Rollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, ↵Jack Huey-3/+26
r=GuillaumeGomez Add long explanation e0521 Helps with #61137
2021-02-02Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnrJack Huey-5/+76
Add better diagnostic for unbounded Abst. Const ~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`, instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~ ~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~ Changed the diagnostic to add a better example, which is more practical than what was previously proposed. r? ```@lcnr```
2021-02-02Fix early lints inside an async desugaringAaron Hill-3/+9
Fixes #81531 When we buffer an early lint for a macro invocation, we need to determine which NodeId to take the lint level from. Currently, we use the `NodeId` of the closest def parent. However, if the macro invocation is inside the desugared closure from an `async fn` or async closure, that `NodeId` does not actually exist in the AST. This commit explicitly calls `check_lint` for the `NodeId`s of closures desugared from async expressions, ensuring that we do not miss any buffered lints.
2021-02-02More associated type testsJack Huey-0/+95
2021-02-02Update ui tests (nll)Jesus Rubio-2/+12
2021-02-02Add better diagnostic for missing where clausekadmin-5/+76
Previously, it's not clear what exactly should be added in the suggested where clause, so this adds an example to demonstrate.
2021-02-02Add a new ABI to support cmse_nonsecure_callHugues de Valon-2/+96
This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>