about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-10-17Rollup merge of #116717 - estebank:issue-9082, r=oli-obkMatthias Krüger-0/+267
Special case iterator chain checks for suggestion When encountering method call chains of `Iterator`, check for trailing `;` in the body of closures passed into `Iterator::map`, as well as calls to `<T as Clone>::clone` when `T` is a type param and `T: !Clone`. Fix #9082.
2023-10-17Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkovMatthias Krüger-124/+749
Add new simpler and more explicit syntax for check-cfg <details> <summary> Old proposition (before the MCP) </summary> This PR adds a new simpler and more explicit syntax for check-cfg. It consist of two new form: - `exhaustive(names, values)` - `configure(name, "value1", "value2", ... "valueN")` The preview forms `names(...)` and `values(...)` have implicit meaning that are not strait-forward. In particular `values(foo)`&`values(bar)` and `names(foo, bar)` are not equivalent which has created [some confusions](https://github.com/rust-lang/rust/pull/98080). Also the `names()` and `values()` form are not clear either and again created some confusions where peoples believed that `values()`&`values(foo)` could be reduced to just `values(foo)`. To fix that the two new forms are made to be explicit and simpler. See the table of correspondence: - `names()` -> `exhaustive(names)` - `values()` -> `exhaustive(values)` - `names(foo)` -> `exhaustive(names)`&`configure(foo)` - `values(foo)` -> `configure(foo)` - `values(feat, "foo", "bar")` -> `configure(feat, "foo", "bar")` - `values(foo)`&`values(bar)` -> `configure(foo, bar)` - `names()`&`values()`&`values(my_cfg)` -> `exhaustive(names, values)`&`configure(my_cfg)` Another benefits of the new syntax is that it allow for further options (like conditional checking for --cfg, currently always on) without syntax change. The two previous forms are deprecated and will be removed once cargo and beta rustc have the necessary support. </details> This PR is the first part of the implementation of [MCP636 - Simplify and improve explicitness of the check-cfg syntax](https://github.com/rust-lang/compiler-team/issues/636). ## New `cfg` form It introduces the new [`cfg` form](https://github.com/rust-lang/compiler-team/issues/636) and deprecate the other two: ``` rustc --check-cfg 'cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))' ``` ## Default built-in names and values It also changes the default for the built-in names and values checking. - Built-in values checking would always be activated as long as a `--check-cfg` argument is present - Built-in names checking would always be activated as long as a `--check-cfg` argument is present **unless** if any `cfg(any())` arg is passed ~~**Note: depends on https://github.com/rust-lang/rust/pull/111068 but is reviewable (last two commits)!**~~ Resolve https://github.com/rust-lang/compiler-team/issues/636 r? `@petrochenkov`
2023-10-17Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obkbors-32/+563
Duplicate `~const` bounds with a non-const one in effects desugaring This should unblock #116058. r? `@oli-obk`
2023-10-17Auto merge of #116824 - notriddle:master, r=fmeasebors-0/+53
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 3) Follow up * https://github.com/rust-lang/rust/pull/116214 * https://github.com/rust-lang/rust/pull/116432
2023-10-16rustdoc: add `check-pass` to ICE test with no expected outputMichael Howell-0/+2
2023-10-16rustdoc: move ICE test to rustdoc-uiMichael Howell-0/+0
2023-10-16Add URL to test casesMichael Howell-0/+20
2023-10-16Rename `issue-\d+.rs` tests to have meaningful namesMichael Howell-0/+0
2023-10-16Auto merge of #116820 - GuillaumeGomez:rollup-l54ri5q, r=GuillaumeGomezbors-0/+72
Rollup of 6 pull requests Successful merges: - #116754 (coverage: Several small cleanups in `spans`) - #116798 (Improve display of parallel jobs in rustdoc-gui tester script) - #116800 (Fix implied outlives check for GAT in RPITIT) - #116805 (Make `rustc_onunimplemented` export path agnostic) - #116808 (Add myself to smir triage) - #116811 (Preserve unicode escapes in format string literals when pretty-printing AST) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-16Add `crate_name` to test so that it can be renamedMichael Howell-0/+31
2023-10-16Rollup merge of #116811 - ↵Guillaume Gomez-0/+31
narpfel:unpretty-unicode-escape-in-format-string-literal, r=Nilstrieb Preserve unicode escapes in format string literals when pretty-printing AST Fixes #116799 Thanks to `@Nilstrieb` for the pointer to the correct location, that was really helpful for someone unfamiliar with the codebase.
2023-10-16Rollup merge of #116800 - compiler-errors:rpitit-gat-outlives, r=jackh726Guillaume Gomez-0/+41
Fix implied outlives check for GAT in RPITIT We enforce certain `Self: 'lt` bounds for GATs to save space for more sophisticated implied bounds, but those currently operate on the HIR. Code was easily reworked to operate on def-ids so that we can properly let these suggestions propagate through synthetic associated types like RPITITs and AFITs. r? `@jackh726` or `@aliemjay` Fixes #116789
2023-10-16Auto merge of #114370 - krtab:pop_assume_cap, r=scottmcmbors-0/+24
Add invariant to Vec::pop that len < cap if pop successful Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-16Preserve unicode escapes in format string literals when pretty-printing ASTPaul Gey-0/+31
2023-10-16Auto merge of #116804 - matthiaskrgr:rollup-m2qm8ul, r=matthiaskrgrbors-47/+117
Rollup of 7 pull requests Successful merges: - #114157 (Enable triagebot no-merges check) - #116257 (Suggest trait bounds for used associated type on type param) - #116430 (vendoring in tarball sources) - #116709 (Update minifier version to 0.2.3) - #116786 (Update my mailmap entry) - #116790 (opt-dist: disable unused features for tabled crate) - #116802 (Remove `DefiningAnchor::Bubble` from opaque wf check) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-16Rollup merge of #116802 - compiler-errors:anchor-opaque-wf, r=oli-obkMatthias Krüger-40/+29
Remove `DefiningAnchor::Bubble` from opaque wf check Set the defining anchor to `DefiningAnchor::Bind(parent_def_id)` where `parent_def_id` is the first parent def-id that isn't an opaque. This "fixes" some of the nested-return-type wf tests. If we *do* want these to be hard-errors for TAITs, we should probably make those error separately from this check (i.e. via some check like the code in the `OPAQUE_HIDDEN_INFERRED_BOUND` lint). The fact that some of these tests fail but not all of them seems kinda coincidental. r? oli-obk
2023-10-16Rollup merge of #116257 - estebank:issue-101351, r=b-naberMatthias Krüger-7/+88
Suggest trait bounds for used associated type on type param Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-16Add invariant to Vec::pop that len < cap if pop successfulArthur Carcano-0/+24
Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-16Auto merge of #116731 - Alexendoo:hash-untracked-state, r=oli-obkbors-0/+1
Add `Config::hash_untracked_state` callback For context, I'm looking to use [late module passes](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/context/struct.LintStore.html#structfield.late_module_passes) in Clippy which unlike regular late passes run incrementally per module However we have a config file which can change between runs, we need changes to that to invalidate the `lint_mod` query. This PR adds a side channel for us to hash some extra state into `Options` in order to do that This does not make any changes to Clippy, I plan to do that in a PR to the Clippy repo along with some other required changes An alternative implementation would be to add a new query to track this state and override the `lint_mod` query in Clippy to first call that cc `@rust-lang/clippy`
2023-10-16Remove `DefiningAnchor::Bubble` from opaque wf checkMichael Goulet-40/+29
2023-10-16Fix outlives suggestion for GAT in RPITITMichael Goulet-0/+41
2023-10-16Auto merge of #114330 - RalfJung:dagling-ptr-deref, r=oli-obkbors-199/+259
don't UB on dangling ptr deref, instead check inbounds on projections This implements https://github.com/rust-lang/reference/pull/1387 in Miri. See that PR for what the change is about. Detecting dangling references in `let x = &...;` is now done by validity checking only, so some tests need to have validity checking enabled. There is no longer inherently a "nodangle" check in evaluating the expression `&*ptr` (aside from the aliasing model). r? `@oli-obk` Based on: - https://github.com/rust-lang/reference/pull/1387 - https://github.com/rust-lang/rust/pull/115524
2023-10-16add oversized-ref test backRalf Jung-1/+15
2023-10-16Rollup merge of #115196 - chenyukang:yukang-fix-86094, r=estebankMatthias Krüger-6/+165
Suggest adding `return` if the for semi which can coerce to the fn return type Fixes #86094 r? `@estebank`
2023-10-15Rollup merge of #116522 - bvanjoi:fix-115599, r=oli-obkMatthias Krüger-0/+18
use `PatKind::Error` when an ADT const value has violation Fixes #115599 Since the [to_pat](https://github.com/rust-lang/rust/pull/111913/files#diff-6d8d99538aca600d633270051580c7a9e40b35824ea2863d9dda2c85a733b5d9R126-R155) behavior has been changed in the #111913 update, the kind of `inlined_const_ast_pat` has transformed from `PatKind::Leaf { pattern: Pat { kind: Wild, ..} } ` to `PatKind::Constant`. This caused a scenario where there are no matched candidates, leading to a testing of the candidates. This process ultimately attempts to test the string const, triggering the `bug!` invocation finally. r? ``@oli-obk``
2023-10-15more precise error for 'based on misaligned pointer' caseRalf Jung-7/+7
2023-10-15place evaluation: require the original pointer to be aligned if an access ↵Ralf Jung-4/+23
happens
2023-10-15avoid re-checking the offset while iterating an array/sliceRalf Jung-0/+3
2023-10-15don't UB on dangling ptr deref, instead check inbounds on projectionsRalf Jung-189/+213
2023-10-15Suggest adding `return` if the type of unused semi return value can coerce ↵yukang-6/+165
to the fn return type
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-1/+1
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-15use `PatKind::error` when an ADT const value has violationbohan-0/+18
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-32/+563
2023-10-15Auto merge of #115515 - the8472:zip-for-arrays, r=scottmcmbors-0/+25
optimize zipping over array iterators Fixes #115339 (somewhat) the new assembly: ```asm zip_arrays: .cfi_startproc vmovups (%rdx), %ymm0 leaq 32(%rsi), %rcx vxorps %xmm1, %xmm1, %xmm1 vmovups %xmm1, -24(%rsp) movq $0, -8(%rsp) movq %rsi, -88(%rsp) movq %rdi, %rax movq %rcx, -80(%rsp) vmovups %ymm0, -72(%rsp) movq $0, -40(%rsp) movq $32, -32(%rsp) movq -24(%rsp), %rcx vmovups (%rsi,%rcx), %ymm0 vorps -72(%rsp,%rcx), %ymm0, %ymm0 vmovups %ymm0, (%rsi,%rcx) vmovups (%rsi), %ymm0 vmovups %ymm0, (%rdi) vzeroupper retq ``` This is still longer than the slice version given in the issue but at least it eliminates the terrible `vpextrb`/`orb` chain. I guess this is due to excessive memcpys again (haven't looked at the llvmir)? The `TrustedLen` specialization is a drive-by change since I had to do something for the default impl anyway to be able to specialize the `TrustedRandomAccessNoCoerce` impl.
2023-10-14Rollup merge of #116576 - eduardosm:const-eval-wasm-target-features, r=RalfJungGuillaume Gomez-0/+14
const-eval: allow calling functions with targat features disabled at compile time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988 r? `@RalfJung` Fixes https://github.com/rust-lang/rust/issues/116516
2023-10-14Auto merge of #116737 - matthiaskrgr:rollup-jftlnmt, r=matthiaskrgrbors-53/+223
Rollup of 6 pull requests Successful merges: - #115439 (rustdoc: hide `#[repr(transparent)]` if it isn't part of the public ABI) - #116591 (Don't accidentally detect the commit hash as an `fadd` instruction) - #116603 (Reorganize `bootstrap/Cargo.toml`) - #116715 (Prevent more spurious unreachable pattern lints) - #116723 (Fix broken build on ESP-IDF caused by #115108) - #116730 (Add some unsoundness tests for opaques capturing hidden regions not in substs) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-14const-eval: allow calling functions with targat features disabled at compile ↵Eduardo Sánchez Muñoz-0/+14
time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988
2023-10-14Rollup merge of #116730 - compiler-errors:unsoundness-tests-rpit, r=aliemjayMatthias Krüger-0/+134
Add some unsoundness tests for opaques capturing hidden regions not in substs Commit tests from https://github.com/rust-lang/rust/pull/116040#issuecomment-1751610237 and https://github.com/rust-lang/rust/pull/59402#issuecomment-476003242 so that we make sure not to regress them the next time that we relax the opaque capture rules :^)
2023-10-14Rollup merge of #116715 - Nadrieril:patkind-error, r=oli-obkMatthias Krüger-47/+10
Prevent more spurious unreachable pattern lints Continues the work of https://github.com/rust-lang/rust/pull/115937 by introducing `PatKind::Error`, to be used instead of `PatKind::Wild` when an error was raised during pattern lowering. Most of match checking lints are skipped when a `PatKind::Error` is encountered. This avoids confusing extra warnings when a pattern is malformed. Now `PatKind::Wild` should indicate an actual wildcard pattern. r? `@oli-obk`
2023-10-14Rollup merge of #116591 - Zalathar:flaky-hash, r=Mark-SimulacrumMatthias Krüger-0/+4
Don't accidentally detect the commit hash as an `fadd` instruction I've seen some reports of `tests/codegen/target-feature-inline-closure.rs` spuriously failing because it thinks the hash in the rustc version number contains an `fadd` instruction. https://github.com/rust-lang/rust/pull/116085#issuecomment-1751174916 https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Is.20.60tests.2Fcodegen.2Ftarget-feature-inline-closure.2Ers.60.20flakey https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Strange.20.5Cn.20in.20output.20of.20assert.20.23108341/near/395811335 This PR tries to make that not happen by adding a `CHECK-LABEL` directive that will match the line with the rustc version string, preventing the previous `CHECK-NOT` from seeing it.
2023-10-14Rollup merge of #115439 - fmease:rustdoc-priv-repr-transparent-heuristic, ↵Matthias Krüger-6/+75
r=GuillaumeGomez rustdoc: hide `#[repr(transparent)]` if it isn't part of the public ABI Fixes #90435. This hides `#[repr(transparent)]` when the non-1-ZST field the struct is "transparent" over is private. CC `@RalfJung` Tentatively nominating it for the release notes, feel free to remove the nomination. `@rustbot` label needs-fcp relnotes A-rustdoc-ui
2023-10-14Auto merge of #116264 - reez12g:issue-109728, r=Mark-Simulacrumbors-0/+19
add test for wasm linker override=clang addressing https://github.com/rust-lang/rust/issues/109728
2023-10-14Add `Config::hash_untracked_state` callbackAlex Macleod-0/+1
2023-10-14Auto merge of #116727 - matthiaskrgr:rollup-3qqdrny, r=matthiaskrgrbors-1/+1
Rollup of 5 pull requests Successful merges: - #116630 (Add ability to get lines/filename for Span in smir) - #116644 (remove outdated bootstrap FIXME) - #116695 (Fix a comment) - #116696 (Misc improvements) - #116704 (Fix AFIT lint message to mention pitfall) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-14Add some unsoundness tests for opaques capturing hidden regions not in substsMichael Goulet-0/+134
2023-10-14Rollup merge of #116689 - lcnr:auto-trait-hidden-ty-leak, r=compiler-errorsMatthias Krüger-1/+16
explicitly handle auto trait leakage in coherence does not impact behavior but may avoid weird bugs in the future, cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/65 r? ``@compiler-errors``
2023-10-14Skip most of check_match checks in the presence of `PatKind::Error`Nadrieril-34/+9
2023-10-14Propagate pattern errors via a new `PatKind::Error` variantNadrieril-13/+1
Instead of via `Const::new_error`
2023-10-14Rollup merge of #116704 - compiler-errors:afit-lint-plus, r=tmandryMatthias Krüger-1/+1
Fix AFIT lint message to mention pitfall Addresses https://github.com/rust-lang/rust/pull/116184#issuecomment-1745194387 by adding a short note. Not sure exactly of the wording -- I don't think this should be a blocker for the stabilization PR since we can iterate on this lint's messaging in the next few weeks in the worst case. r? `@tmandry` cc `@traviscross` `@jonhoo`
2023-10-14Auto merge of #116015 - EvanMerlock:master, r=oli-obkbors-0/+53
const_eval: allow function pointer signatures containing &mut T in const contexts potentially fixes #114994 We utilize a `TypeVisitor` here in order to more easily handle control flow. - In the event the typekind the Visitor sees is a function pointer, we skip over it - However, otherwise we do one of two things: - If we find a mutable reference, check it, then continue visiting types - If we find any other type, continue visiting types This means we will check if the function pointer _itself_ is mutable, but not if any of the types _within_ are.