about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-11-09Remove rich UserTypeProjection projections in SMIRKirby Linvill-1/+1
It's not clear to me (klinvill) that UserTypeProjections are produced anymore with the removal of type ascriptions as per https://github.com/rust-lang/rfcs/pull/3307. Furthermore, it's not clear to me which variants of ProjectionElem could appear in such projections. For these reasons, I'm reverting projections in UserTypeProjections to simple strings until I can get more clarity on UserTypeProjections.
2023-11-09Replace match assertions against empty slices with is_empty assertionsKirby Linvill-8/+6
Asserting is_empty is slightly more concise.
2023-11-09Move SMIR projections tests to new fileKirby Linvill-103/+175
2023-11-09Add stable MIR Projections support based on MIR structureKirby Linvill-0/+103
This commit includes richer projections for both Places and UserTypeProjections. However, the tests only touch on Places. There are also outstanding TODOs regarding how projections should be resolved to produce Place types, and regarding if UserTypeProjections should just contain ProjectionElem<(),()> objects as in MIR.
2023-11-09Auto merge of #117727 - saethlin:inline-derived-fmt, r=nnethercotebors-2/+22
Emit #[inline] on derive(Debug) While working on https://github.com/rust-lang/rust/pull/116583 I noticed that the `cross_crate_inlinable` query identifies a lot of derived `Debug` impls as a MIR body that's little more than a call, which suggests they may be a good candidate for `#[inline]`. So here I've implemented that change specifically. It seems to provide a nice improvement to build times.
2023-11-09Emit #[inline] on derive(Debug)Ben Kimock-2/+22
2023-11-09Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726bors-21/+55
generator layout: ignore fake borrows fixes #117059 We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: https://github.com/rust-lang/rust/blob/fab1054e1742790c22ccc92a625736d658363677/compiler/rustc_mir_build/src/build/matches/mod.rs#L1250-L1265 These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards. Only the second commit impacts behavior, and could be backported by itself. r? types
2023-11-09Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petrochenkovTakayuki Maeda-0/+21
Extend builtin/auto trait args with error when they have >1 argument Reuse `extend_with_error` to add error args to any auto trait (or built-in trait like `Copy` that is defined incorrectly) that has additional non-`Self` args. Fixes #117628
2023-11-08Auto merge of #117454 - shepmaster:github-actions-m1-tests, ↵bors-1/+1
r=GuillaumeGomez,onur-ozkan Run tests in CI for aarch64-apple-darwin r? `@ghost`
2023-11-08update mir-opt testslcnr-21/+21
2023-11-08generator layout: ignore fake borrowslcnr-0/+34
2023-11-08Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwcobors-54/+311
patterns: reject raw pointers that are not just integers Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not. This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context. Also fixes https://github.com/rust-lang/rust/issues/116929. Cc `@oli-obk` `@lcnr`
2023-11-08Auto merge of #117716 - GuillaumeGomez:rollup-83gnhll, r=GuillaumeGomezbors-210/+150
Rollup of 5 pull requests Successful merges: - #117263 (handle the case when the change-id isn't found) - #117282 (Recover from incorrectly ordered/duplicated function keywords) - #117679 (tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`) - #117702 (target: move base and target specifications) - #117713 (Add test for reexported hidden item with `--document-hidden-items`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-08Rollup merge of #117713 - GuillaumeGomez:document-hidden-json, r=notriddleGuillaume Gomez-0/+10
Add test for reexported hidden item with `--document-hidden-items` Coming from [this discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Using.20cargo-semver-checks.20in.20rustdoc.20JSON.20tests.3A.20revisited). cc ``@aDotInTheVoid`` r? ``@notriddle``
2023-11-08Rollup merge of #117679 - aDotInTheVoid:yes-core, r=GuillaumeGomezGuillaume Gomez-202/+41
tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items` See #117487 for motivation. I've split it into three commits, depending on how much work it was to remove `#![no_core]`. The first is entirely mechanical, the second makes no logical changes but couldn't be done with find+replace, and the third required rewriting assertions no not depend on having `#![no_core]`. All of the interesting changes for review are in the third commit, so I recommend reviewing commit-by-commit. After this, 3 tests still use `#![no_core]`: - `./tests/rustdoc-json/primitives/primitive_impls.rs`. Uses impls on primitives, so needs to simulate core - `./tests/rustdoc-json/primitives/local_primitive.rs`: Uses `rustc_doc_primitive`, so needs to simulate core - `./tests/rustdoc-json/impls/auto.rs`: Uses auto traits, so needs to simulate core But after this change, we only rely on the core-rustc boundary in tests that deliberately test those interactions. r? ``@GuillaumeGomez`` Fixes #117487
2023-11-08Rollup merge of #117282 - clubby789:recover-wrong-function-header, r=TaKO8KiGuillaume Gomez-8/+99
Recover from incorrectly ordered/duplicated function keywords Fixes #115714
2023-11-08Auto merge of #117560 - lqd:issue-117146, r=matthewjasperbors-0/+100
Compute polonius loan scopes over the region graph In issue #117146 a loan flows into an SCC containing a placeholder, and whose representative is an existential region. Since we currently compute loan scopes by looking at SCCs and their representatives only, polonius would compute kill points for this loan here whereas NLLs would not of course. There are a few ways to fix this: - don't try to be efficient by doing the computation over SCCs, and simply look for free regions and placeholders in the successors of the issuing region. - change how the SCC representatives are picked, biasing towards placeholders over existential regions. They *shouldn't* matter much, but some downstream code may subtly depend on the current scheme (though no tests fail if we do such a change). This is for unrelated reasons also the way #116891 changes the representative computation. So that PR would also fix issue #117146. - try to remove placeholders from the main path, and contain them to a pre-pass + a post-pass kind of polonius leak check. If possible, it would fix this issue by turning an outlives constraints to a placeholder into a constraint to 'static. This should also fix the issue, as the representative would be the free region in the SCC. We want to prototype this change to see if it's possible to try to simplify the borrowck main path from having to deal with placeholders and higher-ranked subtyping 🤞. I'd like to take advantage of fuzzing and a crater run sooner rather than later, so that we grow more confidence that the 2 models are indeed equivalent empirically. Therefore this PR implements option 1 to fix the issue now. We can take care of efficiency later after validation, and once we implement option 3 (which could also impact option 2 and that associated PR, maybe the lack of placeholders could remove the need to change the representative computation) to traverse SCCs and their representative again. (Or we maybe will have some kind of naive position-dependent outlives propagation by then and this code would have been changed) Fixes #117146. r? `@matthewjasper`
2023-11-08Add test for reexported hidden item with `--document-hidden-items`Guillaume Gomez-0/+10
2023-11-08Mark Rustdoc test as Linux-onlyJake Goulding-1/+1
Due to incorrect CI configuration, this test was not being run on macOS. aarch64-apple-darwin will start running it, so we correct the configuration.
2023-11-08Auto merge of #117706 - matthiaskrgr:rollup-lscx7dg, r=matthiaskrgrbors-18/+187
Rollup of 7 pull requests Successful merges: - #114316 (Add AIX platform support document) - #117531 (rustdoc: properly elide cross-crate host effect args) - #117650 (Add -Zcross-crate-inline-threshold=yes) - #117663 (bump some deps) - #117667 (Document clippy_config in nightly-rustc docs) - #117698 (Clarify `space_between`) - #117700 (coverage: Rename the `run-coverage` test mode to `coverage-run`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-08Rollup merge of #117700 - Zalathar:rename-run-coverage, r=onur-ozkanMatthias Krüger-3/+3
coverage: Rename the `run-coverage` test mode to `coverage-run` Follow-up to https://github.com/rust-lang/rust/pull/117484#issuecomment-1788916563. Renaming this test mode to `coverage-run` makes it more consistent with the `coverage-map` mode and the shared `tests/coverage` test directory. --- ``@rustbot`` label +A-code-coverage
2023-11-08Rollup merge of #117698 - nnethercote:space_between-2, r=petrochenkovMatthias Krüger-0/+31
Clarify `space_between` r? ``@petrochenkov``
2023-11-08Rollup merge of #117650 - saethlin:inline-me-please, r=davidtwcoMatthias Krüger-0/+106
Add -Zcross-crate-inline-threshold=yes ``@thomcc`` says this would be useful for > seeing if it makes a difference in some code if i do it when building the sysroot, since -Zbuild-std + lto helps more than it seems like it should And I've changed the possible values as a reference to ``@Manishearth`` saying > LLVM's inlining heuristic is "yes".
2023-11-08Rollup merge of #117531 - ↵Matthias Krüger-15/+47
fmease:rustdoc-effects-properly-elide-x-crate-host-args, r=GuillaumeGomez rustdoc: properly elide cross-crate host effect args Fixes FIXMEs introduced in #116670.
2023-11-08Auto merge of #117542 - compiler-errors:only-normalize-predicate, r=lcnrbors-7/+65
Only use `normalize_param_env` when normalizing predicate in `check_item_bounds` Only use the `normalize_param_env` when normalizing the item bound predicate in `check_item_bounds`, instead of using it when processing this obligation as well. This causes <BUG> to reoccur, but hopefully with better caching in the future, we can fix this would having such bad effects on perf. This PR also fixes #117598. It turns out that the GAT predicate that we install is actually wrong -- given code like: ``` impl<'r> HasValueRef<'r> for Any { type Database = Any; } ``` We currently generate a predicate that looks like `<Any as HasValueRef<'r>>::Database = Any`, where `'r` is an early-bound variable. Really this GAT assumption should be universally quantified over the impl's args, i.e. `for<'r> <Any as HasValueRef<'r>>::Database = Any`, but then we'd need the binder to also include all the WC of the impl as well, which we don't support yet, lol.
2023-11-08coverage: Rename the `run-coverage` test mode to `coverage-run`Zalathar-3/+3
This makes it more consistent with the `coverage-map` mode and the shared `tests/coverage` test directory.
2023-11-08More tests for token stream pretty-printing with adjacent punctuation.Nicholas Nethercote-0/+29
We currently do the wrong thing on a lot of these. The next commit will fix things.
2023-11-08Clarify `space_between`.Nicholas Nethercote-0/+2
To avoid `!matches!(...)`, which is hard to think about. Instead every case now uses direct pattern matching and returns true or false. Also add a couple of cases to the `stringify.rs` test that currently print badly.
2023-11-08Auto merge of #117484 - Zalathar:tests, r=cjgillotbors-2375/+320
coverage: Unify `tests/coverage-map` and `tests/run-coverage` into `tests/coverage` Ever since the introduction of the `coverage-map` suite, it's been awkward to have to manage two separate coverage test directories containing dozens of mostly-identical files. However, those two suites were separate for good reasons. They have very different requirements (since only one of them requires actually running the test program), running only one suite is noticeably faster than running both, and having separate suites allows them to be blessed separately if desired. So while unifying them was an obvious idea, actually doing so was non-trivial. --- Nevertheless, this PR finds a way to merge the two suites into one directory while retaining almost all of the developer-experience benefits of having two suites. This required non-trivial implementations of `Step`, but the end result works very smoothly. --- The first 5 commits are a copy of #117340, which has been closed in favour of this PR.
2023-11-08Only use normalize_param_env when normalizing predicate in check_item_boundsMichael Goulet-7/+65
2023-11-08Rollup merge of #117655 - compiler-errors:method-tweaks, r=estebankMatthias Krüger-40/+40
Method suggestion code tweaks I was rummaging around the method suggestion code after https://github.com/rust-lang/rust/pull/117006#discussion_r1384153722 and saw a few things to simplify. This is two unrelated commits, both in the same file. Review them separately, if you'd like. r? estebank
2023-11-08Rollup merge of #113925 - clubby789:const-ctor-repeat, r=estebankMatthias Krüger-9/+55
Improve diagnostic for const ctors in array repeat expressions Fixes #113912
2023-11-07Add -Zcross-crate-inline-threshold=yesBen Kimock-0/+106
2023-11-07Rollup merge of #117616 - RalfJung:unstable-target-features, r=compiler-errorsMatthias Krüger-2/+20
warn when using an unstable feature with -Ctarget-feature Setting or unsetting the wrong target features can cause ABI incompatibility (https://github.com/rust-lang/rust/issues/116344, https://github.com/rust-lang/rust/issues/116558). We need to carefully audit features for their ABI impact before stabilization. I just learned that we currently accept arbitrary unstable features on stable and if they are in the list of Rust target features, even unstable, then we don't even warn about that!1 That doesn't seem great, so I propose we introduce a warning here. This has an obvious loophole via `-Ctarget-cpu`. I'm not sure how to best deal with that, but it seems better to fix what we can and think about the other cases later, maybe once we have a better idea for how to resolve the general mess that are ABI-affecting target features.
2023-11-07Rollup merge of #115485 - DaniPopes:rustdoc-macro-consts, r=jackh726,fmeaseMatthias Krüger-0/+40
Format macro const literals with pretty printer Fixes #115295
2023-11-07tests/rustdoc-json: Rewrite tests no not use `#![no_core]`.Alona Enraght-Moony-37/+31
2023-11-07tests/rustdoc-json: Remove more needless uses of `#![no_core]`.Alona Enraght-Moony-39/+1
These were'nt done with regex, but don't require changes to assertions.
2023-11-07tests/rustdoc-json: Remove some needless uses of `#![no_core]`.Alona Enraght-Moony-126/+9
Done by removing all uses of `#![no_core]`, and the reverting the ones that failed. More involved ones are in a later commit.
2023-11-07manually bless a wasm-only testRalf Jung-0/+6
2023-11-07Auto merge of #117297 - clubby789:fn-trait-missing-paren, r=TaKO8Kibors-0/+27
Give a better diagnostic for missing parens in Fn* bounds Fixes #108109 It would be nice to try and recover here, but I'm not sure it's worth the effort, especially as the bounds on the recovered function would be incorrect.
2023-11-07Auto merge of #117229 - matthewjasper:thir-unsafeck-fixes, r=cjgillotbors-64/+362
Thir unsafeck fixes - Recognise thread local statics in THIR unsafeck - Add suggestion for unsafe_op_in_unsafe_fn - Fix unsafe checking of let expressions
2023-11-07Auto merge of #117610 - compiler-errors:object-hmm, r=aliemjaybors-0/+57
Only instantiate binder during dyn's built-in trait candidate probe once See UI test for demonstration of the issue. This was "caused" by #117131, but only because we're using the `normalize_param_env` (which has been augmented with a projection clause used to normalize GATs) which features non-lifetime bound vars in it. Fixes #117602 technically, though that's also fixed by #117542. r? types
2023-11-07Rework print_disambiguation_helpMichael Goulet-40/+40
2023-11-07Auto merge of #117006 - estebank:issue-69512, r=compiler-errorsbors-0/+50
When not finding assoc fn on type, look for builder fn When we have a resolution error when looking at a fully qualified path on a type, look for all associated functions on inherent impls that return `Self` and mention them to the user. ``` error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope --> tests/ui/resolve/fn-new-doesnt-exist.rs:4:28 | 4 | let stream = TcpStream::new(); | ^^^ function or associated item not found in `TcpStream` | note: if you're trying to build a new `TcpStream` consider using one of the following associated functions: TcpStream::connect TcpStream::connect_timeout --> /home/gh-estebank/rust/library/std/src/net/tcp.rs:156:5 | 156 | pub fn connect<A: ToSocketAddrs>(addr: A) -> io::Result<TcpStream> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 172 | pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` Fix #69512.
2023-11-07When not finding assoc fn on type, look for builder fnEsteban Küber-0/+50
When we have a resolution error when looking at a fully qualified path on a type, look for all associated functions on inherent impls that return `Self` and mention them to the user. Fix #69512.
2023-11-07coverage: Register `test::Coverage` as the test suite for `tests/coverage`Zalathar-7/+10
This restores the ability to run a coverage test by specifying its path, e.g. `./x.py test tests/coverage/if.rs`. This runs the test in both modes.
2023-11-07coverage: Migrate `tests/coverage-map` into `tests/coverage`Zalathar-2751/+0
2023-11-07coverage: Migrate `tests/run-coverage` into `tests/coverage`Zalathar-0/+0
2023-11-07coverage: Copy all remaining run-coverage tests into coverage-mapZalathar-0/+391
These multi-file tests were not copied over in #114843 because they weren't working, but it turns out that they just need the correct crate-type.
2023-11-07coverage: Copy all remaining coverage-map tests into run-coverageZalathar-0/+308