about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-10-23Rollup merge of #103254 - fmease:fix-24183, r=GuillaumeGomezMichael Howell-0/+33
rustdoc: do not filter out cross-crate `Self: Sized` bounds All type parameters **except `Self`** are implicitly `Sized` ([via](https://doc.rust-lang.org/nightly/std/marker/trait.Sized.html)). Previously, we disregarded the exception of `Self` and omitted cross-crate `Sized` bounds of *any* type parameter *including* `Self` when rendering. From now on, we *do* render cross-crate `Self: Sized` bounds. Most notably, in `std` we now finally properly render the `Sized` bound of the `Clone` trait as well as the `Self: Sized` bound on `Iterator::map`. Fixes #24183. ``@rustbot`` label T-rustdoc A-cross-crate-reexports r? rustdoc
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-23Fix windows compilationGary Guo-1/+2
2022-10-23Do not consider repeated lifetime params for elision.Camille GILLOT-1/+16
2022-10-23Add test case for foreign Rust exceptionsGary Guo-0/+25
2022-10-23test attr: point at return type if Termination bound unsatisfiedLeón Orell Valerian Liehr-7/+5
2022-10-23Add normalize hack backMichael Goulet-0/+31
2022-10-23Annotate static lifetimes tooMichael Goulet-19/+19
2022-10-23Allow specifying multiple alternative suggestionsXiretza-2/+133
This allows porting uses of span_suggestions() to diagnostic structs. Doesn't work for multipart_suggestions() because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while multipart_suggestions() creates multiple possible replacements, each with multiple spans.
2022-10-23Auto merge of #101403 - bjorn3:dylib_lto, r=Mark-Simulacrumbors-0/+1
Enable LTO for rustc_driver.so Alternative to https://github.com/rust-lang/rust/pull/97154 This enables LTO'ing dylibs behind a feature flag and uses this feature for compiling rustc_driver.so.
2022-10-23Use functions for jump-to-def-background rustodoc GUI testGuillaume Gomez-38/+17
2022-10-23Introduce dedicated `-Zdylib-lto` flag for enabling LTO on `dylib`sJakub Beránek-0/+1
2022-10-23Auto merge of #103431 - Dylan-DPC:rollup-oozfo89, r=Dylan-DPCbors-13/+214
Rollup of 6 pull requests Successful merges: - #101293 (Recover when unclosed char literal is parsed as a lifetime in some positions) - #101908 (Suggest let for assignment, and some code refactor) - #103192 (rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`) - #103226 (Check `needs_infer` before `needs_drop` during HIR generator analysis) - #103249 (resolve: Revert "Set effective visibilities for imports more precisely") - #103305 (Move some tests to more reasonable places) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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-23Workaround unstable stmt_expr_attributes for method receiver expressions.Camille GILLOT-14/+17
2022-10-23Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errorsbors-342/+356
Flatten diagnostic slug modules This makes it easier to grep for the slugs in the code. See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it. This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know. r? `@davidtwco`
2022-10-23Update translation testsNilstrieb-342/+356
2022-10-23Rollup merge of #103401 - GuillaumeGomez:gui-test-headings-cleanup, r=notriddleMatthias Krüger-100/+76
Use functions for headings rustdoc GUI test r? ````@notriddle````
2022-10-23Rollup merge of #103368 - compiler-errors:normalization-ambiguity-bug, r=oli-obkMatthias Krüger-0/+159
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-22Clean middle RPITITs correctly in rustdocMichael Goulet-0/+25
2022-10-22Use functions for headings rustodoc GUI testGuillaume Gomez-100/+76
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-22Rollup merge of #103190 - ↵Dylan DPC-8/+11
fmease:rustdoc-render-bounds-of-cross-crate-gat-params, r=GuillaumeGomez rustdoc: render bounds of cross-crate GAT params Follow-up to #102439. Render the trait bounds of type parameters of cross-crate (generic) associated types. `````@rustbot````` label T-rustdoc A-cross-crate-reexports r? `````@GuillaumeGomez`````
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-22Check fat pointer metadata compatibility modulo regionsMichael Goulet-0/+17
2022-10-22Bless testsDeadbeef-6/+4
2022-10-22Stabilize arbitrary_enum_discriminant, take 2Deadbeef-116/+8
2022-10-22Note scope of TAIT more accuratelyMichael Goulet-4/+4
2022-10-22Don't ICE on regions from anonymous_lifetime_in_impl_traitMichael Goulet-0/+28
2022-10-21Only apply `ProceduralMasquerade` hack to older versions of `rental`Aaron Hill-105/+321
The latest version of `rental` (v0.5.6) contains a fix that allows it to compile without relying on the pretty-print back-compat hack. Hopefully, there are no longer any crates relying on the affected versions of the (much less popular) `procedural-masquerade` crate. This should allow us to target the pretty-print back-compat hack specifically to older versions of `rental`, and specifically mention upgrading to `rental` v0.5.6 in the lint message.
2022-10-22Auto merge of #103172 - pcwalton:deduced-param-attrs, r=oli-obkbors-1/+61
Introduce deduced parameter attributes, and use them for deducing `readonly` on indirect immutable freeze by-value function parameters. Introduce deduced parameter attributes, and use them for deducing `readonly` on indirect immutable freeze by-value function parameters. Right now, `rustc` only examines function signatures and the platform ABI when determining the LLVM attributes to apply to parameters. This results in missed optimizations, because there are some attributes that can be determined via analysis of the MIR making up the function body. In particular, `readonly` could be applied to most indirectly-passed by-value function arguments (specifically, those that are freeze and are observed not to be mutated), but it currently is not. This patch introduces the machinery that allows `rustc` to determine those attributes. It consists of a query, `deduced_param_attrs`, that, when evaluated, analyzes the MIR of the function to determine supplementary attributes. The results of this query for each function are written into the crate metadata so that the deduced parameter attributes can be applied to cross-crate functions. In this patch, we simply check the parameter for mutations to determine whether the `readonly` attribute should be applied to parameters that are indirect immutable freeze by-value. More attributes could conceivably be deduced in the future: `nocapture` and `noalias` come to mind. Adding `readonly` to indirect function parameters where applicable enables some potential optimizations in LLVM that are discussed in [issue 103103] and [PR 103070] around avoiding stack-to-stack memory copies that appear in functions like `core::fmt::Write::write_fmt` and `core::panicking::assert_failed`. These functions pass a large structure unchanged by value to a subfunction that also doesn't mutate it. Since the structure in this case is passed as an indirect parameter, it's a pointer from LLVM's perspective. As a result, the intermediate copy of the structure that our codegen emits could be optimized away by LLVM's MemCpyOptimizer if it knew that the pointer is `readonly nocapture noalias` in both the caller and callee. We already pass `nocapture noalias`, but we're missing `readonly`, as we can't determine whether a by-value parameter is mutated by examining the signature in Rust. I didn't have much success with having LLVM infer the `readonly` attribute, even with fat LTO; it seems that deducing it at the MIR level is necessary. No large benefits should be expected from this optimization *now*; LLVM needs some changes (discussed in [PR 103070]) to more aggressively use the `noalias nocapture readonly` combination in its alias analysis. I have some LLVM patches for these optimizations and have had them looked over. With all the patches applied locally, I enabled LLVM to remove all the `memcpy`s from the following code: ```rust fn main() { println!("Hello {}", 3); } ``` which is a significant codegen improvement over the status quo. I expect that if this optimization kicks in in multiple places even for such a simple program, then it will apply to Rust code all over the place. [issue 103103]: https://github.com/rust-lang/rust/issues/103103 [PR 103070]: https://github.com/rust-lang/rust/pull/103070
2022-10-22Update UI testsclubby789-4/+45
2022-10-21Auto merge of #103375 - matthiaskrgr:rollup-4xrs7f2, r=matthiaskrgrbors-85/+276
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 #103364 - notriddle:notriddle/toggles, r=jshaMatthias Krüger-0/+23
rustdoc: clean up rustdoc-toggle CSS
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