about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-01-23Rollup merge of #81249 - cjgillot:issue-79537, r=oli-obkJonas Schievink-0/+68
Lower closure prototype after its body. Fixes #79537. r? `@Mark-Simulacrum`
2021-01-23Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJungJonas Schievink-3/+31
mir: Improve size_of handling when arg is unsized As discussed on Zulip with `@RalfJung.`
2021-01-23Auto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obkbors-281/+238
avoid promoting division, modulo and indexing operations that could fail For division, `x / y` will still be promoted if `y` is a non-zero integer literal; however, `1/(1+1)` will not be promoted any more. While at it, also see if we can reject promoting floating-point arithmetic (which are [complicated](https://github.com/rust-lang/unsafe-code-guidelines/issues/237) so maybe we should not promote them). This will need a crater run to see if there's code out there that relies on these things being promoted. If we can land this, promoteds in `fn`/`const fn` cannot fail to evaluate any more, which should let us do some simplifications in codegen/Miri! Cc https://github.com/rust-lang/rfcs/pull/3027 Fixes https://github.com/rust-lang/rust/issues/61821 r? `@oli-obk`
2021-01-23Auto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkovbors-38/+141
Improve diagnostics when parsing angle args https://github.com/rust-lang/rust/pull/79266 introduced parsing of generic arguments in associated type constraints, this however resulted in possibly very confusing error messages in cases in which closing angle brackets were missing such as in `Vec<(u32, _, _) = vec![]`, which outputs an incorrectly parsed equality constraint error, as noted by `@cynecx.` This PR tries to provide better error messages in such cases. r? `@petrochenkov`
2021-01-22Auto merge of #72160 - slo1:libstd-setgroups, r=KodrAusbors-0/+26
Add setgroups to std::os::unix::process::CommandExt Should fix #38527. I'm not sure groups is the greatest name though.
2021-01-22bless testsb-naber-1/+1
2021-01-22add and update testsb-naber-38/+141
2021-01-22Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obkMara Bos-65/+338
Gracefully handle loop labels missing leading `'` in different positions Fix #81192. * Account for labels when suggesting `loop` instead of `while true` * Suggest `'a` when given `a` only when appropriate * Add loop head span to hir * Tweak error for invalid `break expr` * Add more misspelled label tests * Avoid emitting redundant "unused label" lint * Parse loop labels missing a leading `'` Each commit can be reviewed in isolation.
2021-01-22Auto merge of #80558 - lcnr:gat-variance, r=matthewjasperbors-0/+24
require gat substs to be invariant fixes #69184, fixes #80766 r? `@matthewjasper` probably
2021-01-22re-bless ui testsRalf Jung-53/+5
2021-01-22expand successful-promotion test a bitRalf Jung-16/+18
2021-01-22do promote array indexing if we know it is in-boundsRalf Jung-0/+3
2021-01-22avoid promoting division, modulo and indexing operations that could failRalf Jung-234/+234
2021-01-21Update src/test/ui/command/command-setgroups.rs to ignore windowsslo1-0/+1
2021-01-21Update src/test/ui/command/command-setgroups.rsslo1-0/+6
Co-authored-by: Ashley Mannix <kodraus@hey.com>
2021-01-21Add setgroups to std::os::unix::process::CommandExtslo1-0/+19
2021-01-22Auto merge of #81135 - jyn514:no-backticks, r=flip1995bors-13/+13
Fix formatting for removed lints - Don't add backticks for the reason a lint was removed. This is almost never a code block, and when it is the backticks should be in the reason itself. - Don't assume clippy is the only tool that needs to be checked for backwards compatibility I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway. r? `@flip1995`
2021-01-21Do not suggest using a break label when one is already presentEsteban Küber-18/+6
2021-01-21Parse loop labels missing a leading `'`Esteban Küber-17/+22
When encountering the following typo: ```rust a: loop { break 'a; } ``` provide an appropriate suggestion.
2021-01-21Avoid emitting redundant "unused label" lintEsteban Küber-63/+17
2021-01-21Add more misspelled label testsEsteban Küber-15/+173
2021-01-21Tweak error for invalid `break expr`Esteban Küber-55/+119
Point at loop head on invalid `break expr`. Suggest removing `expr` or using label if available.
2021-01-21Suggest `'a` when given `a` only when appropriateEsteban Küber-21/+27
When encountering a name `a` that isn't resolved, but a label `'a` is found in the current ribs, only suggest `'a` if this name is the value expression of a `break` statement. Solve FIXME.
2021-01-21Account for labels when suggesting `loop` instead of `while true`Esteban Küber-9/+107
2021-01-22Auto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkovbors-0/+130
Force token collection to run when parsing nonterminals Fixes #81007 Previously, we would fail to collect tokens in the proper place when only builtin attributes were present. As a result, we would end up with attribute tokens in the collected `TokenStream`, leading to duplication when we attempted to prepend the attributes from the AST node. We now explicitly track when token collection must be performed due to nomterminal parsing.
2021-01-21Lower closure prototype after its body.Camille GILLOT-0/+68
2021-01-21mir: Improve size_of handling when arg is unsizedÖmer Sinan Ağacan-3/+31
2021-01-21require gat substs to be invariantBastian Kauschke-0/+24
2021-01-21Rollup merge of #81185 - osa1:fix_80742, r=oli-obkYuki Okushi-0/+75
Fix ICE in mir when evaluating SizeOf on unsized type Not quite ready yet. This tries to fix #80742 as discussed on [Zulip topic][1], by using `delay_span_bug`. I don't understand what `delay_span_bug` does. It seems like my error message is never used. With this patch, in this program: ```rust #![allow(incomplete_features)] #![feature(const_evaluatable_checked)] #![feature(const_generics)] use std::fmt::Debug; use std::marker::PhantomData; use std::mem::size_of; struct Inline<T> where [u8; size_of::<T>() + 1]: , { _phantom: PhantomData<T>, buf: [u8; size_of::<T>() + 1], } impl<T> Inline<T> where [u8; size_of::<T>() + 1]: , { pub fn new(val: T) -> Inline<T> { todo!() } } fn main() { let dst = Inline::<dyn Debug>::new(0); // line 27 } ``` these errors are printed, both for line 27 (annotated line above): - "no function or associated item named `new` found for struct `Inline<dyn Debug>` in the current scope" - "the size for values of type `dyn Debug` cannot be known at compilation time" Second error makes sense, but I'm not sure about the first one and why it's even printed. Finally, I'm not sure about the span passing in `const_eval`. [1]: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Help.20fixing.20.2380742
2021-01-21Rollup merge of #81046 - rylev:unknown-external-crate, r=estebankYuki Okushi-4/+34
Improve unknown external crate error This improves error messages when unknown items in the crate root are encountered. Fixes #63799 r? ```@estebank```
2021-01-21Rollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-SimulacrumYuki Okushi-0/+31
Add regression test for mutual recursion in obligation forest Add regression test for #75860 with a slightly smaller example. I was looking at what caused the issue and was surprised when it errors out on nightly, so I just added a regression test which should effectively close the issue, altho it would be nice to find the fix for reference. Also I found that 80066 is not fixed by whatever fixed 75860.
2021-01-20Force token collection to run when parsing nonterminalsAaron Hill-0/+130
Fixes #81007 Previously, we would fail to collect tokens in the proper place when only builtin attributes were present. As a result, we would end up with attribute tokens in the collected `TokenStream`, leading to duplication when we attempted to prepend the attributes from the AST node. We now explicitly track when token collection must be performed due to nomterminal parsing.
2021-01-20Auto merge of #81118 - ojeda:metadata-obj, r=nagisabors-0/+7
Skip linking if it is not required This allows to use `--emit=metadata,obj` and other metadata + non-link combinations. Fixes #81117.
2021-01-19Fix ICE in mir when evaluating SizeOf on unsized typeÖmer Sinan Ağacan-0/+75
Fixes #80742
2021-01-19Auto merge of #81186 - GuillaumeGomez:rollup-y2d04g9, r=GuillaumeGomezbors-17/+96
Rollup of 8 pull requests Successful merges: - #80382 (Improve search result tab handling) - #81112 (Remove unused alloc::std::ops re-export.) - #81115 (BTreeMap: prefer bulk_steal functions over specialized ones) - #81147 (Fix structured suggestion for explicit `drop` call) - #81161 (Remove inline script tags) - #81164 (Fix typo in simplify.rs) - #81166 (remove some outdated comments regarding debug assertions) - #81168 (Fixes #81109 - Typo in pointer::wrapping_sub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-19Rollup merge of #81147 - estebank:drop-suggestion, r=varkorGuillaume Gomez-17/+96
Fix structured suggestion for explicit `drop` call
2021-01-19Auto merge of #81110 - LeSeulArtichaut:fix-unused-unsafe-label, r=RalfJungbors-16/+39
Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fn Previously, the following code: ```rust #![feature(unsafe_block_in_unsafe_fn)] unsafe fn foo() { unsafe { unsf() } } unsafe fn unsf() {} ``` Would give the following warning: ``` warning: unnecessary `unsafe` block --> src/lib.rs:4:5 | 4 | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | = note: `#[warn(unused_unsafe)]` on by default ``` which doesn't point out that the block is in an `unsafe fn`. Tracking issue: #71668 cc #79208
2021-01-19Auto merge of #81103 - zackmdavis:comma_trail, r=davidtwcobors-5/+44
don't suggest erroneous trailing comma after `..` 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. r? `@davidtwco` or `@estebank`
2021-01-19Auto merge of #81042 - sasurau4:fix/unclear-error-with-trait, r=estebankbors-2/+32
Add suggestion for impl_candidates with E0283 Fix #42226
2021-01-18Auto merge of #80707 - oli-obk:stability_hole_const_intrinsics, r=RalfJungbors-0/+50
Stability oddity with const intrinsics cc `@RalfJung` In https://github.com/rust-lang/rust/pull/80699#discussion_r551495670 `@usbalbin` realized we accepted some intrinsics as `const` without a `#[rustc_const_(un)stable]` attribute. I did some digging, and that example works because intrinsics inherit their stability from their parents... including `#[rustc_const_(un)stable]` attributes. While we may want to fix that (not sure, wasn't there just a MCPed PR that caused this on purpose?), we definitely want tests for it, thus this PR adding tests and some fun tracing statements.
2021-01-18Add tests for resolution changesRyan Levick-0/+30
2021-01-18Add test case for suggestion E0283Daiki Ihara-2/+32
2021-01-18Rollup merge of #81128 - RalfJung:validation-testing, r=oli-obkAshley Mannix-81/+59
validation test: turn some const_err back into validation failures This resolves the problem I raised at https://github.com/rust-lang/rust/pull/78407#discussion_r556732926. r? `@oli-obk`
2021-01-18Rollup merge of #81071 - osa1:fix_81006, r=estebankAshley Mannix-0/+24
rustc_parse_format: Fix character indices in find_skips Fixes #81006
2021-01-18Only inherit const stability for methods of `impl const Trait` blocksoli-5/+11
2021-01-18Improve unknown external crate errorRyan Levick-4/+4
2021-01-17Fix structured suggestion for explicit `drop` callEsteban Küber-17/+96
2021-01-17Auto merge of #80537 - ehuss:macos-posix-spawn-chdir, r=dtolnaybors-0/+49
Don't use posix_spawn_file_actions_addchdir_np on macOS. There is a bug on macOS where using `posix_spawn_file_actions_addchdir_np` with a relative executable path will cause `posix_spawnp` to return ENOENT, even though it successfully spawned the process in the given directory. `posix_spawn_file_actions_addchdir_np` was introduced in macOS 10.15 first released in Oct 2019. I have tested macOS 10.15.7 and 11.0.1. Example offending program: ```rust use std::fs; use std::os::unix::fs::PermissionsExt; use std::process::*; fn main() { fs::create_dir_all("bar").unwrap(); fs::create_dir_all("foo").unwrap(); fs::write("foo/foo.sh", "#!/bin/sh\necho hello ${PWD}\n").unwrap(); let perms = fs::Permissions::from_mode(0o755); fs::set_permissions("foo/foo.sh", perms).unwrap(); let c = Command::new("../foo/foo.sh").current_dir("bar").spawn(); eprintln!("{:?}", c); } ``` This prints: ``` Err(Os { code: 2, kind: NotFound, message: "No such file or directory" }) hello /Users/eric/Temp/bar ``` I wanted to open this PR to get some feedback on possible solutions. Alternatives: * Do nothing. * Document the bug. * Try to detect if the executable is a relative path on macOS, and avoid using `posix_spawn_file_actions_addchdir_np` only in that case. I looked at the [XNU source code](https://opensource.apple.com/source/xnu/xnu-6153.141.1/bsd/kern/kern_exec.c.auto.html), but I didn't see anything obvious that would explain the behavior. The actual chdir succeeds, it is something else further down that fails, but I couldn't see where. EDIT: I forgot to mention, relative exe paths with `current_dir` in general are discouraged (see #37868). I don't know if #37868 is fixable, since normalizing it would change the semantics for some platforms. Another option is to convert the executable to an absolute path with something like joining the cwd with the new cwd and the executable, but I'm uncertain about that.
2021-01-17Fix test to work with remote-test-server.Eric Huss-1/+7
remote-test-server does not set the current_dir, and leaves it as `/`.
2021-01-17Fix formatting for removed lintsJoshua Nelson-13/+13
- Don't add backticks for the reason a lint was removed. This is almost never a code block, and when it is the backticks should be in the reason itself. - Don't assume clippy is the only tool that needs to be checked for backwards compatibility