about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-07-05Auto merge of #127008 - Jules-Bertholet:tc-ergonomics, r=Nadrierilbors-44/+392
Match ergonomics 2024: Implement TC's match ergonomics proposal Under gate `ref_pat_eat_one_layer_2024_structural`. Enabling `ref_pat_eat_one_layer_2024` at the same time allows the union of what the individual gates allow. `@traviscross` r? `@Nadrieril` cc https://github.com/rust-lang/rust/issues/123076 `@rustbot` label A-edition-2024 A-patterns
2024-07-05Auto merge of #127344 - matthiaskrgr:morecrashes, r=jieyouxubors-0/+204
crashes: add latest r? `@jieyouxu` `@bors` rollup=iffy
2024-07-05Auto merge of #126171 - RalfJung:simd_bitmask_multibyte, r=workingjubileebors-12/+123
simd_bitmask intrinsic: add a non-power-of-2 multi-byte example r? `@calebzulawski` `@workingjubilee`
2024-07-04crashes: add latestMatthias Krüger-0/+204
2024-07-04Rollup merge of #127319 - oli-obk:fail2taint, r=compiler-errorsMatthias Krüger-0/+13
Remove a use of `StructuredDiag`, which is incompatible with automatic error tainting and error translations fixes #127219 I want to remove all of `StructuredDiag`, but it's a bit more involved as it is also used from the `ItemCtxt`, which doesn't support tainting yet.
2024-07-04Rollup merge of #127301 - estebank:fix-suggestions, r=UrgauMatthias Krüger-372/+706
Tweak some structured suggestions to be more verbose and accurate Addressing some issues I found while working on #127282. ``` error: this URL is not a hyperlink --> $DIR/auxiliary/include-str-bare-urls.md:1:11 | LL | HEADS UP! https://example.com MUST SHOW UP IN THE STDERR FILE! | ^^^^^^^^^^^^^^^^^^^ | = note: bare URLs are not automatically turned into clickable links note: the lint level is defined here --> $DIR/include-str-bare-urls.rs:14:9 | LL | #![deny(rustdoc::bare_urls)] | ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead | LL | HEADS UP! <https://example.com> MUST SHOW UP IN THE STDERR FILE! | + + ``` ``` error[E0384]: cannot assign twice to immutable variable `v` --> $DIR/assign-imm-local-twice.rs:7:5 | LL | v = 1; | ----- first assignment to `v` LL | println!("v={}", v); LL | v = 2; | ^^^^^ cannot assign twice to immutable variable | help: consider making this binding mutable | LL | let mut v: isize; | +++ ``` ``` error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:23 | LL | trait Sub<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | type Test = dyn Add + Sub; | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types help: set the type parameter to the desired type | LL | type Test = dyn Add + Sub<Rhs>; | +++++ ``` ``` error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable --> $DIR/issue-33819.rs:4:34 | LL | Some(ref v) => { let a = &mut v; }, | ^^^^^^ cannot borrow as mutable | help: try removing `&mut` here | LL - Some(ref v) => { let a = &mut v; }, LL + Some(ref v) => { let a = v; }, | ``` ``` help: remove the invocation before committing it to a version control system | LL - dbg!(); | ``` ``` error[E0308]: mismatched types --> $DIR/issue-39974.rs:1:21 | LL | const LENGTH: f64 = 2; | ^ expected `f64`, found integer | help: use a float literal | LL | const LENGTH: f64 = 2.0; | ++ ``` ``` error[E0529]: expected an array or slice, found `Vec<i32>` --> $DIR/match-ergonomics.rs:8:9 | LL | [&v] => {}, | ^^^^ pattern cannot match with input type `Vec<i32>` | help: consider slicing here | LL | match x[..] { | ++++ ``` ``` error[E0609]: no field `0` on type `[u32; 1]` --> $DIR/parenthesized-deref-suggestion.rs:10:21 | LL | (x as [u32; 1]).0; | ^ unknown field | help: instead of using tuple indexing, use array indexing | LL | (x as [u32; 1])[0]; | ~ + ```
2024-07-04Rollup merge of #127283 - dingxiangfei2009:check-repr-transparent, r=davidtwcoMatthias Krüger-1/+123
Reject SmartPointer constructions not serving the purpose Tracking issue: #123430 With this PR we will reject a row of malformed `SmartPointer` implementor candidates. cc `@Darksonn` `@davidtwco` for context.
2024-07-04Rollup merge of #127037 - oli-obk:define_opaque_types18, r=davidtwcoMatthias Krüger-61/+0
Remove some duplicated tests probably some parallel PR development that happened here, copying over the same examples from issues.
2024-07-04Rollup merge of #123043 - GoldsteinE:fix/repr-c-dead-branches, r=oli-obkMatthias Krüger-0/+1546
Disable dead variant removal for `#[repr(C)]` enums. This prevents removing dead branches from a `#[repr(C)]` enum (they now get discriminants allocated as if they were inhabited). Implementation notes: ABI of something like ```rust #[repr(C)] enum Foo { Foo(!), } ``` is still `Uninhabited`, but its layout is now computed as if all the branches were inhabited. This seemed to me like a proper way to do it, especially given that ABI sanity check explicitly asserts that type-level uninhabitedness implies ABI uninhabitedness. This probably needs some sort of FCP (given that it changes `#[repr(C)]` layout, which is a stable guarantee), but I’m not sure how to call for one or which team is the most relevant. See https://github.com/rust-lang/unsafe-code-guidelines/issues/500.
2024-07-04Remove a use of `StructuredDiag`, which is incompatible with automatic error ↵Oli Scherer-0/+13
tainting and error translations
2024-07-04reject SmartPointer constructions not serving the purposeDing Xiang Fei-1/+123
2024-07-04Rollup merge of #127289 - aDotInTheVoid:rustdoc-json-lt, r=GuillaumeGomezJacob Pratt-0/+32
rustdoc-json: Better representation of lifetime bounds in where clauses. As suggested [on zulip][1] (CC `@its-the-shrimp),` there's no need to use `GenericBound` here, as the only bound a lifetime can have is that it outlives other lifetimes. While we're making breaking changes here, I also renamed it from using "region" to "lifetime", as this is more user-aligned. See [this comment][2] for details. [1]: https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/.60ItemEnum.3A.3AOpaqueTy.60/near/448871430 [2]: https://github.com/rust-lang/rust/issues/100961#issuecomment-2206565556 r? `@GuillaumeGomez`
2024-07-04Tweak raw-pointer field access and array indexing suggestionsEsteban Küber-22/+32
2024-07-04Tweak slice and as_deref suggestion spanEsteban Küber-38/+72
Use multispan suggestion.
2024-07-04More accurate mutability suggestionEsteban Küber-129/+230
2024-07-04Use shorter span for float literal suggestionEsteban Küber-56/+88
2024-07-04Fix `&mut` removal suggestionEsteban Küber-12/+21
2024-07-04Better suggestion span for missing type parameterEsteban Küber-8/+40
2024-07-04Better span for "make binding mutable" suggestionEsteban Küber-87/+123
2024-07-04Auto merge of #127127 - notriddle:notriddle/pulldown-cmark-0.11, ↵bors-0/+102
r=GuillaumeGomez rustdoc: update to pulldown-cmark 0.11 r? rustdoc This pull request updates rustdoc to the latest version of pulldown-cmark. Along with adding new markdown extensions (which this PR doesn't enable), the new pulldown-cmark version also fixes a large number of bugs. Because all text files successfully parse as markdown, these bugfixes change the output, which can break people's existing docs. A crater run, https://github.com/rust-lang/rust/pull/121659, has already been run for this change. The first commit upgrades and fixes rustdoc. The second commit adds a lint for the footnote and block quote parser changes, which break the largest numbers of docs in the Crater run. The strikethrough change was mitigated in pulldown-cmark itself. Unblocks https://github.com/rust-lang/rust-clippy/pull/12876
2024-07-04Adjust rustdoc automatic link suggestionEsteban Küber-20/+100
Use more accurate spans for multipart suggestion.
2024-07-03Auto merge of #127296 - matthiaskrgr:rollup-1t1isa7, r=matthiaskrgrbors-90/+306
Rollup of 6 pull requests Successful merges: - #127092 (Change return-type-notation to use `(..)`) - #127184 (More refactorings to rustc_interface) - #127190 (Update LLVM submodule) - #127253 (Fix incorrect suggestion for extra argument with a type error) - #127280 (Disable rmake test rustdoc-io-error on riscv64gc-gnu) - #127294 (Less magic number for corountine) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-03Rollup merge of #127280 - ↵Matthias Krüger-2/+7
ferrocene:hoverbear/disable-rmake-rustdoc-io-error, r=jieyouxu Disable rmake test rustdoc-io-error on riscv64gc-gnu In https://github.com/rust-lang/rust/pull/126917 we disabled `inaccessible-temp-dir` on `riscv64gc-gnu` because the container runs the build as `root` (just like the `armhf-gnu` builds). Tests creating an inaccessible test directory are not possible, since `root` can always touch those directories. https://github.com/rust-lang/rust/blob/553a69030e5a086eb3841d020db8c9c463948c72/src/ci/docker/host-x86_64/disabled/riscv64gc-gnu/Dockerfile#L99 This means the tests are run as `root`. As `root`, it's perfectly normal and reasonable to violate permission checks this way: ```bash $ sudo mkdir scratch $ sudo chmod o-w scratch $ sudo mkdir scratch/backs $ ``` Because of this, this PR makes the test ignored on `riscv64gc` (just like on `armhf-gnu`) for now. As an alternative, I believe the best long-term strategy would be to not run the tests as `root` for this job. Some preliminary exploration was done in https://github.com/rust-lang/rust/pull/126917#issuecomment-2189933970, however that appears a larger lift. ## Testing > [!NOTE] > `riscv64gc-unknown-linux-gnu` is a [**Tier 2 with Host Tools** platform](https://doc.rust-lang.org/beta/rustc/platform-support.html), all tests may not necessarily pass! This change should only ignore `inaccessible-temp-dir` and not affect other tests. You can test out the job locally: ```sh DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu ``` r? `@jieyouxu`
2024-07-03Rollup merge of #127253 - chenyukang:yukang-fix-126246-fn-parameters-check, ↵Matthias Krüger-0/+145
r=estebank Fix incorrect suggestion for extra argument with a type error Fixes #126246 I tried to fix it in the `find_errors` of ArgMatrix, but seems it's hard to avoid breaking some other test cases. The root cause is we eliminate the first argument even with a type error at here: https://github.com/rust-lang/rust/blob/6292b2af620dbd771ebb687c3a93c69ba8f97268/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs#L664 So the left argument is always treated as extra one. But if there is already a type error, an error message will be generated firstly, which make this issue a trivial one.
2024-07-03Rollup merge of #127184 - bjorn3:interface_refactor2, r=NadrierilMatthias Krüger-2/+5
More refactorings to rustc_interface Follow up to https://github.com/rust-lang/rust/pull/126834
2024-07-03Rollup merge of #127092 - compiler-errors:rtn-dots-redux, r=estebankMatthias Krüger-86/+149
Change return-type-notation to use `(..)` Aligns the syntax with the current wording of [RFC 3654](https://github.com/rust-lang/rfcs/pull/3654). Also implements rustfmt support (along with making a match exhaustive). Tracking: * https://github.com/rust-lang/rust/issues/109417
2024-07-03Auto merge of #127044 - Oneirical:fantestic-journey, r=Kobzol,jieyouxubors-70/+133
Migrate `dylib-chain`, `rlib-chain`, `issue-47384`, `msvc-opt-minsize` and `test-harness` `run-make` tests to ui/rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: aarch64-apple
2024-07-03rustdoc-json: Better representation of lifetime bounds in where clauses.Alona Enraght-Moony-0/+32
As suggested [on zulip][1], there's no need to use `GenericBound` here, as the only bound a lifetime can have is that it outlives other lifetimes. While we're making breaking changes here, I also renamed it from using "region" to "lifetime", as this is more user-aligned. See [this comment][2] for details. [1]: https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/.60ItemEnum.3A.3AOpaqueTy.60/near/448871430 [2]: https://github.com/rust-lang/rust/issues/100961#issuecomment-2206565556
2024-07-03Disable rmake test rustdoc-io-error on riscv64gc-gnuAna Hobden-2/+7
2024-07-03Auto merge of #127278 - matthiaskrgr:rollup-fjexkdr, r=matthiaskrgrbors-2/+135
Rollup of 8 pull requests Successful merges: - #126803 (Change `asm-comments` to `verbose-asm`, always emit user comments) - #127050 (Make mtime of reproducible tarballs dependent on git commit) - #127145 (Add `as_lang_item` to `LanguageItems`, new trait solver) - #127202 (Remove global error count checks from typeck) - #127233 (Some parser cleanups) - #127248 (Add parse fail test using safe trait/impl trait) - #127264 (Small `run-make-support` API improvements) - #127270 (bootstrap: pass correct struct size to winapi) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-03Rollup merge of #127264 - GuillaumeGomez:run-make-support-api-improvements, ↵Matthias Krüger-1/+1
r=Kobzol Small `run-make-support` API improvements r? `@Kobzol`
2024-07-03Rollup merge of #127248 - spastorino:unsafe-extern-tests, r=compiler-errorsMatthias Krüger-0/+47
Add parse fail test using safe trait/impl trait Added 2 more tests to be sure that nothing weird happens using `safe` on items. Needed to do this in separate tests as they give parsing errors.
2024-07-03Rollup merge of #127202 - oli-obk:do_not_count_errors, r=wesleywiserMatthias Krüger-1/+75
Remove global error count checks from typeck Some of these are not reachable anymore, others can now rely on information local to the current typeck run. One check was actually invalid, because it was relying on wfcheck running before typeck, which is not guaranteed in the query system and usually easy to create ICEing examples for via const eval (which runs typeck before wfcheck)
2024-07-03Rollup merge of #126803 - tgross35:verbose-asm, r=AmanieuMatthias Krüger-0/+12
Change `asm-comments` to `verbose-asm`, always emit user comments Implements what is described in https://github.com/rust-lang/compiler-team/issues/762 Tracking issue: https://github.com/rust-lang/rust/issues/126802
2024-07-03Add parse fail test using safe trait/impl traitSantiago Pastorino-0/+47
2024-07-03Auto merge of #126094 - petrochenkov:libsearch, r=michaelwoeristerbors-0/+20
linker: Link dylib crates by path Linkers seem to support linking dynamic libraries by path. Not sure why the previous scheme with splitting the path into a directory (passed with `-L`) and a name (passed with `-l`) was used (upd: likely due to https://github.com/rust-lang/rust/pull/126094#issuecomment-2155063414). When we split a library path `some/dir/libfoo.so` into `-L some/dir` and `-l foo` we add `some/dir` to search directories for *all* libraries looked up by the linker, not just `foo`, and `foo` is also looked up in *all* search directories not just `some/dir`. Technically we may find some unintended libraries this way. Therefore linking dylibs via a full path is both simpler and more reliable. It also makes the set of search directories more easily reproducible when we need to lookup some native library manually (like in https://github.com/rust-lang/rust/pull/123436).
2024-07-03Auto merge of #125507 - compiler-errors:type-length-limit, r=lcnrbors-65/+80
Re-implement a type-size based limit r? lcnr This PR reintroduces the type length limit added in #37789, which was accidentally made practically useless by the caching changes to `Ty::walk` in #72412, which caused the `walk` function to no longer walk over identical elements. Hitting this length limit is not fatal unless we are in codegen -- so it shouldn't affect passes like the mir inliner which creates potentially very large types (which we observed, for example, when the new trait solver compiles `itertools` in `--release` mode). This also increases the type length limit from `1048576 == 2 ** 20` to `2 ** 24`, which covers all of the code that can be reached with craterbot-check. Individual crates can increase the length limit further if desired. Perf regression is mild and I think we should accept it -- reinstating this limit is important for the new trait solver and to make sure we don't accidentally hit more type-size related regressions in the future. Fixes #125460
2024-07-03Small `run-make-support` API improvementsGuillaume Gomez-1/+1
2024-07-03Rollup merge of #127245 - BoxyUwU:gce_hang_test, r=NilstriebJacob Pratt-0/+32
Add a test for `generic_const_exprs` Fixes #103770 r? ``@Nilstrieb``
2024-07-03Rollup merge of #127239 - RalfJung:big-endian, r=NadrierilJacob Pratt-6/+5
remove unnecessary ignore-endian-big from stack-overflow-trait-infer … Follow-up to [this](https://github.com/rust-lang/rust/pull/122895#discussion_r1632206218) discussion
2024-07-03Rollup merge of #127115 - RalfJung:unreferenced-used-static, r=lqd,ChrisDentonJacob Pratt-3/+4
unreferenced-used-static: run test everywhere Follow-up to https://github.com/rust-lang/rust/pull/127099.
2024-07-03Rollup merge of #126917 - ↵Jacob Pratt-2/+6
ferrocene:hoverbear/riscv64-inaccessible-temp-dir-resolution, r=jieyouxu Disable rmake test `inaccessible-temp-dir` on riscv64 In https://github.com/rust-lang/rust/pull/126279 the `inaccessible-temp-dir` test was moved to rmake, I followed up with a 'fix' derived from https://github.com/rust-lang/rust/pull/126355 in https://github.com/rust-lang/rust/pull/126707. That 'fix' was misguided and hiding the true issue of the linker being incorrect for `riscv64gc-unknown-linux-gnu` (addressed in https://github.com/rust-lang/rust/pull/126916). Unfortunately, even with the linker fixed, this test doesn't work. I asked myself why this appeared to work on other platforms and investigated why. Both the containers for `armhf-gnu` and `riscv64gc` run their tests as `root` and have `NO_CHANGE_USER` set: https://github.com/rust-lang/rust/blob/553a69030e5a086eb3841d020db8c9c463948c72/src/ci/docker/host-x86_64/disabled/riscv64gc-gnu/Dockerfile#L99 This means the tests are run as `root`. As `root`, it's perfectly normal and reasonable to violate permission checks this way: ```bash $ sudo mkdir scratch $ sudo chmod o-w scratch $ sudo mkdir scratch/backs $ ``` Because of this, this PR makes the test ignored on `riscv64gc` for now. As an alternative, I believe the best long-term strategy would be to not run the tests as `root` for this job. ## Testing > [!NOTE] > `riscv64gc-unknown-linux-gnu` is a [**Tier 2 with Host Tools** platform](https://doc.rust-lang.org/beta/rustc/platform-support.html), all tests may not necessarily pass! This change should only ignore `inaccessible-temp-dir` and not affect other tests. You can test out the job locally: ```sh mv src/ci/docker/host-x86_64/disabled/riscv64gc-gnu src/ci/docker/host-x86_64/riscv64gc-gnu DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu ```
2024-07-03Rollup merge of #126403 - compiler-errors:better-type-errors, r=lcnrJacob Pratt-9/+39
Actually report normalization-based type errors correctly for alias-relate obligations in new solver We have some special casing to report type mismatch errors that come from projection predicates, but we don't do that for alias-relate obligations. This PR implements that. There's a bit of code duplication, but 🤷 Best reviewed without whitespace. r? lcnr
2024-07-03Rollup merge of #123588 - tgross35:stabilize-assert_unchecked, r=dtolnayJacob Pratt-6/+2
Stabilize `hint::assert_unchecked` Make the following API stable, including const: ```rust // core::hint, std::hint pub const unsafe fn assert_unchecked(p: bool); ``` This PR also reworks some of the documentation and adds an example. Tracking issue: https://github.com/rust-lang/rust/issues/119131 FCP: https://github.com/rust-lang/rust/issues/119131#issuecomment-1906394087. The docs update should resolve the remaining concern.
2024-07-03Auto merge of #123737 - compiler-errors:alias-wf, r=lcnrbors-0/+20
Check alias args for WF even if they have escaping bound vars #### What This PR stops skipping arguments of aliases if they have escaping bound vars, instead recursing into them and only discarding the resulting obligations referencing bounds vars. #### An example: From the test: ``` trait Trait { type Gat<U: ?Sized>; } fn test<T>(f: for<'a> fn(<&'a T as Trait>::Gat<&'a [str]>)) where for<'a> &'a T: Trait {} //~^ ERROR the size for values of type `[()]` cannot be known at compilation time fn main() {} ``` We now prove that `str: Sized` in order for `&'a [str]` to be well-formed. We were previously unconditionally skipping over `&'a [str]` as it referenced a buond variable. We now recurse into it and instead only discard the `[str]: 'a` obligation because of the escaping bound vars. #### Why? This is a change that improves consistency about proving well-formedness earlier in the pipeline, which is necessary for future work on where-bounds in binders and correctly handling higher-ranked implied bounds. I don't expect this to fix any unsoundness. #### What doesn't it fix? Specifically, this doesn't check projection predicates' components are well-formed, because there are too many regressions: https://github.com/rust-lang/rust/pull/123737#issuecomment-2052198478
2024-07-02Always preserve user-written comments in assemblyTrevor Gross-0/+12
2024-07-03Fix incorrect suggestion for extra argument with a type erroryukang-0/+145
2024-07-02Instance::resolve -> Instance::try_resolve, and other nitsMichael Goulet-1/+3
2024-07-02Actually report normalization-based type errors correctly for alias-relate ↵Michael Goulet-9/+39
obligations in new solver
2024-07-02Re-implement a type-size based limitMichael Goulet-65/+78