about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-05-25Tweak `self` arg not as first argument of a method diagnosticEsteban Küber-6/+25
Mention that `self` is only valid on "associated functions" ``` error: unexpected `self` argument in function --> $DIR/self-in-function-arg.rs:1:15 | LL | fn foo(x:i32, self: i32) -> i32 { self } | ^^^^ not valid as function argument | = note: `self` is only valid as the first argument of an associated function ``` When it is a method, mention it must be first ``` error: unexpected `self` argument in function --> $DIR/trait-fn.rs:4:20 | LL | fn c(foo: u32, self) {} | ^^^^ must be the first associated function argument ```
2019-05-25Rollup merge of #61138 - varkor:async-await-tests, r=cramertjMazdak Farrokhzad-2/+74
Move async/await tests to their own folder This moves run-pass and ui async/await tests to their own folder `src/test/ui/async-await` and organises some into subfolders. (It does not move rustdoc tests for async/await.) I also did some drive-by cleaning up of issues/error code tests into their own folders (which already existed). These are in separate commits, so easy to separate out if that's more desirable. r? @cramertj
2019-05-25Rollup merge of #61118 - pnkfelix:issue-60654-dont-ice-on-gat, r=varkorMazdak Farrokhzad-0/+26
Dont ICE on an attempt to use GAT without feature gate Fix #60654
2019-05-25Rollup merge of #61113 - SimonSapin:fnbox, r=alexcrichtonMazdak Farrokhzad-22/+19
Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since 1.35 FCP completion: https://github.com/rust-lang/rust/issues/28796#issuecomment-439731515
2019-05-25Add extra arc_wakevarkor-0/+64
2019-05-24Revert changes that belong to separate PREsteban Küber-21/+12
2019-05-24Delete stray .stderrvarkor-10/+0
2019-05-24Move error code tests to error code foldervarkor-0/+0
2019-05-24Add issues folder in async-awaitvarkor-0/+12
2019-05-24Add drop-order folder in test/ui/async-awaitvarkor-12/+0
2019-05-24Add auxiliary issue filevarkor-0/+0
2019-05-24Move some issues into the issues foldervarkor-0/+0
2019-05-24Move async/await tests to test/ui/async-awaitvarkor-2/+20
2019-05-24review commentsEsteban Küber-1/+1
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-33/+51
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-24Regression test for issue #60654.Felix S. Klock II-0/+26
2019-05-24Auto merge of #60803 - varkor:remove-in-place-syntax, r=petrochenkovbors-34/+51
Remove `ObsoleteInPlace` The in place syntax has been deprecated for over a year. As it is, this is accumulated cruft: the error messages are unlikely to be helpful any more and it conflicts with some useful syntax (e.g. const generics in some instances). It may be that removing `Token::LArrow` is backwards-incompatible. We should do a crater run to check. cc @eddyb
2019-05-24Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since 1.35Simon Sapin-22/+19
FCP completion: https://github.com/rust-lang/rust/issues/28796#issuecomment-439731515
2019-05-24Auto merge of #60984 - matthewjasper:borrowck-error-reporting-cleanup, ↵bors-0/+69
r=pnkfelix Borrowck error reporting cleanup * Don't show variables created by desugarings in borrowck errors * Move "conflict error" reporting to it's own module, so that `error_reporting` contains only common error reporting methods. * Remove unused `ScopeTree` parameter. r? @pnkfelix
2019-05-24Update testsvarkor-34/+51
2019-05-24Auto merge of #61105 - Centril:rollup-t9lemjf, r=Centrilbors-69/+111
Rollup of 6 pull requests Successful merges: - #59545 (Use arenas to avoid Lrc in queries #2) - #61054 (Suggest dereferencing on assignment to mutable borrow) - #61056 (tweak discriminant on non-nullary enum diagnostic) - #61082 (fix dangling reference in Vec::append) - #61086 (Box::into_unique: do the reborrow-to-raw *after* destroying the Box) - #61098 (Fix overflowing literal lint in loops) Failed merges: r? @ghost
2019-05-24Rollup merge of #61098 - varkor:fix-overflowing-literal-in-loop, r=estebankMazdak Farrokhzad-2/+18
Fix overflowing literal lint in loops Fixes https://github.com/rust-lang/rust/issues/60459. r? @estebank
2019-05-24Rollup merge of #61056 - euclio:custom-discriminant-error, r=estebankMazdak Farrokhzad-10/+18
tweak discriminant on non-nullary enum diagnostic Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference. Fixes #61039. r? @estebank
2019-05-24Rollup merge of #61054 - estebank:mut-ref-reassign, r=zackmdavisMazdak Farrokhzad-0/+64
Suggest dereferencing on assignment to mutable borrow Fix #33570
2019-05-23Auto merge of #60970 - MaulingMonkey:pr-compiletest-cdb-support, r=alexcrichtonbors-2/+59
Add basic CDB support to debuginfo compiletest s, to help catch `*.natvis` regressions, like those fixed in #60687. First draft, feedback welcome. Several Microsoft debuggers (VS, VS Code, WinDbg, CDB, ...) consume the `*.natvis` files we embed into rust `*.pdb` files. While this only tests CDB, that test coverage should help for all of them. # Changes ## src\bootstrap - test.rs: Run CDB debuginfo tests on MSVC targets ## src\test\debuginfo - issue-13213.rs: CDB has trouble with this, skip for now (newly discovered regression?) - pretty-std.rs: Was ignored, re-enable for CDB only to start with, add CDB tests. - should-fail.rs: Add CDB tests. ## src\tools\compiletest: - Added "-cdb" option - Added Mode::DebugInfoCdb ("debuginfo-cdb") - Added run_debuginfo_cdb_test[_no_opt] - Renamed Mode::DebugInfoBoth -> DebugInfoGdbLldb ("debuginfo-gdb+lldb") since it's no longer clear what "Both" means. - Find CDB at the default Win10 SDK install path "C:\Program Files (x86)\Windows Kits\10\Debugger\\*\cdb.exe" - Ignore CDB tests if CDB not found. # Issues - `compute_stamp_hash`: not sure if there's any point in hashing `%ProgramFiles(x86)%` - `OsString` lacks any `*.natvis` entries (would be nice to add in a followup changelist) - DSTs (array/string slices) which work in VS & VS Code fail in CDB. - I've avoided `Mode::DebugInfoAll` as 3 debuggers leads to pow(2,3)=8 possible combinations. # Reference CDB is not part of the base Visual Studio install, but can be added via the Windows 10 SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk Installing just "Debugging Tools for Windows" is sufficient. CDB appears to already be installed on appveyor CI, where this changelist can find it, based on it's use here: https://github.com/rust-lang/rust/blob/0ffc57311030a1930edfa721fe57d0000a063af4/appveyor.yml#L227 CDB commands and command line reference: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-reference
2019-05-23Add test for denying overflowing literal in loopvarkor-1/+10
2019-05-23Update unreachable loop patterns testvarkor-1/+8
2019-05-23Add regression test for negative caseEsteban Küber-4/+47
2019-05-23Update wasm_import_module_map and target_features_whitelistJohn Kåre Alsaker-2/+2
2019-05-23Remove subtle Default impl for ValueJohn Kåre Alsaker-55/+9
2019-05-23tweak discriminant on non-nullary enum diagnosticAndy Russell-10/+18
Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference.
2019-05-23Auto merge of #60965 - petrochenkov:lit3, r=matkladbors-28/+30
syntax: Continue refactoring literals A follow up to https://github.com/rust-lang/rust/pull/60679. https://github.com/rust-lang/rust/commit/a2fd002bd5a91ba7997057724b72b9dac8fae550: Similarly to `EscapeError`, literal parsing now produces a `LitError`. This way we can get rid of `diag: Option<(Span, &Handler)>` in interfaces while leaving attr/mod alone. https://github.com/rust-lang/rust/commit/d9516d11208456d4a17fe68a34c1d0a00334e62c: Gathers all components of a literal token in a single struct.
2019-05-23syntax: Some code cleanupVadim Petrochenkov-15/+17
2019-05-23syntax: More consistent wording for some literal parsing errorsVadim Petrochenkov-18/+18
2019-05-23syntax: Return named errors from literal parsing functionsVadim Petrochenkov-3/+3
2019-05-23Auto merge of #61075 - Centril:rollup-1ugmcqu, r=Centrilbors-2/+49
Rollup of 7 pull requests Successful merges: - #60981 (Bump compiler-builtins to 0.1.15) - #61014 (Make -Zemit-artifact-notifications also emit the artifact type) - #61043 (Disable LLVM/debug assertions in gnu-full-bootstrap) - #61046 (Fix ICE with inconsistent macro matchers) - #61055 (Solaris CI: Build with dilos2 stable) - #61057 (Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators.") - #61073 (librustc_errors: Remove unused annotation style `OldSchoolNoteText`) Failed merges: r? @ghost
2019-05-23Rollup merge of #61046 - mark-i-m:transcribe-fix, r=petrochenkovMazdak Farrokhzad-0/+47
Fix ICE with inconsistent macro matchers Fixes #61033 r? @petrochenkov
2019-05-23Rollup merge of #61014 - jsgf:emit-artifact-type, r=alexcrichtonMazdak Farrokhzad-2/+2
Make -Zemit-artifact-notifications also emit the artifact type This is easier for tooling to handle than trying to reverse-engineer the type from the filename extension. The field name and value is intended to reflect the `--emit` command-line option. Related issues https://github.com/rust-lang/rust/issues/60988 https://github.com/rust-lang/rust/issues/58465 cc @alexcrichton
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-106/+414
Add match arm scopes and other scope fixes * Add drop and lint scopes for match arms. * Lint attributes are now respected on match arms. * Make sure we emit a StorageDead if we diverge when initializing a temporary. * Adjust MIR pretty printing of scopes for locals. * Don't generate duplicate lint scopes for `let statements`. * Add some previously missing fake borrows for matches. closes #46525 cc @rust-lang/compiler
2019-05-22Suggest dereferencing on assignment to mutable borrowEsteban Küber-0/+21
2019-05-22add ui testsMark Mansi-0/+47
2019-05-22Rollup merge of #60809 - jethrogb:jb/nll-faq, r=pnkfelixMazdak Farrokhzad-0/+24
Add FAQ for NLL migration r? @pnkfelix cc @oli-obk @davidtwco @Centril Since you've provided feedback on the warning wording before.
2019-05-22Rollup merge of #60773 - Aaron1011:fix/rustdoc-project-all, r=eddybMazdak Farrokhzad-0/+35
Always try to project predicates when finding auto traits in rustdoc Fixes #60726 Previous, AutoTraitFinder would only try to project predicates when the predicate type contained an inference variable. When finding auto traits, we only project to try to unify inference variables - we don't otherwise learn any new information about the required bounds. However, this lead to failing to properly generate a negative auto trait impl (indicating that a type never implements a certain auto trait) in the following unusual scenario: In almost all cases, a type has an (implicit) negative impl of an auto trait due some other type having an explicit *negative* impl of that auto trait. For example: struct MyType<T> { field: *const T } has an implicit 'impl<T> !Send for MyType<T>', due to the explicit negative impl (in libcore) 'impl<T: ?Sized> !Send for *const T'. However, as exposed by the 'abi_stable' crate, this isn't always the case. This minimzed example shows how a type can never implement 'Send', due to a projection error: ``` pub struct True; pub struct False; pub trait MyTrait { type Project; } pub struct MyStruct<T> { field: T } impl MyTrait for u8 { type Project = False; } unsafe impl<T> Send for MyStruct<T> where T: MyTrait<Project=True> {} pub struct Wrapper { inner: MyStruct<u8> } ``` In this example, `<u8 as MyTrait>::Project == True' must hold for 'MyStruct<u8>: Send' to hold. However, '<u8 as MyTrait>::Project == False' holds instead To properly account for this unusual case, we need to call 'poly_project_and_unify' on *all* predicates, not just those with inference variables. This ensures that we catch the projection error that occurs above, and don't incorrectly determine that 'Wrapper: Send' holds.
2019-05-22Allow null-pointer-optimized enums in FFI if their underlying representation ↵Michael Bradshaw-11/+76
is FFI safe This allows types like Option<NonZeroU8> to be used in FFI without triggering the improper_ctypes lint. This works by changing the is_repr_nullable_ptr function to consider an enum E to be FFI-safe if: - E has no explicit #[repr(...)]. - It only has two variants. - One of those variants is empty (meaning it has no fields). - The other variant has only one field. - That field is one of the following: - &T - &mut T - extern "C" fn - core::num::NonZero* - core::ptr::NonNull<T> - #[repr(transparent)] struct wrapper around one of the types in this list. - The size of E and its field are both known and are both the same size (implying E is participating in the nonnull optimization).
2019-05-22Auto merge of #59445 - alexreg:ban-multi-trait-objects-via-aliases, r=oli-obkbors-41/+1649
Ban multi-trait objects via trait aliases Obviously, multi-trait objects are not normally supported, so they should not be supported via trait aliases. This has been factored out from the previous PR https://github.com/rust-lang/rust/pull/55994 (see point 1). r? @Centril CC @nikomatsakis ------------------ ### RELNOTES: We now allow `dyn Send + fmt::Debug` with equivalent semantics to `dyn fmt::Debug + Send`. That is, the order of the mentioned traits does not matter wrt. principal/not-principal traits. This is a small change that might deserve a mention in the blog post because it is a language change but most likely not. See https://github.com/rust-lang/rust/blob/ce2ee305f9165c037ecddddb5792588a15ff6c37/src/test/ui/traits/wf-trait-object-reverse-order.rs. // @Centril
2019-05-22Auto merge of #60840 - tmandry:preserve-scope-in-generator-mir, r=cramertjbors-0/+1
Preserve local scopes in generator MIR Part of #52924, depended upon by the generator layout optimization #60187. This PR adds `StorageDead` statements in more places in generators, so we can see when non-`Drop` locals have gone out of scope and recover their storage. The reason this is only done for generators is compiler performance. See https://github.com/rust-lang/rust/pull/60187#issuecomment-485637811 for what happens when we do this for all functions. For `Drop` locals, we modify the `MaybeStorageLive` analysis to use `drop` to indicate that storage is no longer live for the local. Once `drop` returns or unwinds to our function, we implicitly assume that the local is `StorageDead`. Instead of using `drop`, it is possible to emit more `StorageDead` statements in the MIR for `Drop` locals so we can handle all locals the same. I am fine with doing it that way, but this was the simplest approach for my purposes. It is also likely to be more performant. r? @Zoxc (feel free to reassign) cc @cramertj @eddyb @RalfJung @rust-lang/wg-async-await
2019-05-21Make -Zemit-artifact-notifications also emit the artifact typeJeremy Fitzhardinge-2/+2
This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.
2019-05-21Dont show variables from desugarings in borrowck errorsMatthew Jasper-0/+69
2019-05-21Add a test for match scopesMatthew Jasper-0/+245
2019-05-21Schedule storage-dead of temporaries soonerMatthew Jasper-5/+4
This ensures that we will correctly generate a storage-dead if the initializing expression diverges.