about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
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-07Build pre-coroutine-transform coroutine bodyMichael Goulet-0/+25
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-07test and fix some more targetsRalf Jung-0/+9
2023-11-07add regression testRalf Jung-8/+30
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-07Apply structured suggestion that allows test to work since 1.64Esteban Küber-1/+13
Close #73497.
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
2023-11-07coverage: Flatten `coverage-map/status-quo/` into its parent directoryZalathar-1/+1
2023-11-07coverage: Remove `tests/coverage-map/if.rs`Zalathar-24/+0
There is another test named `if.rs` in `tests/coverage-map/status-quo/`, so this test stands in the way of flattening that directory into its parent. Fortunately both tests are more-or-less equivalent, so removing this one is fine.
2023-11-07coverage: Use `-Copt-level=2` by default in run-coverage testsZalathar-14/+32
This is a step towards being able to unify the two coverage test directories. There are two tests that require adjustment: - `overflow.rs` requires an explicit `-Coverflow-checks=yes` - `sort_groups.rs` is sensitive to provably unused instantiations
2023-11-07Auto merge of #117511 - gurry:117406-err-packed-structs, r=compiler-errorsbors-0/+271
Emit explanatory note for move errors in packed struct derives Derive expansions for packed structs with non-`Copy` fields cause move errors because they prefer copying over borrowing since borrowing the fields of a packed struct can result in unaligned access. This underlying cause of the errors, however, is not apparent to the user. This PR adds a diagnostic note to make it clear to the user (the new note is on the second last line): ``` tests/ui/derives/deriving-with-repr-packed-move-errors.rs:13:16 | 12 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)] | ----- in this derive macro expansion 13 | struct StructA(String); | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait | = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) ``` Fixes #117406 Partially addresses #110777
2023-11-06Don't instantiate the binder twice when assembling object candidateMichael Goulet-0/+38
2023-11-06Only check predicates for late-bound non-lifetime vars in object candidate ↵Michael Goulet-0/+19
assembly
2023-11-06Auto merge of #117641 - matthiaskrgr:rollup-f9c12td, r=matthiaskrgrbors-0/+52
Rollup of 4 pull requests Successful merges: - #117190 (add test for #113381) - #117516 (add test for #113375) - #117631 (Documentation cleanup for core::error::Request.) - #117637 (Check binders with bound vars for global bounds that don't hold) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-06Extend builtin/auto trait args with error when they have >1 argumentMichael Goulet-0/+21
2023-11-06Rollup merge of #117637 - lqd:trivial-bounds-with-binder-vars, r=compiler-errorsMatthias Krüger-0/+8
Check binders with bound vars for global bounds that don't hold This fixes `soa_derive-0.13.0` from #117589's crater run. r? `@compiler-errors`
2023-11-06Rollup merge of #117516 - matthiaskrgr:test_effects_113375_oob, r=fee1-deadMatthias Krüger-0/+18
add test for #113375 Fixes #113375 r? `@fee1-dead`
2023-11-06Rollup merge of #117190 - matthiaskrgr:test_effects_113381, r=fee1-deadMatthias Krüger-0/+26
add test for #113381 Fixes #113381 r? fee1-dead
2023-11-06Auto merge of #117292 - estebank:issue-80446, r=davidtwcobors-0/+37
Detect misparsed binop caused by missing semi When encountering ```rust foo() *bar = baz; ``` We currently emit potentially two errors, one for the return type of `foo` not being multiplicative by the type of `bar`, and another for `foo() * bar` not being assignable. We now check for this case and suggest adding a semicolon in the right place and emit only a single error. Fix #80446.
2023-11-06Silence redundant error on typo resulting on binopEsteban Küber-18/+15
2023-11-06Visit patterns in THIR let expressionsMatthew Jasper-29/+64
This fixes some THIR unsafety checking errors not being emitted for let expressions in these situations.
2023-11-06Add suggestion to THIR unsafe_op_in_unsafe_fn lintMatthew Jasper-30/+246
2023-11-06Recognise thread local statics in THIR unsafeckMatthew Jasper-5/+52
2023-11-06add test for trivial bound not holding in `soa-derive`Rémy Rakic-0/+8
2023-11-06Rollup merge of #117615 - bjorn3:misc_changes, r=davidtwcoMatthias Krüger-11/+11
Couple of small changes These are unrelated to each other, but they are each small enough that opening separate PR's doesn't make sense to me either. * Remove a place where the parse driver query is stolen. * Update an outdated doc comment * Use correct crate name in `-Zprint-vtable-sizes` when using `#![crate_name = "..."]`.
2023-11-06warn when using an unstable feature with -Ctarget-featureRalf Jung-2/+14
2023-11-06Auto merge of #117585 - dnbln:feat/move-kw-span, r=cjgillotbors-1/+1
Add the `Span` of the `move` keyword to the HIR. This is required to implement a lint like the one described here: https://github.com/rust-lang/rust-clippy/issues/11721