Commit Graph

40 Commits

Author SHA1 Message Date
Deadbeef 4fec845c3f Remove constness from TraitPredicate 2023-08-02 15:38:00 +00:00
Deadbeef df3f9fdf5a Effects: don't print host param in diagnostics 2023-07-29 14:55:35 +00:00
Deadbeef 2d59451274 update tests, adding known-bug 2023-07-27 15:51:02 +00:00
Deadbeef 0d9c871736 add proc macro test 2023-07-23 10:09:43 +00:00
Deadbeef df9bd80d74 reimplement C string literals 2023-07-23 06:54:07 +00:00
bors 1c44af9b79 Auto merge of #111836 - calebzulawski:target-feature-closure, r=workingjubilee
Fix #[inline(always)] on closures with target feature 1.1

Fixes #108655.  I think this is the most obvious solution that isn't overly complicated.  The comment includes more justification, but I think this is likely better than demoting the `#[inline(always)]` to `#[inline]`, since existing code is unaffected.
2023-07-23 00:16:03 +00:00
Dylan DPC dbb6b1ac31 Rollup merge of #113754 - cjgillot:simplify-foreign, r=petrochenkov
Simplify native_libs query

Drive-by cleanup I saw while implementing https://github.com/rust-lang/rust/pull/113734
2023-07-19 22:37:07 +05:30
bors 77e24f90f5 Auto merge of #112591 - jfgoog:better-dlltool-diagnostics, r=WaffleLapkin
Better diagnostics for dlltool errors.

When dlltool fails, show the full command that was executed. In particular, llvm-dlltool is not very helpful, printing a generic usage message rather than what actually went wrong, so stdout and stderr aren't of much use when troubleshooting.
2023-07-19 07:27:50 +00:00
Camille GILLOT 09743b9ebf Bless ui tests. 2023-07-18 18:15:45 +00:00
James Farrell c59b82353d Better diagnostics for dlltool errors.
When dlltool fails, show the full command that was executed. In
particular, llvm-dlltool is not very helpful, printing a generic usage
message rather than what actually went wrong, so stdout and stderr
aren't of much use when troubleshooting.
2023-07-17 20:20:01 +00:00
bors da1d099f91 Auto merge of #112945 - compiler-errors:tighten-span-of-adjustment-error, r=oli-obk
(re-)tighten sourceinfo span of adjustments in MIR

Diagnostics rely on the spans of MIR statements being (approximately) correct in order to give suggestions relative to that span (i.e. `shrink_to_hi` and `shrink_to_lo`).

I discovered that we're *intentionally* lowering THIR exprs with their parent expr's span if they come from adjustments that are due to a parent expression. While I understand why that may be desirable to demonstrate the relationship of an adjustment and the expression that requires it, it leads to

1. very verbose borrowck output
2. incorrect spans for suggestions

Some diagnostics get around that by giving suggestions relative to other spans we've collected during MIR lowering, such as the span of the method's identifier (e.g. `name` in `.name()`), but this doesn't work too well when things come from desugaring.

I assume it also has lead to numerous tweaks and complications to diagnostics code down the road, which this PR doesn't necessarily aim to fix but may open the gates to fixing later... The last three commits are simplifications due to the fact that we can assume that the move span actually points to what is being moved (and a test).

This regressed in #89110, which was debated somewhat in #90286. cc `@Aaron1011` who originally made this change.

r? diagnostics

Fixes #113547
Fixes #111016
2023-07-12 12:11:09 +00:00
Michael Goulet fe870424a7 Do not set up wrong span for adjustments 2023-07-10 20:09:26 +00:00
Santiago Pastorino 20429af7a3 Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
fee1-dead 1830b80c2d Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler-errors
Revert the lexing of `c"…"` string literals

Fixes \[after beta-backport\] #113235.
Further progress is tracked in #113333.

This PR *manually* reverts parts of #108801 (since a git-revert would've been too coarse-grained & messy)
and git-reverts #111647.

CC `@fee1-dead` (#108801) `@klensy` (#111647)
r? `@compiler-errors`

`@rustbot` label F-c_str_literals beta-nominated
2023-07-06 09:20:33 +08:00
León Orell Valerian Liehr 22fd6a6abf Add regression test 2023-07-05 13:45:12 +02:00
León Orell Valerian Liehr c6643b50ea Revert the lexing of c_str_literals 2023-07-05 13:11:17 +02:00
Deadbeef 30b21b758a add test 2023-07-04 11:47:46 +00:00
bors 6fc0273b5a Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnr
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly

Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code.

Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above.

The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits:
https://github.com/rust-lang/rust/blob/2f896da247e0ee8f0bef7cd7c54cfbea255b9f68/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L61-L132

However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well.

r? `@lcnr`
2023-06-20 08:42:37 +00:00
Michael Goulet ca68cf0d46 Merge attrs, better validation 2023-06-20 04:38:55 +00:00
Deadbeef 89c24af133 Better error for non const PartialEq call generated by match 2023-06-18 05:24:38 +00:00
许杰友 Jieyou Xu (Joe) edafbaffb2 Adjust UI tests for unit_bindings
- Either explicitly annotate `let x: () = expr;` where `x` has unit
  type, or remove the unit binding to leave only `expr;` instead.
- Fix disjoint-capture-in-same-closure test
2023-06-12 20:24:48 +08:00
Maybe Waffle 9d3482c403 Better group RFC ui tests together 2023-06-05 16:09:46 +00:00
Caleb Zulawski ddb16e2884 Fix #[inline(always)] on closures with target feature 1.1 2023-05-22 00:13:40 -04:00
Deadbeef 6d905a8cc1 fix tidy 2023-05-02 10:32:08 +00:00
Deadbeef abb181dfd9 make it semantic error 2023-05-02 10:32:08 +00:00
Deadbeef bf3ca5979e try gating early, add non-ascii test 2023-05-02 10:32:08 +00:00
Deadbeef a49570fd20 fix TODO comments 2023-05-02 10:32:07 +00:00
Deadbeef 76d1f93896 update and add a few tests 2023-05-02 10:30:09 +00:00
Léo Lanteri Thauvin 963305bda8 Forbid the use of #[target_feature] on start 2023-03-12 14:57:38 +01:00
Léo Lanteri Thauvin db26693982 Forbid the use of #[target_feature] on main 2023-03-12 14:57:38 +01:00
Léo Lanteri Thauvin ad2bcb5c0e Forbid #[target_feature] on safe default implementations 2023-03-10 13:50:51 +01:00
Léo Lanteri Thauvin bfe5189904 Revert "Stabilize #![feature(target_feature_11)]"
This reverts commit b379d216ee.
2023-03-02 13:41:17 +01:00
Léo Lanteri Thauvin b379d216ee Stabilize #![feature(target_feature_11)] 2023-02-01 08:53:02 +01:00
Esteban Küber d86835769c Make structured suggestion for fn casting verbose 2023-01-30 21:55:25 +00:00
Esteban Küber 5ae8e23816 Mention fn coercion rules (needs to be expanded) 2023-01-30 21:51:33 +00:00
Esteban Küber 62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Matthias Krüger 9e3f330656 Rollup merge of #106897 - estebank:issue-99430, r=davidtwco
Tweak E0597

CC #99430
2023-01-25 22:19:52 +01:00
Matthew J Perez 1e22280f23 Add suggestions for function pointers
- On compiler-error's suggestion of moving this lower down the stack,
along the path of `report_mismatched_types()`, which is used
by `rustc_hir_analysis` and `rustc_hir_typeck`.
- update ui tests, add test
- add suggestions for references to fn pointers
- modify `TypeErrCtxt::same_type_modulo_infer` to take `T: relate::Relate` instead of `Ty`
2023-01-24 14:02:56 -05:00
Esteban Küber 656db98bd9 Tweak E0597
CC #99430
2023-01-15 19:46:20 +00:00
Albert Larsan cf2dff2b1e Move /src/test to /tests 2023-01-11 09:32:08 +00:00