about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-10-24suggest type annotation for local statement initialed by ref expressionSparrowLii-0/+98
2022-10-23Rollup merge of #103414 - compiler-errors:rpit-print-lt, r=cjgillotMichael Howell-21/+21
Pretty print lifetimes captured by RPIT This specifically makes the output in #103409 change from: ```diff error: `impl` item signature doesn't match `trait` item signature --> $DIR/signature-mismatch.rs:15:5 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` ... LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` | = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` - found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>` + found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output error: aborting due to previous error ``` Along with the UI tests in this PR, which I think are all improvements! r? `@oli-obk` though feel free to re-roll
2022-10-23Rollup merge of #103402 - joshtriplett:niche-wrap-fix, r=oli-obkMichael Howell-51/+69
Fix wrapped valid-range handling in ty_find_init_error Rust's niche handling allows for wrapping valid ranges with end < start; for instance, a valid range with start=43 and end=41 means a niche of 42. Most places in the compiler handle this correctly, but `ty_find_init_error` assumed that `lo > 0` means the type cannot contain a zero. Fix it to handle wrapping ranges.
2022-10-23Rollup merge of #103140 - chenyukang:yukang/fix-103112, r=estebankMichael Howell-0/+19
Add diagnostic for calling a function with the same name with unresolved Macro Fixes #103112
2022-10-23Annotate static lifetimes tooMichael Goulet-19/+19
2022-10-23Rollup merge of #103305 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-0/+0
Move some tests to more reasonable places r? `@petrochenkov`
2022-10-23Rollup merge of #103249 - petrochenkov:revaddids, r=oli-obkDylan DPC-1/+8
resolve: Revert "Set effective visibilities for imports more precisely" In theory the change was correct, but in practice the use of import items in HIR is limited and hacky, and it expects that (effective) visibilities for all (up to) 3 IDs of the import are set to the value reflecting (effective) visibility of the whole syntactic `use` item rather than its individual components. Fixes https://github.com/rust-lang/rust/issues/102352 r? `@oli-obk`
2022-10-23Rollup merge of #101908 - chenyukang:fix-101880, r=estebankDylan DPC-0/+94
Suggest let for assignment, and some code refactor Fixes #101880
2022-10-23Rollup merge of #101293 - compiler-errors:lt-is-actually-char, r=estebankDylan DPC-12/+112
Recover when unclosed char literal is parsed as a lifetime in some positions Fixes #101278
2022-10-23Rollup merge of #103368 - compiler-errors:normalization-ambiguity-bug, r=oli-obkMatthias Krüger-0/+135
Delay ambiguity span bug in normalize query iff not rustdoc Oli and I decided that the compiler debt of adding another usage of `tcx.sess.opts.actually_rustdoc` is fine, because we don't really want to add more complexity to the normalize query, and moving rustdoc to use fulfill normalization (`fully_normalize`, i.e. not use the normalize query) is unnecessary overhead given that it's skipping binders and stuff. r? oli-obk Fixes #102827 Fixes #103181
2022-10-23Rollup merge of #103355 - compiler-errors:rpitit-default-check, r=oli-obkMatthias Krüger-13/+50
Handle return-position `impl Trait` in traits properly in `register_hidden_type` The bounds that we get by calling `bound_explicit_item_bounds` from an RPITIT have projections, not opaques, but when we're *registering* an opaque, we want to treat it like an opaque. Coincidentally fixes #102688 as well, which makes sense, since that was failing because we were inferring an opaque type to be equal to itself (opaque cycle error => "cannot resolve opaque type"). Fixes #103352 r? ```@oli-obk```
2022-10-23Rollup merge of #103354 - clubby789:escape-string-literals, r=compiler-errorsMatthias Krüger-4/+45
Escape string literals when fixing overlong char literal Fixes #103323 ````@rustbot```` label +A-diagnostics +A-suggestion-diagnostics
2022-10-23Rollup merge of #103328 - compiler-errors:trivial-false-const-sugg, r=jackh726Matthias Krüger-61/+0
Do not suggest trivially false const predicates Pass through constness to `predicate_can_apply` and don't suggest other impls if it's satisfied but not const. Fixes #103267
2022-10-23Fix wrapped valid-range handling in ty_find_init_errorJosh Triplett-51/+69
Rust's niche handling allows for wrapping valid ranges with end < start; for instance, a valid range with start=43 and end=41 means a niche of 42. Most places in the compiler handle this correctly, but ty_find_init_error assumed that `lo > 0` means the type cannot contain a zero. Fix it to handle wrapping ranges. Add a test to cover this case.
2022-10-22Pretty print lifetimes captured by RPITMichael Goulet-2/+2
2022-10-22Rollup merge of #103224 - compiler-errors:semi-after-closure-in-macro, ↵Dylan DPC-0/+14
r=fee1-dead Allow semicolon after closure within parentheses in macros #88546 added some parsing logic that if we're parsing a closure, and we're within parentheses, and a semicolon follows, then we must be parsing something erroneous like: `f(|| a; b)`, so it replaces the closure body with an error expression. However, it's valid to parse those tokens if we're within a macro, as in #103222. This is a bit unsatisfying fix. Is there a more robust way of checking that we're within a macro? I would also be open to removing this "_It is likely that the closure body is a block but where the braces have been removed_" check altogether at the expense of more verbose errors, since it seems very suspicious in the first place... Fixes #103222.
2022-10-22Auto merge of #103227 - lcnr:bye-bye-unevaluated-const, r=oli-obkbors-20/+24
stop using `ty::UnevaluatedConst` directly best reviewed commit by commit. simplifies #99798 because we now don't have to expand `ty::UnevaluatedConst` to `ty::Const`. I also remember some other places where using `ty::UnevaluatedConst` directly was annoying and caused issues, though I don't quite remember what they were rn '^^ r? `@oli-obk` cc `@JulianKnodt`
2022-10-22Don't erroneously deny semicolons after closure expr within parentheses in a ↵Michael Goulet-0/+14
macro
2022-10-22Recover unclosed char literal being parsed as lifetimeMichael Goulet-12/+112
2022-10-22Update UI testsclubby789-4/+45
2022-10-21Auto merge of #103375 - matthiaskrgr:rollup-4xrs7f2, r=matthiaskrgrbors-85/+253
Rollup of 9 pull requests Successful merges: - #102635 (make `order_dependent_trait_objects` show up in future-breakage reports) - #103335 (Replaced wrong test with the correct mcve) - #103339 (Fix some typos) - #103340 (WinConsole::new is not actually fallible) - #103341 (Add test for issue 97607) - #103351 (Require Drop impls to have the same constness on its bounds as the bounds on the struct have) - #103359 (Remove incorrect comment in `Vec::drain`) - #103364 (rustdoc: clean up rustdoc-toggle CSS) - #103370 (rustdoc: remove unused CSS `.out-of-band { font-weight: normal }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-22Rollup merge of #103351 - oli-obk:tilde_const_impls, r=fee1-deadMatthias Krüger-46/+115
Require Drop impls to have the same constness on its bounds as the bounds on the struct have r? ``@fee1-dead``
2022-10-22Rollup merge of #103341 - Rageking8:add-test-for-issue-97607, r=compiler-errorsMatthias Krüger-0/+12
Add test for issue 97607 Fixes #97607 r? ``@compiler-errors`` Not sure which UI test dir to put this under, kindly let me know of a better dir if necessary and I will change it. Thanks.
2022-10-22Rollup merge of #103339 - Rageking8:fix-some-typos, r=fee1-deadMatthias Krüger-3/+3
Fix some typos
2022-10-22Rollup merge of #103335 - SarthakSingh31:issue-89008, r=jackh726Matthias Krüger-36/+11
Replaced wrong test with the correct mcve Closes #89008. The old test was wrong and the compiler was [correctly raising an error](https://github.com/rust-lang/rust/issues/89008#issuecomment-1285128060). The bug in the issue was resolved at some point but due to the wrong test the issue was never closed. This pr replaces that test with the correct MCVE (made by ``@jackh726).`` The error raised by the bug changed between when the bug was posted (2021-09-08) and when the MCVE [was posted](https://github.com/rust-lang/rust/issues/89008#issuecomment-950110735) (2021-10-23). I ran them both through `nightly-2021-09-08` and they produce identical error messages. They also produce identical but different from before error messages when ran through `nightly-2021-10-23`. <details> <summary>Error message with <code>nightly-2021-09-08</code></summary> The code with the original bug report: ``` error[E0277]: the size for values of type `Repr` cannot be known at compilation time --> src/main.rs:23:43 | 23 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` For more information about this error, try `rustc --explain E0277`. error: could not compile `test-234234` due to previous error ``` MVCE: ``` error[E0277]: the size for values of type `Repr` cannot be known at compilation time --> src/main.rs:30:43 | 30 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` For more information about this error, try `rustc --explain E0277`. error: could not compile `test-234234` due to previous error ``` </details> <details> <summary>Error message with <code>nightly-2021-10-23</code></summary> The code with the original bug report: ``` error[E0271]: type mismatch resolving `<impl futures::Future as futures::Future>::Output == impl futures::Stream` --> src/main.rs:23:43 | 19 | type LineStream<'a, Repr> = impl Stream<Item = Repr>; | ------------------------ the expected opaque type ... 23 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found struct `futures::stream::Empty` | = note: expected opaque type `impl futures::Stream` found struct `futures::stream::Empty<_>` error: could not find defining uses --> src/main.rs:19:33 | 19 | type LineStream<'a, Repr> = impl Stream<Item = Repr>; | ^^^^^^^^^^^^^^^^^^^^^^^^ For more information about this error, try `rustc --explain E0271`. error: could not compile `test-234234` due to 2 previous errors ``` MCVE: ``` error[E0271]: type mismatch resolving `<impl Future as Future>::Output == impl Stream` --> src/main.rs:30:43 | 28 | type LineStream<'a, Repr> = impl Stream<Item = Repr>; | ------------------------ the expected opaque type 29 | type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; 30 | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found struct `Empty` | = note: expected opaque type `impl Stream` found struct `Empty<_>` error: could not find defining uses --> src/main.rs:28:33 | 28 | type LineStream<'a, Repr> = impl Stream<Item = Repr>; | ^^^^^^^^^^^^^^^^^^^^^^^^ For more information about this error, try `rustc --explain E0271`. error: could not compile `test-234234` due to 2 previous errors ``` </details>
2022-10-22Rollup merge of #102635 - lcnr:incoherent_auto_trait_objects, r=jackh726Matthias Krüger-0/+112
make `order_dependent_trait_objects` show up in future-breakage reports tried to change it to a hard error in #102474 but breaking the more than 1000 dependents of `traitobject` doesn't feel great :sweat_smile: This lint has existed since more than 3 years now and the way this is currently implemented is buggy and will break with #102472. imo we should upgrade it to also report for dependencies and maybe also backport this to beta. Then after maybe 2-3 stable versions I would like to finally convert this lint to a hard error.
2022-10-21Auto merge of #101263 - lopopolo:lopopolo/c-unwind-fn-ptr-impls, r=thomccbors-2/+2
Add default trait implementations for "c-unwind" ABI function pointers Following up on #92964, only add default trait implementations for the `c-unwind` family of function pointers. The previous attempt in #92964 added trait implementations for many more ABIs and ran into concerns regarding the increase in size of the libcore rlib. An attempt to abstract away function pointer types behind a unified trait to reduce the duplication of trait impls is being discussed in #99531 but this change looks to be blocked on a lang MCP. Following `@RalfJung's` suggestion in https://github.com/rust-lang/rust/pull/99531#issuecomment-1233440142, this commit is another cut at #92964 but it _only_ adds the impls for `extern "C-unwind" fn` and `unsafe extern "C-unwind" fn`. I am interested in landing this patch to unblock the stabilization of the `c_unwind` feature. RFC: https://github.com/rust-lang/rfcs/pull/2945 Tracking Issue: https://github.com/rust-lang/rust/issues/74990
2022-10-21testsMichael Goulet-0/+135
2022-10-21Auto merge of #101077 - sunshowers:signal-mask-inherit, r=sunshowersbors-2/+4
Change process spawning to inherit the parent's signal mask by default Previously, the signal mask was always reset when a child process is started. This breaks tools like `nohup` which expect `SIGHUP` to be blocked for all transitive processes. With this change, the default behavior changes to inherit the signal mask. This also changes the signal disposition for `SIGPIPE` to only be changed if the `#[unix_sigpipe]` attribute isn't set.
2022-10-21Auto merge of #98450 - lqd:doc-metadata, r=lqd,GuillaumeGomezbors-0/+44
Remove more attributes from metadata A lot of the attributes that are currently stored in the metadata aren't used at all. The biggest metadata usage comes from the doc attributes currently but they are needed by rustdoc so we only removed the ones that cannot be used in downstream crates (doc comments on private items). r? `@ghost`
2022-10-21Handle RPITITs properly in register_hidden_typeMichael Goulet-13/+50
2022-10-21Require Drop impls to have the same constness on its bounds as the bounds on ↵Oli Scherer-46/+115
the struct have
2022-10-21Rollup merge of #103260 - cuviper:needs-asm-support, r=fee1-deadDylan DPC-14/+3
Fixup a few tests needing asm support
2022-10-21Rollup merge of #103111 - cjgillot:shadow-label, r=estebankDylan DPC-18/+33
Account for hygiene in typo suggestions, and use them to point to shadowed names Fixes https://github.com/rust-lang/rust/issues/97459 r? `@estebank`
2022-10-21Rollup merge of #102287 - compiler-errors:unused-must-use-also-supertrait, ↵Dylan DPC-0/+26
r=fee1-dead Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait` Given `impl Trait`, if one of its supertraits has a `#[must_use]`, then trigger the lint. This means that, for example, `-> impl ExactSizeIterator` also triggers the `must_use` on `trait Iterator`, which fixes #102183. This might need `@rust-lang/lang` sign-off, since it changes the behavior of the lint, so cc'ing them.
2022-10-21add test for issue 97607Rageking8-0/+12
2022-10-21fix some typosRageking8-3/+3
2022-10-21replaced wrong test with the correct mcveSarthak Singh-36/+11
2022-10-20Do not suggest trivially false const predicatesMichael Goulet-61/+0
2022-10-20Add UI regression test when querying visibility of generic parameterGuillaume Gomez-0/+9
2022-10-20Add ui test to ensure attributes generated from macros are kept as expectedGuillaume Gomez-0/+35
2022-10-20Change process spawning to inherit the parent's signal mask by defaultRain-2/+4
Previously, the signal mask is always reset when a child process is started. This breaks tools like `nohup` which expect `SIGHUP` to be blocked. With this change, the default behavior changes to inherit the signal mask. This also changes the signal disposition for `SIGPIPE` to only be changed if the `#[unix_sigpipe]` attribute isn't set.
2022-10-20Rollup merge of #103319 - fee1-dead-contrib:improve_tilde_const_msg, r=oli-obkMatthias Krüger-5/+42
Improve "`~const` is not allowed here" message r? `@oli-obk`
2022-10-20Rollup merge of #103281 - thomcc:long-overdue, r=jyn514Matthias Krüger-3/+3
Adjust `transmute{,_copy}` to be clearer about which of `T` and `U` is input vs output This is essentially a documentation-only change (although it does touch code in an irrelevant way).
2022-10-20Rollup merge of #103221 - TaKO8Ki:fix-103202, r=oli-obkMatthias Krüger-0/+16
Fix `SelfVisitor::is_self_ty` ICE Fixes #103202
2022-10-20Improve "`~const` is not allowed here" messageDeadbeef-5/+42
2022-10-20Elaborate supertrait bounds when triggering unused_must_use on impl TraitMichael Goulet-0/+26
2022-10-20fix rust-lang#101880: suggest let for assignment, and some code refactoryukang-0/+94
2022-10-20Move some tests for more reasonable placesCaio-0/+0
2022-10-20Auto merge of #103290 - matthiaskrgr:rollup-ngozai3, r=matthiaskrgrbors-1/+55
Rollup of 6 pull requests Successful merges: - #103197 (Stabilize proc_macro::Span::source_text) - #103251 (Fix item declaration highlighting) - #103262 (Adjusting test to needs-unwind, with linking issue) - #103268 (rustdoc: remove no-op CSS `nav.sub { font-size: 1rem }`) - #103272 (Remove extra spaces in docs) - #103276 (Erase regions before checking for `Default` in uninitialized binding error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup