Commit Graph

1768 Commits

Author SHA1 Message Date
Oli Scherer
ae80c764d4 Add an always-ambiguous predicate to make sure that we don't accidentlally allow trait resolution to prove false things during coherence 2022-11-21 16:35:04 +00:00
Oli Scherer
94fe30ff2f Treat different opaque types of the same def id as equal during coherence 2022-11-21 16:06:07 +00:00
Oli Scherer
2752e328c9 Allow opaque types in trait impl headers and rely on coherence to reject unsound cases 2022-11-21 16:00:31 +00:00
bors
e07425d55b Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors
Minimal implementation of implicit deref patterns for Strings

cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121

~~I forgot to add a feature gate, will do so in a minute~~ Done
2022-11-20 07:16:42 +00:00
Matthias Krüger
c571b2a964
Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead
Improve spans for RPITIT object-safety errors

No reason why we can't point at the `impl Trait` that causes the object-safety violation.

Also [drive-by: Add is_async fn to hir::IsAsync](c4165f3a96), which touches clippy too.
2022-11-19 15:35:23 +01:00
Matthias Krüger
06707c073d
Rollup merge of #104469 - estebank:long-types, r=oli-obk
Make "long type" printing type aware and trim types in E0275

Instead of simple string cutting, use a custom printer to hide parts of long printed types.

On E0275, check for type length before printing.
2022-11-19 15:35:21 +01:00
bors
5e6de2369c Auto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obk
Revert "Normalize opaques with escaping bound vars"

This caused a perf regression in #103423, cc `@skyzh` this should fix #103423.

reverts #100980

r? `@oli-obk`
2022-11-19 09:30:35 +00:00
Dylan DPC
7f35493e99
Rollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnr
Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less

there are only like 3 or 4 call sites left after this but it wasnt obvious to me how to remove them
2022-11-19 11:54:45 +05:30
Dylan DPC
00876c68c4
Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors
nll: correctly deal with bivariance

fixes #104409

when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions.

r? types cc ``@RalfJung``
2022-11-19 11:54:44 +05:30
Michael Goulet
9a9d0f40b8 Improve spans for RPITIT object-safety errors 2022-11-19 02:34:37 +00:00
bors
ff0ffda6b3 Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`)
 - #103378 (Fix mod_inv termination for the last iteration)
 - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS)
 - #103701 (Simplify some pointer method implementations)
 - #104047 (Diagnostics `icu4x` based list formatting.)
 - #104338 (Enforce that `dyn*` coercions are actually pointer-sized)
 - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`)
 - #104556 (rustdoc: use `code-header` class to format enum variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-18 23:20:53 +00:00
Michael Goulet
39e076a2e7 Only enforce ABI-mandated align, not preferred align is compatible 2022-11-18 18:23:48 +00:00
Michael Goulet
b3da04aa52 Check both align and size in PointerSized 2022-11-18 18:23:48 +00:00
Michael Goulet
da3c5397a6 Enforce that dyn* casts are actually pointer-sized 2022-11-18 18:23:48 +00:00
Michael Goulet
b8a92c1dd6 Revert "Normalize opaques with escaping bound vars"
This reverts commit 43119d6438.
2022-11-18 17:40:14 +00:00
Esteban Küber
bcb2655a9a review comment 2022-11-18 08:46:48 -08:00
Esteban Küber
4ed1376490 On E0275 do not print out the full type in the msg
When printing requirement overflow errors, do not print out the full
type name when it is longer than 50 characters long.
2022-11-18 08:46:47 -08:00
Esteban Küber
787e633d1a On overflow errors, do not print out long types 2022-11-18 08:46:47 -08:00
Boxy
9ed348376f require an ErrorGuaranteed to taint infcx with errors 2022-11-18 13:25:17 +00:00
Boxy
1c48039a87 rename is_tainted_by_errors 2022-11-18 13:25:17 +00:00
Boxy
9c510048fd InferCtxt::is_tainted_by_errors returns ErrorGuaranteed 2022-11-18 13:25:17 +00:00
Matthias Krüger
741f3cf383
Rollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholk
Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting)

This makes sure we don't accidentally allow coercions like `Box<T>` -> `Box<dyn* Trait>`, or in the case of this ICE, `&T` to `&dyn* Trait`. These coercions don't make sense, at least not via the `CoerceUnsized` trait.

Fixes #102172
Fixes #102429
2022-11-18 14:13:35 +01:00
Deadbeef
64a17a09a8 Rm diagnostic item, use lang item 2022-11-18 06:16:20 +00:00
Matthias Krüger
ed97f245f1
Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors
Convert predicates into Predicate in the Obligation constructor

instead of having almost all callers do that.

This reduces a bit of boilerplate, and also paves the way for my work towards https://github.com/rust-lang/compiler-team/issues/531 (as it makes it easier to accept both goals and clauses where right now it only accepts predicates).
2022-11-17 22:33:19 +01:00
bors
7c75fe4c85 Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
Record `LocalDefId` in HIR nodes instead of a side table

This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR.
This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed.

This first part adds the information to HIR nodes themselves instead of a table.
The second part is https://github.com/rust-lang/rust/pull/103902
The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter.
The fourth part will be to completely remove the side table.
2022-11-17 07:42:27 +00:00
Oli Scherer
4f11f3b257 Convert predicates into Predicate in the Obligation constructor 2022-11-16 09:25:19 +00:00
Ralf Jung
1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
lcnr
b2e6d08e3f use ocx type relation routines 2022-11-15 14:13:47 +01:00
Matthias Krüger
a9b92151b0
Rollup merge of #104316 - cjgillot:simplify-async-suggestion, r=estebank
Simplify suggestions for errors in generators.

Split from https://github.com/rust-lang/rust/pull/101692/
2022-11-15 10:44:11 +01:00
bors
ca92d90b59 Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-15 06:43:28 +00:00
Matthias Krüger
abda584a5a
Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco
Don't print full paths in overlap errors

We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message.

r? diagnostics
2022-11-14 19:26:16 +01:00
mejrs
25acee5494 Remove dead NoneError error handling 2022-11-13 22:48:27 +01:00
Camille GILLOT
18482f7b23 Store a LocalDefId in hir::GenericParam. 2022-11-13 14:05:30 +00:00
Camille GILLOT
3a05db66e2 Simplify suggestions for errors in generators. 2022-11-12 12:10:33 +00:00
Dylan DPC
662df1ec86
Rollup merge of #104206 - compiler-errors:ocx-more-2, r=lcnr
Remove `save_and_restore_in_snapshot_flag`, use `ObligationCtxt` more

r? ```@lcnr```
2022-11-12 12:02:52 +05:30
Dylan DPC
fcbe990093
Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebank
Unhide unknown spans

r? ```@estebank```
2022-11-12 12:02:51 +05:30
Oli Scherer
21ce58732b Don't add message that will never be shown to users
It will still be used in json, as seen by the ui test changes
2022-11-11 14:45:28 +00:00
Michael Goulet
4f978dbaf9 Unbreak upcasting 2022-11-10 23:49:42 +00:00
Michael Goulet
6e6c49e7ce Don't CoerceUnsized dyn* to dyn* 2022-11-10 23:36:20 +00:00
Michael Goulet
0af211af67 Don't allow implement CoerceUnsized into dyn-star 2022-11-10 23:25:43 +00:00
Michael Goulet
fea8d0eb99 More nits 2022-11-10 21:29:20 +00:00
lcnr
0f2e45b18f make Sized coinductive 2022-11-10 21:18:06 +00:00
Manish Goregaokar
9c0e783f6d
Rollup merge of #103863 - compiler-errors:fulfillcx-less, r=wesleywiser
Use `TraitEngine` in more places, restrict visibility of `FulfillmentCtxt` constructor

Most places that are constructing a `FulfillmentContext` should be constructing a `TraitEngine` generically, so later on if/when we're transitioning it'll be easier.

Logical extension of #99746
2022-11-10 10:47:37 -05:00
Michael Goulet
e5ecf629dd
Rollup merge of #102763 - compiler-errors:nits, r=cjgillot
Some diagnostic-related nits

1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>`
2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller.

idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-09 21:53:34 -08:00
Michael Goulet
f902b495ba Don't print full paths in overlap errors 2022-11-10 05:41:09 +00:00
Michael Goulet
ed17c6b1c3 Use TraitEngine in more places, make FulfillmentCtxt constructor more private 2022-11-10 04:26:43 +00:00
Michael Goulet
ed6a7cc228 Remove save_and_restore_in_snapshot_flag 2022-11-09 22:58:39 +00:00
Manish Goregaokar
a709cc1f32
Rollup merge of #104156 - oli-obk:autoderef, r=estebank
Cleanups in autoderef impl

Just something I noticed. Turns out the `overloaded_span` is not actually used separately from the main span, so I merged them.
2022-11-09 15:39:06 -05:00
Michael Goulet
e807cb3c41 Make span_suggestions take IntoIterator 2022-11-09 19:42:23 +00:00
bors
cc9b259b5e Auto merge of #103723 - CastilloDel:master, r=jackh726
Remove allow(rustc::potential_query_instability) in rustc_trait_selection

Related to https://github.com/rust-lang/rust/issues/84447

This PR needs to be benchmarked to check for regressions.
2022-11-09 13:45:27 +00:00