about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-09-25rename lint; add tracking issueRalf Jung-8/+8
2023-09-24work towards rejecting consts in patterns that do not implement PartialEqRalf Jung-2/+50
2023-09-23Auto merge of #116047 - a-lafrance:I80836-codegen-test, r=Mark-Simulacrumbors-0/+17
Add codegen test to guard against VecDeque optimization regression Very small PR that adds a codegen test to guard against regression for the `VecDeque` optimization addressed in #80836. Ensures that Rustc optimizes away the panic when unwrapping the result of `.get(0)` because of the `!is_empty()` condition.
2023-09-23Auto merge of #116081 - compiler-errors:closure-captures-sized, r=cjgillotbors-0/+217
Check that closure/generator's interior/capture types are sized check that closure upvars and generator interiors are sized. this check is only necessary when `unsized_fn_params` or `unsized_locals` is enabled, so only check if those are active. Fixes #93622 Fixes #61335 Fixes #68543
2023-09-23Auto merge of #116045 - notriddle:notriddle/issue-83556, r=cjgillotbors-0/+12
diagnostics: avoid mismatch between variance index and hir generic This happens because variances are constructed from ty generics, and ty generics are always constructed with lifetimes first. https://github.com/rust-lang/rust/blob/b3aa8e7168a3d940122db3561289ffbf3f587262/compiler/rustc_hir_analysis/src/collect/generics_of.rs#L248-L269 Fixes #83556
2023-09-23Auto merge of #116071 - estebank:issue-115905, r=compiler-errorsbors-1/+24
Point at cause of expectation of `break` value when possible When encountering a type error within the value of a `break` statement, climb the HIR tree to identify if the expectation comes from an assignment or a return type (if the loop is the tail expression of a `fn`). Fix #115905.
2023-09-22diagnostics: simpler 83556 handling by bailing outMichael Howell-12/+1
2023-09-23Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkinbors-2/+2
Add a way to decouple the implementation and the declaration of a TyCtxt method. properly addresses https://github.com/rust-lang/rust/pull/115819 accepted MCP: https://github.com/rust-lang/compiler-team/issues/395
2023-09-23Check types live across yields in generators tooMichael Goulet-0/+183
2023-09-23Check that closure's by-value captures are sizedMichael Goulet-0/+34
2023-09-23Auto merge of #115695 - tmiasko:compiletest-supported-sanitizers, r=oli-obkbors-11/+16
compiletest: load supported sanitizers from target spec
2023-09-22Point at cause of expectation of `break` value when possibleEsteban Küber-1/+24
Fix #115905.
2023-09-22Auto merge of #116077 - matthiaskrgr:rollup-2y1buzg, r=matthiaskrgrbors-15/+195
Rollup of 6 pull requests Successful merges: - #115770 (Match on elem first while building move paths) - #115999 (Capture scrutinee of if let guards correctly) - #116056 (Make unsized casts illegal) - #116061 (Remove TaKO8Ki from review rotation) - #116062 (Change `start` to `#[start]` in some diagnosis) - #116067 (Open the FileEncoder file for reading and writing) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-22Rollup merge of #116067 - saethlin:meta-stats-ice, r=WaffleLapkinMatthias Krüger-0/+7
Open the FileEncoder file for reading and writing Maybe I just don't know `File` well enough, but the previous comment didn't make it clear enough to me that we can't use `File::create`. This one does. Fixes https://github.com/rust-lang/rust/issues/116055 r? `@WaffleLapkin`
2023-09-22Rollup merge of #116062 - eduardosm:start-fn-diag, r=WaffleLapkinMatthias Krüger-15/+15
Change `start` to `#[start]` in some diagnosis They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22Rollup merge of #116056 - ouz-a:wide_ice, r=compiler-errorsMatthias Krüger-0/+15
Make unsized casts illegal Weirdly enough this https://github.com/rust-lang/rust/issues/115998 issue seems to exist since Rust 1.0 (couldn't check before that) but it's only recently been noticed. This change makes those casts illegal. Fixes https://github.com/rust-lang/rust/issues/115998
2023-09-22Rollup merge of #115999 - matthewjasper:closure-capture-let-guards, r=b-naberMatthias Krüger-0/+158
Capture scrutinee of if let guards correctly Previously we were always capturing by value. cc #51114
2023-09-22Merge `ExternProviders` into the general `Providers` structOli Scherer-2/+2
2023-09-22Open the FileEncoder file for reading and writingBen Kimock-0/+7
2023-09-22Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31bors-17/+29
[breaking change] Validate crate name in `--extern` [MCP 650] Reject non-ASCII-identifier crate names passed to the CLI option `--extern` (`rustc`, `rustdoc`). Implements [MCP 650](https://github.com/rust-lang/compiler-team/issues/650) (except that we only allow ASCII identifiers not arbitrary Rust identifiers). Fixes #113035. [As mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Disallow.20non-identifier-valid.20--extern.20cr.E2.80.A6.20compiler-team.23650/near/376826988), doing a crater run probably doesn't make sense since it wouldn't yield anything. Most users don't interact with `rustc` directly but only ever through Cargo which always passes a valid crate name to `--extern` when it invokes `rustc` and `rustdoc`. In any case, the user wouldn't be able to use such a crate name in the source code anyway. Note that I'm not using [`rustc_session::output::validate_crate_name`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/output/fn.validate_crate_name.html) (used for `--crate-name` and `#![crate_name]`) since the latter doesn't reject non-ASCII crate names and ones that start with a digit. As an aside, I've also thought about getting rid of `validate_crate_name` entirely in a separate PR (with another MCP) in favor of `is_ascii_ident` to reject more weird `--crate-name`s, `#![crate_name]`s and file names but I think that would lead to a lot of actual breakage, namely because of file names starting with a digit. In `tests/ui` 9 tests would be impacted for example. CC `@estebank` r? `@est31`
2023-09-22Fix test on targets with crt-static defaultTomasz Miąsko-11/+16
2023-09-22make unsized cast illegalouz-a-0/+15
2023-09-22Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obkbors-435/+435
adjust how closure/generator types are printed I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
2023-09-22Change `start` to `#[start]` in some diagnosisEduardo Sánchez Muñoz-15/+15
They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22Capture scrutinee of if let guards correctlyMatthew Jasper-0/+158
Previously we were always capturing by value.
2023-09-22Rollup merge of #116049 - RalfJung:future-incompat, r=NilstriebMatthias Krüger-2/+2
give FutureIncompatibilityReason variants more explicit names Also make the `reason` field mandatory when declaring a lint, to make sure this is a deliberate decision.
2023-09-22Rollup merge of #116039 - estebank:nested-tait, r=compiler-errorsMatthias Krüger-0/+56
Account for nested `impl Trait` in TAIT Fix #116031. r? `@compiler-errors`
2023-09-22Rollup merge of #116036 - Enselic:split-large_moves, r=oli-obkMatthias Krüger-94/+96
tests/ui: Split large_moves.rs and move to lint/large_assignments To make failing tests easier to debug with `--emit=mir`, etc. Don't bother with `revisions: attribute option` for both tests though. Seems sufficient to just have that on one of the tests. `git show -M --find-renames=40%` makes the diff easier to review. Or note that before this change we had one test with 4 errors, now we have 2 tests with 2 errors each. r? `@oli-obk` Part of https://github.com/rust-lang/rust/issues/83518
2023-09-22Rollup merge of #116034 - chenyukang:yukang-98601-add-ui-testcase, r=estebankMatthias Krüger-0/+44
add UI test for delimiter errors Fixes #98601 from https://github.com/rust-lang/rust/issues/98601#issuecomment-1721515067 r? `@estebank`
2023-09-22hide rustc line numbers in testRalf Jung-2/+2
2023-09-22Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obkbors-119/+133
Enable effects for libcore ~~r? `@oli-obk~~` forgot you are on vacation, oops
2023-09-22Auto merge of #115910 - eduardosm:lang-fns-target-features, r=cjgillotbors-0/+56
Prevent using `#[target_feature]` on lang item functions Fixes https://github.com/rust-lang/rust/issues/109411 and also prevents from using `#[target_feature]` on other `fn` lang items to mitigate the concerns from https://github.com/rust-lang/rust/issues/109411#issuecomment-1477030273.
2023-09-21Add test to guard against VecDeque optimization regressionArthur Lafrance-0/+17
2023-09-21diagnostics: avoid mismatch between variance index and hir genericMichael Howell-0/+23
This happens because variances are constructed from ty generics, and ty generics are always constructed with lifetimes first. See compiler/rustc_hir_analysis/src/collect/generics_of.rs:248-269 Fixes #83556
2023-09-21Auto merge of #115897 - eduardosm:check-fn-sig, r=compiler-errorsbors-119/+181
rustc_hir_analysis: add a helper to check function the signature mismatches This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch. This is the first time I do anything with rustc_hir_analysis/rustc_hir_typeck, so comments and suggestions about things I did wrong or that could be improved will be appreciated.
2023-09-21Auto merge of #115864 - compiler-errors:rpitit-sugg, r=estebankbors-16/+149
Suggest desugaring to return-position `impl Future` when an `async fn` in trait fails an auto trait bound First commit allows us to store the span of the `async` keyword in HIR. Second commit implements a suggestion to desugar an `async fn` to a return-position `impl Future` in trait to slightly improve the `Send` situation being discussed in #115822. This suggestion is only made when `#![feature(return_type_notation)]` is not enabled -- if it is, we should instead suggest an appropriate where-clause bound.
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-435/+435
2023-09-21Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naberbors-2/+4
added support for GNU/Hurd adding support for i686-unknown-hurd-gnu
2023-09-21Suggest desugaring to RPITIT when AFIT is required to be an auto traitMichael Goulet-0/+133
2023-09-21Record asyncness span in HIRMichael Goulet-16/+16
2023-09-21tests/ui: Split large_moves.rs and move to lint/large_assignmentsMartin Nordholts-96/+98
To make failing tests easier to debug with --emit=mir, etc.
2023-09-21Account for nested `impl Trait` in TAITEsteban Küber-0/+56
Fix #116031.
2023-09-21Auto merge of #114399 - Zalathar:no-renumber, r=jackh726bors-136/+128
coverage: Don't bother renumbering expressions on the Rust side The LLVM API that we use to encode coverage mappings already has its own code for removing unused coverage expressions and renumbering the rest. This lets us get rid of our own complex renumbering code, making it easier to change our coverage code in other ways. --- Now that we have tests for coverage mappings (#114843), I've been able to verify that this PR doesn't make the coverage mappings worse, thanks to an explicit simplification step.
2023-09-21tests/ui: Fix large_moves attribute cfgMartin Nordholts-1/+1
We only want the attribute for the attribute revision.
2023-09-21added support for GNU/HurdSamuel Thibault-2/+4
2023-09-21add UI test for delimiter errorsyukang-0/+44
2023-09-21Rollup merge of #116019 - dtolnay:percratesearch, r=GuillaumeGomezGuillaume Gomez-9/+0
Delete obsolete `--disable-per-crate-search` rustdoc flag This unstable flag is unused by rustdoc since https://github.com/rust-lang/rust/pull/92526/commits/ef96d573bff12330080d22f12cad96b818ea5da7. We should avoid landing this until after https://github.com/rust-lang/docs.rs/pull/2225 is deployed to docs.rs.
2023-09-21Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obkGuillaume Gomez-4/+4
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... ``@oli-obk`` any ideas?
2023-09-21Rollup merge of #115936 - oli-obk:inline_const_promotion, r=RalfJungGuillaume Gomez-0/+36
Prevent promotion of const fn calls in inline consts We don't wanna make that mistake we did for statics and consts worse by letting more code use it. r? ``@RalfJung`` cc https://github.com/rust-lang/rust/issues/76001
2023-09-21Rollup merge of #115257 - Urgau:invalid-utf8-walk-up-hir, r=NilstriebGuillaume Gomez-39/+123
Improve invalid UTF-8 lint by finding the expression initializer This PR introduce a small mechanism to walk up the HIR through bindings, if/else, consts, ... when trying lint on invalid UTF-8. Fixes https://github.com/rust-lang/rust/issues/115208