about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-05-27Rollup merge of #111954 - asquared31415:unknown_ptr_type_error, ↵Matthias Krüger-2/+57
r=compiler-errors improve error message for calling a method on a raw pointer with an unknown pointee The old error message had very confusing wording. Also added some more test cases besides the single edition test. r? `@compiler-errors`
2023-05-27Rollup merge of #111714 - cjgillot:lint-expect-confusion, r=wesleywiserMatthias Krüger-0/+7
Stop confusing specification levels when computing expectations. Fixes https://github.com/rust-lang/rust/issues/111682
2023-05-26Auto merge of #103291 - ink-feather-org:typeid_no_struct_match, r=dtolnaybors-7/+17
Remove structural match from `TypeId` As per https://github.com/rust-lang/rust/pull/99189#issuecomment-1203720442. > Removing the structural equality might make sense, but is a breaking change that'd require a libs-api FCP. https://github.com/rust-lang/rust/pull/99189#issuecomment-1197545482 > Landing this PR now (well, mainly the "remove structural equality" part) would unblock `const fn` `TypeId::of`, since we only postponed that because we were guaranteeing too much. See also #99189, #101698
2023-05-26improve error message for calling a method on a raw pointer with an unknown ↵asquared31415-2/+57
pointee, and add some tests
2023-05-26Blesses UI tests, add known bug to typeid-equality-by-subtypingonestacked-7/+17
2023-05-26Rollup merge of #111951 - cjgillot:uninh-comment, r=NadrierilMatthias Krüger-76/+177
Correct comment on privately uninhabited pattern. Follow-up to https://github.com/rust-lang/rust/pull/111624#discussion_r1204767933 r? `@Nadrieril`
2023-05-26Rollup merge of #111947 - obeis:issue-111943, r=compiler-errorsMatthias Krüger-0/+38
Add test for RPIT defined with different hidden types with different substs Close #111943
2023-05-26Add test for RPIT defined with different hidden types with different substsObei Sideg-0/+38
2023-05-25Rollup merge of #111945 - GuillaumeGomez:migrate-gui-test-color-7, r=notriddleMichael Goulet-42/+42
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
2023-05-25Rollup merge of #111929 - compiler-errors:no-newline-apit, r=wesleywiserMichael Goulet-0/+44
Don't print newlines in APITs This is kind of a hack, but it gets the job done because the only "special" formatting that (afaict) `rustc_ast_pretty` does is break with newlines sometimes. Fixes rust-lang/measureme#207
2023-05-25Rollup merge of #111831 - clubby789:capture-slice-pat, r=cjgillotMichael Goulet-85/+196
Always capture slice when pattern requires checking the length Fixes #111751 cc ``@zirconium-n,`` I see you were assigned to this but I've fixed some similar issues in the past and had an idea on how to investigate this.
2023-05-25Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholkMichael Goulet-39/+131
Consider lint check attributes on match arms Currently, lint check attributes on match arms have no effect for some lints. This PR makes some lint passes to take those attributes into account. - `LateContextAndPass` for late lint doesn't update `last_node_with_lint_attrs` when it visits match arms. This leads to lint check attributes on match arms taking no effects on late lints that operate on the arms' pattern: ```rust match value { #[deny(non_snake_case)] PAT => {} // `non_snake_case` only warned due to default lint level } ``` To be honest, I'm not sure whether this is intentional or just an oversight. I've dug the implementation history and searched up issues/PRs but couldn't find any discussion on this. - `MatchVisitor` doesn't update its lint level when it visits match arms. This leads to check lint attributes on match arms taking no effect on some lints handled by this visitor, namely: `bindings_with_variant_name` and `irrefutable_let_patterns`. This seems to be a fallout from #108504. Before 05082f57afbf5d2e8fd7fb67719336d78b58e759, when the visitor operated on HIR rather than THIR, check lint attributes for the said lints were effective. [This playground][play] compiles successfully on current stable (1.69) but fails on current beta and nightly. I wasn't sure where best to place the test for this. Let me know if there's a better place. [play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=38432b79e535cb175f8f7d6d236d29c3 [play-match]: https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=629aa71b7c84b269beadeba664e2221d
2023-05-25Rollup merge of #111152 - lukas-code:markdown-parsers-are-hard, r=GuillaumeGomezMichael Goulet-10/+35
update `pulldown-cmark` to `0.9.3` This PR updates `pulldown-cmark` to version `0.9.3`, which does two main things: * Pulls in https://github.com/raphlinus/pulldown-cmark/pull/643 to fix https://github.com/rust-lang/rust/issues/111117 * Allows parsing strikethrough with single tildes, e.g. `~foo~` -> ~foo~. This matches the [GFM spec](https://github.github.com/gfm/#strikethrough-extension-). Full changelog: https://github.com/raphlinus/pulldown-cmark/pull/646
2023-05-25Add NOTE annotations.Camille GILLOT-75/+141
2023-05-25Always capture slice when pattern requires checking the lengthclubby789-85/+196
2023-05-25Add inter-crate test.Camille GILLOT-40/+75
2023-05-25Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelixbors-4/+72
Support #[global_allocator] without the allocator shim This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim. Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist. To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors. (Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
2023-05-25rustdoc: add test for strikethrough with single tildesLukas Markeffsky-9/+10
Also merge the two almost identical strikethrough tests together and document what the test tests.
2023-05-25Migrate GUI colors test to original CSS color formatGuillaume Gomez-42/+42
2023-05-25Auto merge of #111473 - compiler-errors:opaques, r=lcnrbors-27/+69
Handle opaques in the new solver (take 2?) Implement a new strategy for handling opaques in the new solver. First, queries now carry both their defining anchor and the opaques that were defined in the inference context at the time of canonicalization. These are both used to pre-populate the inference context used by the canonical query. Second, use the normalizes-to goal to handle opaque types in the new solver. This means that opaques are handled like projection aliases, but with their own rules: * Can only define opaques if they're "defining uses" (i.e. have unique params in all their substs). * Can only define opaques that are from the anchor. * Opaque type definitions are modulo regions. So that means `Opaque<'?0r> = HiddenTy1` and `Opaque<?'1r> = HiddenTy2` equate `HiddenTy1` and `HiddenTy2` instead of defining them as different opaque type keys.
2023-05-25Rollup merge of #111624 - cjgillot:private-uninhabited-pattern, r=petrochenkovMatthias Krüger-1/+11
Emit diagnostic for privately uninhabited uncovered witnesses. Fixes https://github.com/rust-lang/rust/issues/104034 cc `@Nadrieril`
2023-05-25Strongly prefer alias and param-env boundsMichael Goulet-27/+69
2023-05-25Don't print newlines in APITsMichael Goulet-0/+44
2023-05-25Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearthbors-4/+5
Rollup of 5 pull requests Successful merges: - #111741 (Use `ObligationCtxt` in custom type ops) - #111840 (Expose more information in `get_body_with_borrowck_facts`) - #111876 (Roll compiler_builtins to 0.1.92) - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler ) - #111915 (libtest: Improve error when missing `-Zunstable-options`) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-24Rollup merge of #111915 - jyn514:libtest-errors, r=thomccManish Goregaokar-1/+1
libtest: Improve error when missing `-Zunstable-options` "only accepted on the nightly compiler" is misleading when this *is* nightly.
2023-05-24Rollup merge of #111840 - voidc:borrowck-consumers, r=oli-obkManish Goregaokar-3/+4
Expose more information in `get_body_with_borrowck_facts` Verification tools for Rust such as, for example, Creusot or Prusti would benefit from having access to more information computed by the borrow checker. As a first step in that direction, #86977 added the `get_body_with_borrowck_facts` API, allowing compiler consumers to obtain a `mir::Body` with accompanying borrow checker information. At RustVerify 2023, multiple people working on verification tools expressed their need for a more comprehensive API. While eventually borrow information could be part of Stable MIR, in the meantime, this PR proposes a more limited approach, extending the existing `get_body_with_borrowck_facts` API. In summary, we propose the following changes: - Permit obtaining the borrow-checked body without necessarily running Polonius - Return the `BorrowSet` and the `RegionInferenceContext` in `BodyWithBorrowckFacts` - Provide a way to compute the `borrows_out_of_scope_at_location` map - Make some helper methods public This is similar to #108328 but smaller in scope. `@smoelius` Do you think these changes would also be sufficient for your needs? r? `@oli-obk` cc `@JonasAlaif`
2023-05-24Rollup merge of #111903 - GuillaumeGomez:migrate-gui-test-color-6, r=notriddleMatthias Krüger-6/+6
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-05-24Rollup merge of #111841 - matthewjasper:validate-match-guards, r=compiler-errorsMatthias Krüger-33/+232
Run AST validation on match guards correctly AST validation was being skipped on match guards other than `if let` guards.
2023-05-24Emit diagnostic for privately uninhabited uncovered witnesses.Camille GILLOT-1/+11
2023-05-24libtest: Improve error when missing `-Zunstable-options`jyn-1/+1
"only accepted on the nightly compiler" is misleading when this *is* nightly.
2023-05-24Migrate GUI colors test to original CSS color formatGuillaume Gomez-6/+6
2023-05-24Auto merge of #111195 - GuillaumeGomez:fix-ice-intra-doc-link, r=petrochenkovbors-0/+31
Prevent crash when a path is not resolved in intra-doc link Fixes https://github.com/rust-lang/rust/issues/111189. cc `@petrochenkov` r? `@notriddle`
2023-05-24Rollup merge of #111887 - fmease:inh-proj-pp-tests, r=compiler-errorsMatthias Krüger-0/+46
Add regression tests for pretty-printing inherent projections Tests for #111486. Fixes #111879. r? `@matthiaskrgr`
2023-05-24Rollup merge of #111880 - compiler-errors:pointer-like-param-env, r=jackh726Matthias Krüger-0/+52
Don't ICE when computing PointerLike trait when region vars are in param-env Fixes #111877
2023-05-24Rollup merge of #111864 - Jules-Bertholet:sized-closures, r=compiler-errorsMatthias Krüger-0/+24
Always require closure parameters to be `Sized` The `rust-call` ABI isn't compatible with `#![feature(unsized_fn_params)]`, so trying to use that feature with closures leads to an ICE (#67981). This turns that ICE into a type-check error. `@rustbot` label A-closures F-unsized_fn_params
2023-05-24Rollup merge of #111861 - compiler-errors:rtn-in-super, r=jackh726Matthias Krüger-0/+22
Don't ICE on return-type notation when promoting trait preds to associated type bounds Fixes #111846
2023-05-24Add tests for pretty-printing inherent projectionsLeón Orell Valerian Liehr-0/+46
2023-05-23Auto merge of #111882 - matthiaskrgr:rollup-1xyv5mq, r=matthiaskrgrbors-723/+803
Rollup of 7 pull requests Successful merges: - #111427 ([rustdoc][JSON] Use exclusively externally tagged enums in the JSON representation) - #111486 (Pretty-print inherent projections correctly) - #111722 (Document stack-protector option) - #111761 (fix(resolve): not defined `extern crate shadow_name`) - #111845 (Update books) - #111851 (CFI: Fix encode_region: unexpected ReEarlyBound(0, 'a)) - #111871 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-23Rollup merge of #111871 - GuillaumeGomez:migrate-gui-test-color-5, r=notriddleMatthias Krüger-3/+3
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-05-23Rollup merge of #111851 - rcvalle:rust-cfi-fix-111515, r=bjorn3Matthias Krüger-9/+71
CFI: Fix encode_region: unexpected ReEarlyBound(0, 'a) Fixes #111515 and complements #106547 by adding support for encoding early bound regions and also excluding projections when transforming trait objects' traits into their identities before emitting type checks.
2023-05-23Rollup merge of #111761 - bvanjoi:fix-109148, r=petrochenkovMatthias Krüger-0/+28
fix(resolve): not defined `extern crate shadow_name` Fixes https://github.com/rust-lang/rust/issues/109148 ## Why does #109148 panic? When resolving `use std::xx` it enters `visit_scopes` from `early_resolve_ident_in_lexical_scope`, and iters twice during the loop: |iter| `scope` | `break_result` | result | |-|-|-|-| | 0 | `Module` pointed to root | binding pointed to `Undetermined`, so result is `None` | scope changed to `ExternPrelude` | | 1 | `ExternPrelude` | binding pointed to `std` | - | Then, the result of `maybe_resolve_path` is `Module(std)`, so `import.imported_module.set` is executed. Finally, during the `finalize_import` of `use std::xx`, `resolve_path` returns `NonModule` because `Binding(Ident(std), Module(root)`'s binding points to `extern crate blah as std`, which causes the assertion to fail at `assert!(import.imported_module.get().is_none());`. ## Investigation The question is why `#[a] extern crate blah as std` is not defined as a binding of `std::xxx`, which causes the iteration twice during `visit_scopes` when resolving `std::xxx`. Ideally, the value of `break_result.is_some()` should have been valid in the first iteration. After debugging, I found that because `#[a] extern crate blah as std` had been dummied by `placeholder` during `collect_invocations`, so it had lost its attrs, span, etc..., so it will not be defined. However, `expand_invoc` added them back, then the next `build_reduced_graph`, `#[a] extern crate blah as std` would have been defined, so it makes the result of `resolved_path` unexpected, and the program panics. ## Try to solve I think there has two-way to solve this issue: - Expand invocations before the first `resolve_imports` during `fully_expand_fragment`. However, I do not think this is a good idea because it would mess up the current design. - As my PR described: do not define to `extern crate blah as std` during the second `build_reduced_graph`, which is very easy and more reasonable. r? `@petrochenkov`
2023-05-23Rollup merge of #111427 - LukeMathWalker:flatten, r=aDotInTheVoidMatthias Krüger-711/+701
[rustdoc][JSON] Use exclusively externally tagged enums in the JSON representation See [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.28De.29serialization.20speed.20of.20JSON.20docs) and [this issue](https://github.com/rust-lang/rust/issues/93667) for the relevant context.
2023-05-23Don't ICE when computing PointerLike trait when region vars are in param-envMichael Goulet-0/+52
2023-05-23Always require closure parameters to be `Sized`Jules Bertholet-0/+24
The `rust-call` ABI isn't compatible with `#![feature(unsized_fn_params)]`, so trying to use that feature with closures leads to an ICE (#67981). This turns that ICE into a type-check error.
2023-05-23CFI: Fix encode_region: unexpected ReEarlyBound(0, 'a)Ramon de C Valle-9/+71
Fixes #111515 and complements #106547 by adding support for encoding early bound regions and also excluding projections when transforming trait objects' traits into their identities before emitting type checks.
2023-05-23Auto merge of #107294 - JamieCunliffe:neon-fp, r=Amanieubors-0/+29
Fix some issues with folded AArch64 features In #91608 the `fp` feature was removed for AArch64 and folded into the `neon` feature, however disabling the `neon` feature doesn't actually disable the `fp` feature. If my understanding on that thread is correct it should do. While doing this, I also noticed that disabling some features would disable features that it shouldn't. For instance enabling `sve` will enable `neon`, however, when disabling `sve` it would then also disable `neon`, I wouldn't expect disabling `sve` to also disable `neon`. cc `@workingjubilee`
2023-05-23Add regression test for #111189Guillaume Gomez-0/+31
2023-05-23Migrate GUI colors test to original CSS color formatGuillaume Gomez-3/+3
2023-05-23Auto merge of #111869 - Dylan-DPC:rollup-9pydw08, r=Dylan-DPCbors-235/+404
Rollup of 6 pull requests Successful merges: - #111461 (Fix symbol conflict diagnostic mistakenly being shown instead of missing crate diagnostic) - #111579 (Also assume wrap-around discriminants in `as` MIR building) - #111704 (Remove return type sized check hack from hir typeck) - #111853 (Check opaques for mismatch during writeback) - #111854 (rustdoc: clean up `settings.css`) - #111860 (Don't ICE if method receiver fails to unify with `arbitrary_self_types`) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-23Move BodyWithBorrowckFacts to consumersDominik Stolz-2/+2