about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-04-17Rollup merge of #110257 - ↵Matthias Krüger-23/+77
lukas-code:why-would-anyone-write-code-like-that-anyway, r=oli-obk fix false positives for `unused_parens` around unary and binary operations fix https://github.com/rust-lang/rust/issues/110251
2023-04-17Rollup merge of #110038 - compiler-errors:infer-regions-in-transmutability, ↵Matthias Krüger-4/+49
r=lcnr Erase regions when confirming transmutability candidate Fixes an ICE where we call `layout_of` on a type with infer regions.
2023-04-17Auto merge of #109247 - saethlin:inline-without-inline, r=oli-obkbors-14/+14
Permit MIR inlining without #[inline] I noticed that there are at least a handful of portable-simd functions that have no `#[inline]` but compile to an assign + return. I locally benchmarked inlining thresholds between 0 and 50 in increments of 5, and 50 seems to be the best. Interesting. That didn't include check builds though, ~maybe perf will have something to say about that~. Perf has little useful to say about this. We generally regress all the check builds, as best as I can tell, due to a number of small codegen changes in a particular hot function in the compiler. Probably this is because we've nudged the inlining outcomes all over, and uses of `#[inline(always)]`/`#[inline(never)]` might need to be adjusted.
2023-04-16Erase regions when confirming transmutability candidateMichael Goulet-4/+49
2023-04-16Rollup merge of #109665 - fee1-dead-contrib:rm-remap-queries, r=oli-obkfee1-dead-0/+23
Remove `remap_env_constness` in queries This removes some of the complexities with const traits. #88119 used to be caused by this but was fixed by `param_env = param_env.without_const()`.
2023-04-16Rollup merge of #110379 - ehuss:unignore-tests, r=compiler-errorsfee1-dead-30/+39
Update some ignored tests. This unignores some tests which no longer need to be ignored (see individual commits for reasons why). This also adds some descriptions to why tests are ignored so they can be seen in the test output.
2023-04-16Auto merge of #105888 - skyzh:skyzh/suggest-lifetime-closure, r=compiler-errorsbors-1/+171
suggest lifetime for closure parameter type when mismatch This is a draft PR, will add test cases later and be ready for review. This PR fixes https://github.com/rust-lang/rust/issues/105675 by adding a diagnostics suggestion. Also a partial fix to https://github.com/rust-lang/rust/issues/105528. The following code will have a compile error now: ``` fn const_if_unit(input: bool) -> impl for<'a> FnOnce(&'a ()) -> usize { let x = |_| 1; x } ``` Before this PR: ``` error[E0308]: mismatched types --> src/lib.rs:3:5 | 3 | x | ^ one type is more general than the other | = note: expected trait `for<'a> FnOnce<(&'a (),)>` found trait `FnOnce<(&(),)>` note: this closure does not fulfill the lifetime requirements --> src/lib.rs:2:13 | 2 | let x = |_| 1; | ^^^ error: implementation of `FnOnce` is not general enough --> src/lib.rs:3:5 | 3 | x | ^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 ()) -> usize` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` For more information about this error, try `rustc --explain E0308`. error: could not compile `rust-test` due to 2 previous errors ``` After this PR: ``` error[E0308]: mismatched types --> src/lib.rs:3:5 | 3 | x | ^ one type is more general than the other | = note: expected trait `for<'a> FnOnce<(&'a (),)>` found trait `FnOnce<(&(),)>` note: this closure does not fulfill the lifetime requirements --> src/lib.rs:2:13 | 2 | let x = |_| 1; | ^^^ help: consider changing the type of the closure parameters | 2 | let x = |_: &_| 1; | ~~~~~~~ error: implementation of `FnOnce` is not general enough --> src/lib.rs:3:5 | 3 | x | ^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 ()) -> usize` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` For more information about this error, try `rustc --explain E0308`. error: could not compile `rust-test` due to 2 previous errors ``` After applying the suggestion, it compiles. The suggestion might not always be correct as the generation procedure of that suggestion is quite simple...
2023-04-16Auto merge of #110375 - JohnTitor:rollup-ghvdaxm, r=JohnTitorbors-0/+58
Rollup of 8 pull requests Successful merges: - #110033 (Add 1.69.0 release notes) - #110272 (fix: skip implied bounds if unconstrained lifetime exists) - #110307 (Allow everyone to set the beta-nominated label) - #110347 (Add intra-doc links to size_of_* functions) - #110350 (Add a UI test for #79605) - #110356 (Fix `x test rust-installer` when `cargo` is set to a relative path) - #110364 (remove redundant clones) - #110366 (fix some clippy::complexity) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-15Add some reasons why tests are ignored.Eric Huss-25/+21
2023-04-15Unignore issue-65918Eric Huss-2/+0
This test was fixed by https://github.com/rust-lang/rust/pull/65989
2023-04-16Rollup merge of #110350 - SparkyPotato:test-79605, r=cjgillotYuki Okushi-0/+20
Add a UI test for #79605 #79605 was fixed somewhere between December 2020 and now, but it did not have a UI test. This PR adds a UI test for the error.
2023-04-16Rollup merge of #110272 - Ezrashaw:fix-unconned-lt-in-implbounds, r=aliemjayYuki Okushi-0/+38
fix: skip implied bounds if unconstrained lifetime exists Fixes #110161 r? ````@aliemjay````
2023-04-15Auto merge of #110319 - ferrocene:pa-more-ignore-reasons, r=ehussbors-9/+9
[compiletest] Add more test ignore reasons, `needs-` validation, and improved error messages This PR makes more improvements to the way compiletest ignoring headers are handled, following up on #108905: * Human-readable ignore reasons have been added for the remaining ignore causes (`needs-*` directives, `*llvm*` directives, and debugger version directives). All ignored tests should now have a human-readable reason. * The code handling `needs-*` directives has been refactored, and now invalid `needs-*` directive emit errors like `ignore-*` and `only-*`. * All errors are now displayed at startup (with line numbers) rather than just the first error of the first file. This PR is best reviewed commit-by-commit. r? `@ehuss`
2023-04-15Unignore closure-bang.Eric Huss-3/+18
This test was ignored long ago in https://github.com/rust-lang/rust/pull/20578/ when the syntax for closures was changed. The current status is that a closure with an explicit `!` return type will trigger the `unreachable_code` lint which appears to be the original intent of the test (https://github.com/rust-lang/rust/pull/16836). A closure without a return type won't trigger the lint since the `!` type isn't inferred (AFAIK). This restores the test to its original form.
2023-04-15Temporarily disable the jobserver-error testEric Huss-0/+1
2023-04-15add UI test for #79605SparkyPotato-0/+20
2023-04-15Remove obsolete test.Camille GILLOT-47/+0
2023-04-15Bless run-make.Camille GILLOT-1/+7
2023-04-15Bless codegen test.Camille GILLOT-3/+0
2023-04-15Only enable ConstProp at mir-opt-level >= 2.Camille GILLOT-48/+0
2023-04-15Auto merge of #109802 - notriddle:notriddle/rustdoc-search-generics-nested, ↵bors-2/+174
r=GuillaumeGomez rustdoc-search: add support for nested generics This change allows `search.js` to parse nested generics (which look `Like<This<Example>>`) and match them. It maintains the existing "bag semantics", so that the order of type parameters is ignored but the number is required to be greater than or equal to what's in the query. For example, a function with the signature `fn read_all(&mut self: impl Read) -> Result<Vec<u8>, Error>` will match these queries: * `Read -> Result<Vec<u8>, Error>` * `Read -> Result<Error, Vec>` * `Read -> Result<Vec<u8>>` But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`.
2023-04-14rustdoc-search: add support for nested genericsMichael Howell-2/+174
2023-04-14Auto merge of #110197 - cjgillot:codegen-discr, r=pnkfelixbors-17/+21
Do not attempt to commute comparison and cast to codegen discriminants The general algorithm to compute a discriminant is: ``` relative_tag = tag - niche_start is_niche = relative_tag <= (ule) relative_max discr = if is_niche { cast(relative_tag) + niche_variants.start() } else { untagged_variant } ``` We have an optimization branch which attempts to merge the addition and the subtraction by commuting them with the cast. We currently get this optimization wrong. This PR takes the easiest and safest way: remove the optimization, and let LLVM handle it. (Perf may not agree with that course of action :sweat_smile:) There may be a less invasive solution, but I don't have the necessary knowledge of LLVM semantics to find it. Cranelift has the same optimization, which should be handled similarly. cc `@nikic` and `@bjorn3` if you have a better solution. Fixes https://github.com/rust-lang/rust/issues/110128
2023-04-14Rollup merge of #110244 - kadiwa4:unnecessary_imports, r=JohnTitorMatthias Krüger-1/+1
Remove some unneeded imports / qualified paths Continuation of #105537.
2023-04-14Rollup merge of #108687 - ↵Matthias Krüger-21/+27
compiler-errors:reformulate-point_at_expr_source_of_inferred_type, r=oli-obk Reformulate `point_at_expr_source_of_inferred_type` to be more accurate Be more accurate when deducing where along the several usages of a binding it is constrained to be some type that is incompatible with an expectation. This also renames the method to `note_source_of_type_mismatch_constraint` because I prefer that name, though I guess I can revert that. (Also drive-by rename `note_result_coercion` -> `suggest_coercing_result_via_try_operator`, because it's suggesting, not noting!) This PR is (probably?) best reviewed per commit, but it does regress a bit only to fix it later on, so it could also be reviewed as a whole if that makes the final results more clear. r? `@estebank`
2023-04-14Update codegen test.Camille GILLOT-2/+5
2023-04-14Fortify tests againts mir-opts.Camille GILLOT-15/+16
2023-04-14use param instead of tyAlex Chi-70/+46
Signed-off-by: Alex Chi <iskyzh@gmail.com>
2023-04-14better suggestion based on hirAlex Chi-4/+151
Signed-off-by: Alex Chi <iskyzh@gmail.com>
2023-04-14suggest lifetime for closure parameter type when mismatchAlex Chi-1/+48
2023-04-14Rollup merge of #110315 - oli-obk:mor_smir, r=WaffleLapkinYuki Okushi-0/+2
Add a stable MIR way to get the main function This is useful for analysis tools that only analyze the code paths that a specific program actually goes through. Or for code generators built on top of stable MIR.
2023-04-14Rollup merge of #103682 - Swatinem:stable-run-directory, r=GuillaumeGomezYuki Okushi-2/+2
Stabilize rustdoc `--test-run-directory` This should resolve https://github.com/rust-lang/rust/issues/84674
2023-04-14rename rust-lldb to needs-rust-lldb for consistencyPietro Albini-9/+9
2023-04-14implement review suggestionsEzra Shaw-7/+9
2023-04-14Add a stable MIR way to get the main functionOli Scherer-0/+2
2023-04-14Rollup merge of #110279 - GuillaumeGomez:compiler-macro-derive, r=notriddleMatthias Krüger-4/+23
rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro Part of https://github.com/rust-lang/rust/issues/110111. There were actually one issue split in two parts: * Compiler built-in proc-macro were incorrectly considered as macros and not proc-macros. * Re-exports of compiler built-in proc-macros were considering them as macros. Both issues can be fixed by looking at the `MacroKind` variant instead of just relying on information extracted later on. r? ``@fmease``
2023-04-14Rollup merge of #110276 - nnethercote:rm-BrAnon-Span, r=jackh726Matthias Krüger-4/+4
Remove all but one of the spans in `BoundRegionKind::BrAnon` There are only three places where `BoundRegionKind::BrAnon` uses `Some(span)` instead of `None`. Two of them are easy to remove, which this PR does. r? ```@jackh726```
2023-04-14Rollup merge of #110207 - compiler-errors:new-solver-unpin, r=lcnrMatthias Krüger-4/+28
Assemble `Unpin` candidates specially for generators in new solver Fixes compiler-errors/next-solver-hir-issues#16 r? ``@lcnr``
2023-04-14Rollup merge of #110180 - lcnr:canonicalize, r=compiler-errorsMatthias Krüger-327/+12
don't uniquify regions when canonicalizing uniquifying causes a bunch of issues, most notably it causes `AliasEq(<?x as Trait<'a>>::Assoc, <?x as Trait<'a>>::Assoc)` to result in ambiguity because both `normalizes-to` paths result in ambiguity and substs equate should trivially succeed but doesn't because we uniquified `'a` to two different regions. I originally added uniquification to make it easier to deal with requirement 6 from the dev-guide: https://rustc-dev-guide.rust-lang.org/solve/trait-solving.html#requirements > ### 6. Trait solving must be (free) lifetime agnostic > > Trait solving during codegen should have the same result as during typeck. As we erase > all free regions during codegen we must not rely on them during typeck. A noteworthy example > is special behavior for `'static`. cc https://github.com/rust-lang/rustc-dev-guide/pull/1671 Relying on regions being identical may cause ICE during MIR typeck, but even without this PR we can end up relying on that as type inference vars can resolve to types which contain an identical region. Let's land this and deal with any ICE that crop up as we go. Will look at this issue again before stabilization. r? ```@compiler-errors```
2023-04-14Rollup merge of #109800 - bryangarza:safe-transmute-improved-errors, ↵Matthias Krüger-537/+358
r=compiler-errors Improve safe transmute error reporting This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-14Auto merge of #109875 - jyn514:no-fulldeps, r=compiler-errorsbors-11/+13
Move most ui-fulldeps tests to ui/ Same rationale as https://github.com/rust-lang/rust/pull/109770, they don't actually need a stage 2 build. This increases the limit for the UI directory because otherwise it was annoying to be constantly moving files into subdirectories when I fixed a test; https://github.com/rust-lang/rust/pull/109873 makes up for it. cc https://github.com/rust-lang/rust/pull/109770, https://github.com/rust-lang/rust/pull/109874
2023-04-14Add test for uniquifying regionsMichael Goulet-0/+12
2023-04-14Assemble Unpin candidates specially for generators in new solverMichael Goulet-4/+28
2023-04-13Fix tests on wasmJoshua Nelson-4/+6
The `std` test straightforwardly can't work without file descriptors; #99417 tracks moving it out of tests/ui. `issue-13560.rs` requires the target to support dynamic linking. `extern-mod-syntax` is interesting. The original test was added to check if `extern mod` could be parsed correctly and used `extern mod std` and an import: https://github.com/rust-lang/rust/commit/138dc3048af36f0a20f857542c357fe8df563013#diff-73700e1e851b7a37bc92174635dab726124c82e5bfabbbc45b4a3c2e8e14fadd At some point `std::json::Object` was moved out of std to an unstable rustc-only `extras` crate, and rather than just changing the import it got changed to use the unstable crate. When `extras` was removed, people assumed the test was meant to also test rustc_private and changed it to another unstable crate rather than using something in std. This changes the test to remove the `rustc_private` import, to allow it to work properly when cross-compiling.
2023-04-13Move most ui-fulldeps tests to uijyn-0/+0
They pass fine. Only tests that required `extern crate rustc_*` or were marked `ignore-stage1` have been keep in fulldeps.
2023-04-14Remove another use of `BrAnon(Some(_))`.Nicholas Nethercote-2/+2
2023-04-14Remove one use of `BrAnon(Some(_))`.Nicholas Nethercote-2/+2
2023-04-13Improve safe transmute error reportingBryan Garza-537/+358
This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-13Rollup merge of #110283 - saethlin:check-panics-before-alignment, r=bjorn3Matthias Krüger-0/+17
Only emit alignment checks if we have a panic_impl Fixes https://github.com/rust-lang/rust/issues/109996 r? `@bjorn3` because you commented that this situation could impact you as well
2023-04-13Rollup merge of #110277 - Ezrashaw:combine-assoc-fns-dlint, r=lcnrMatthias Krüger-58/+115
dead-code-lint: de-dup multiple unused assoc functions Fixes #109600 Prior art: #97853