about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-06-24rustdoc: get rid of extra line when line-wrapping fn decls with empty arg listLeón Orell Valerian Liehr-0/+14
2023-06-23Rollup merge of #112983 - spastorino:new-rpitit-23, r=compiler-errorsMichael Goulet-8/+96
Fix return type notation associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty This avoid suggesting the associated types generated for RPITITs when the one the code refers to doesn't exist and rustc looks for a suggestion. r? `@compiler-errors`
2023-06-23Rollup merge of #112981 - spastorino:new-rpitit-22, r=compiler-errorsMichael Goulet-24/+286
Fix return type notation errors with -Zlower-impl-trait-in-trait-to-assoc-ty This just adjust the way we check for RPITITs and uses the new helper method to do the "old" and "new" check at once. r? `@compiler-errors`
2023-06-23Rollup merge of #112973 - compiler-errors:oops-forgot-ftl, r=jyn514Michael Goulet-0/+12
Make sure to include default en-US ftl resources for `rustc_error` crate Fixes #112928
2023-06-23Rollup merge of #112965 - compiler-errors:circular-wf, r=aliemjayMichael Goulet-3/+17
Don't emit same goal as input during `wf::unnormalized_obligations` r? `@aliemjay` cc `@lcnr` I accidentally pruned the logic to handle `WF(?0)` when writing `wf::unnormalized_obligations`. idk if you wanted to construct a test first, but this is an obvious fix. Copied the comment from above. Fixes rust-lang/trait-system-refactor-initiative#36
2023-06-23Rollup merge of #111087 - ibraheemdev:patch-15, r=dtolnayMichael Goulet-79/+59
Implement `Sync` for `mpsc::Sender` `mpsc::Sender` is currently `!Sync` because the previous implementation contained an optimization where the channel started out as single-producer and was dynamically upgraded on the first clone, which relied on a unique reference to the sender. This optimization is one of the main reasons the old implementation was so complex and was removed in #93563. `mpsc::Sender` can now soundly implement `Sync`. Note for any potential confusion, this chance does *not* add MPMC behavior. This only affects the already `Send + Clone` *sender*, not *receiver*. It's technically possible to rely on the `!Sync` behavior in the same way as a `PhantomData<*mut T>`, but that seems very unlikely in practice. Either way, this change is insta-stable and needs an FCP. `@rustbot` label +T-libs-api -T-libs
2023-06-23Auto merge of #112891 - oli-obk:impl_trait_in_assoc_tys_cleanup, ↵bors-45/+254
r=compiler-errors Various impl trait in assoc tys cleanups r? `@compiler-errors` All commits except for the last are pure refactorings. 274dab5bd658c97886a8987340bf50ae57900c39 allows struct fields to participate in deciding whether a function has an opaque in its signature. best reviewed commit by commit
2023-06-23Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-8/+96
2023-06-23Auto merge of #112974 - matthiaskrgr:rollup-hnk7ans, r=matthiaskrgrbors-28/+168
Rollup of 8 pull requests Successful merges: - #112616 (Improve tests on targets without unwinding) - #112643 (Always register sized obligation for argument) - #112740 (Add link to rustdoc book search chapter in help popover) - #112810 (Don't ICE on unnormalized struct tail in layout computation) - #112870 (Migrate `item_bounds` to `ty::Clause`) - #112925 (Stop hiding const eval limit in external macros) - #112960 ([tests/rustdoc] Add `@files` command) - #112962 (Fix rustdoc gui tester) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-23Fix return type notation errors with -Zlower-impl-trait-in-trait-to-assoc-tySantiago Pastorino-24/+286
2023-06-23Rollup merge of #112962 - GuillaumeGomez:fix-rustdoc-gui-tester, r=ozkanonurMatthias Krüger-1/+4
Fix rustdoc gui tester Problem was that the `main` was always exiting with `0`, whether or not there was an error. It led to failing GUI tests being ignored in the CI since no one saw them. r? ````@klensy````
2023-06-23Rollup merge of #112960 - GuillaumeGomez:rustdoc-files-check, r=notriddleMatthias Krüger-0/+17
[tests/rustdoc] Add @files command The ``````@!has`````` checks is very problematic as it wouldn't catch if the file scheme is updated and the file is generated again. ``````@files`````` allows to ensure that the given folder contains exactly the provided entries (files and folders). I'm wondering if we should forbid the ``````@!has`````` for files. To be discussed after this PR I suppose. r? `````@notriddle`````
2023-06-23Rollup merge of #112925 - oli-obk:timeout_lint, r=cjgillotMatthias Krüger-0/+40
Stop hiding const eval limit in external macros fixes #112748 We don't emit a hard error if there was a previous deny lint triggering with the same message. If that lint ends up not being emitted, we ICE and don't emit an error either.
2023-06-23Rollup merge of #112810 - compiler-errors:dont-ice-on-bad-layout, r=wesleywiserMatthias Krüger-4/+45
Don't ICE on unnormalized struct tail in layout computation 1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error. 2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path. Fixes #112736
2023-06-23Rollup merge of #112740 - GuillaumeGomez:link-to-search-chapter, r=notriddleMatthias Krüger-2/+2
Add link to rustdoc book search chapter in help popover One thing that was missing in the rustdoc output and its help popover was a link back to the search feature chapter in the rustdoc book. It looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/425413e5-e734-4d40-b675-8b2dcef874a2) r? `@notriddle`
2023-06-23Rollup merge of #112643 - compiler-errors:sized-obl-for-arg, r=wesleywiserMatthias Krüger-18/+56
Always register sized obligation for argument Removes a "hack" that skips registering sized obligations for parameters that are simple identifiers. This doesn't seem to affect diagnostics because we're probably already being smart enough about deduplicating identical error messages anyways. Fixes #112608
2023-06-23Rollup merge of #112616 - ferrocene:pa-more-test-suite-fixes, r=NilstriebMatthias Krüger-3/+4
Improve tests on targets without unwinding This PR makes more miscellaneous changes to tests, to make it work on targets without unwinding support.
2023-06-23Fix GUI test for popoverGuillaume Gomez-2/+2
2023-06-23Make sure to include default en-US ftl resources for rustc_error crateMichael Goulet-0/+12
2023-06-23Auto merge of #109982 - durin42:plt-no-x86_64-only, r=nikicbors-18/+18
rustc_session: default to -Z plt=yes on non-x86_64 Per the discussion in #106380 plt=no isn't a great default, and rust-lang/compiler-team#581 decided that the default should be PLT=yes for everything except x86_64. Not everyone agrees about the x86_64 part of this change, but this at least is an improvement in the state of things without changing the x86_64 situation, so I've attempted making this change in the name of not letting the perfect be the enemy of the good. Please let me know if I've messed this up somehow - I'm not wholly confident I got this right. r? `@nikic`
2023-06-23Resolve vars when reporting WF errorMichael Goulet-6/+6
2023-06-23Don't emit same goal as input during wf obligationsMichael Goulet-1/+15
2023-06-23Fix failing rustdoc GUI testGuillaume Gomez-1/+4
2023-06-23tests: be even more permissive on attributes in one testAugie Fackler-17/+17
2023-06-23Add @files checks in rustdoc testsGuillaume Gomez-0/+17
2023-06-23Rollup merge of #112948 - bkrl:trait-impl-suggestion, r=compiler-errorsMatthias Krüger-4/+4
Avoid guessing unknown trait implementation in suggestions When a trait is used without specifying the implementation (e.g. calling a non-member associated function without fully-qualified syntax) and there are multiple implementations available, use a placeholder comment for the implementation type in the suggestion instead of picking a random implementation. Example: ``` fn main() { let _ = Default::default(); } ``` Previous output: ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> test.rs:2:13 | 2 | let _ = Default::default(); | ^^^^^^^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation (273 found) | 2 | let _ = <FileTimes as Default>::default(); | +++++++++++++ + ``` New output: ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> test.rs:2:13 | 2 | let _ = Default::default(); | ^^^^^^^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation (273 found) | 2 | let _ = </* self type */ as Default>::default(); | +++++++++++++++++++ + ``` Fixes #112897
2023-06-23Rollup merge of #112941 - tshepang:patch-1, r=lqdMatthias Krüger-1/+1
typo
2023-06-23Rollup merge of #112927 - GuillaumeGomez:where-clause-indent, r=notriddleMatthias Krüger-1/+20
Fix indentation for where clause in rustdoc pages Screenshot of the bug: ![image](https://github.com/rust-lang/rust/assets/3050060/090cfeaa-0edc-46c7-9ea0-e26ac865b2c2) I used this opportunity to clarify the code a bit because some weird things were going on. r? ````@notriddle````
2023-06-22Avoid guessing unknown trait impl in suggestionsAlexander Zhang-4/+4
When a trait is used without specifying the implementation (e.g. calling a non-member associated function without fully-qualified syntax) and there are multiple implementations available, use a placeholder comment for the implementation type in the suggestion instead of picking a random implementation. Example: ``` fn main() { let _ = Default::default(); } ``` Previous output: ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> test.rs:2:13 | 2 | let _ = Default::default(); | ^^^^^^^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation (273 found) | 2 | let _ = <FileTimes as Default>::default(); | +++++++++++++ + ``` New output: ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> test.rs:2:13 | 2 | let _ = Default::default(); | ^^^^^^^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation (273 found) | 2 | let _ = </* self type */ as Default>::default(); | +++++++++++++++++++ + ```
2023-06-22Don't structurally resolve during method ambiguity in probeMichael Goulet-0/+57
2023-06-22tests: be more permissive on attributes in one testAugie Fackler-1/+1
2023-06-22typoTshepang Mbambo-1/+1
2023-06-22Auto merge of #112686 - estebank:sealed-traits, r=petrochenkovbors-26/+211
Account for sealed traits in privacy and trait bound errors On trait bound errors caused by super-traits, identify if the super-trait is publicly accessibly and if not, explain "sealed traits". ``` error[E0277]: the trait bound `S: Hidden` is not satisfied --> $DIR/sealed-trait-local.rs:17:20 | LL | impl a::Sealed for S {} | ^ the trait `Hidden` is not implemented for `S` | note: required by a bound in `Sealed` --> $DIR/sealed-trait-local.rs:3:23 | LL | pub trait Sealed: self::b::Hidden { | ^^^^^^^^^^^^^^^ required by this bound in `Sealed` = note: `Sealed` is a "sealed trait", because to implement it you also need to implelement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it ``` Deduplicate privacy errors that point to the same path segment even if their deduplication span are different. When encountering a path that is not reachable due to privacy constraints path segments other than the last, keep metadata for the last path segment's `Res` in order to look for alternative import paths for that item to suggest. If there are none, be explicit that the item is not accessible. ``` error[E0603]: module `b` is private --> $DIR/re-exported-trait.rs:11:9 | LL | impl a::b::Trait for S {} | ^ private module | note: the module `b` is defined here --> $DIR/re-exported-trait.rs:5:5 | LL | mod b { | ^^^^^ help: consider importing this trait through its public re-export instead | LL | impl a::Trait for S {} | ~~~~~~~~ ``` ``` error[E0603]: module `b` is private --> $DIR/private-trait.rs:8:9 | LL | impl a::b::Hidden for S {} | ^ ------ trait `b` is not publicly reachable | | | private module | note: the module `b` is defined here --> $DIR/private-trait.rs:2:5 | LL | mod b { | ^^^^^ ```
2023-06-22Tweak privacy errors to account for reachable itemsEsteban Küber-26/+176
Suggest publicly accessible paths for items in private mod: When encountering a path in non-import situations that are not reachable due to privacy constraints, search for any public re-exports that the user could use instead. Track whether an import suggestion is offering a re-export. When encountering a path with private segments, mention if the item at the final path segment is not publicly accessible at all. Add item visibility metadata to privacy errors from imports: On unreachable imports, record the item that was being imported in order to suggest publicly available re-exports or to be explicit that the item is not available publicly from any path. In order to allow this, we add a mode to `resolve_path` that will not add new privacy errors, nor return early if it encounters one. This way we can get the `Res` corresponding to the final item in the import, which is used in the privacy error machinery.
2023-06-22Account for sealed traits in trait bound errorsEsteban Küber-0/+35
When implementing a public trait with a private super-trait, we now emit a note that the missing bound is not going to be able to be satisfied, and we explain the concept of a sealed trait.
2023-06-22Only walk the identity substituted version of struct fieldsOli Scherer-0/+104
2023-06-22Handle weak type aliases by immediately resolving them to their aliased typeOli Scherer-10/+0
2023-06-22Re-use error code for duplicate errorOli Scherer-2/+4
2023-06-22Update existing snapshot and add more snapshots of where clause indentationGuillaume Gomez-1/+20
2023-06-22Fix a codegen testOli Scherer-1/+13
2023-06-22Treat opaque types failing the signature defining scope check as defining, ↵Oli Scherer-63/+3
as we already errored and can hide subsequent errors this way.
2023-06-22Stop failing eagerly, and collect all opaque types even if some are erroneous.Oli Scherer-19/+1
2023-06-22Add tests showcasing our short circuiting behaviour in the signature checks ↵Oli Scherer-0/+129
for defining scopes
2023-06-22Point to argument/return type instead of the whole function headerOli Scherer-18/+68
2023-06-22Stop hiding const eval limit in external macrosOli Scherer-0/+40
2023-06-22Rollup merge of #112908 - spastorino:add-def-id-to-early-bound-region-debug, ↵Matthias Krüger-2/+2
r=compiler-errors Print def_id on EarlyBoundRegion debug It's not the first time that I can't make sense out of the default debug print on `EarlyBoundRegion`. As I was working on #112682 I needed this. I was doing some git archeology and found that we used to print everything https://github.com/spastorino/rust/blob/dfbc9608ce5c9655a36b63f6cc9694f5e4ad9890/src/librustc/util/ppaux.rs#L425-L430 but we lost the ability in some refactor midway.
2023-06-22Rollup merge of #112906 - ↵Matthias Krüger-2/+2
fmease:rustdoc-render-assoc-ty-body-before-where-clause, r=notriddle rustdoc: render the body of associated types before the where-clause Fixes #112903.
2023-06-22Rollup merge of #112876 - ↵Matthias Krüger-0/+103
compiler-errors:check-subst-compat-in-OpaqueTypeCollector, r=oli-obk Don't substitute a GAT that has mismatched generics in `OpaqueTypeCollector` Fixes #111828 I didn't put up minimized UI tests for #112510 or #112873 because they'd minimize to literally the same code, but with different substs on the trait/impl. I don't think that warrants duplicate tests given the nature of the fix. r? `@oli-obk` ---- Side-note: I checked, and this isn't fixed by #112652 -- I think we discussed whether or not that PR fixed it either intentionally or by accident. The code here isn't really touched by that PR either as far as I can tell? Also, sorry, did some other drive-bys. Hope it doesn't make rebasing #112652 too difficult :sweat_smile:
2023-06-21Print def_id on EarlyBoundRegion debugSantiago Pastorino-2/+2
2023-06-21rustdoc: render the assoc ty body before the where-clauseLeón Orell Valerian Liehr-2/+2