Nicholas Nethercote
431cce1540
Restrict From<S>
for {D,Subd}iagnosticMessage
.
...
Currently a `{D,Subd}iagnosticMessage` can be created from any type that
impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static,
str>`, which are reasonable. It also includes `&String`, which is pretty
weird, and results in many places making unnecessary allocations for
patterns like this:
```
self.fatal(&format!(...))
```
This creates a string with `format!`, takes a reference, passes the
reference to `fatal`, which does an `into()`, which clones the
reference, doing a second allocation. Two allocations for a single
string, bleh.
This commit changes the `From` impls so that you can only create a
`{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static,
str>`. This requires changing all the places that currently create one
from a `&String`. Most of these are of the `&format!(...)` form
described above; each one removes an unnecessary static `&`, plus an
allocation when executed. There are also a few places where the existing
use of `&String` was more reasonable; these now just use `clone()` at
the call site.
As well as making the code nicer and more efficient, this is a step
towards possibly using `Cow<'static, str>` in
`{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing
the `From<&'a str>` impls to `From<&'static str>`, which is doable, but
I'm not yet sure if it's worthwhile.
2023-05-03 08:44:39 +10:00
Kyle Matsuda
097309c10f
add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query
2023-04-20 12:36:50 -06:00
Kyle Matsuda
afa28e6304
change usages of explicit_item_bounds to bound_explicit_item_bounds
2023-04-20 12:36:50 -06:00
lcnr
5810f1fe3c
remove some trait solver helpers
...
they add more complexity then they are worth. It's confusing
which of these helpers should be used in which context.
2023-03-21 09:57:20 +01:00
Camille GILLOT
92c4f1e2d9
Take a LocalDefId in hir::Visitor::visit_fn.
2023-01-28 09:51:50 +00:00
Vincenzo Palazzo
2d8ede2335
fix: use LocalDefId instead of HirId in trait res
...
use LocalDefId instead of HirId in trait resolution to simplify
the obligation clause resolution
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-23 11:42:18 +00:00
Oli Scherer
65069d5c5b
Ensure no one constructs AliasTy
s themselves
2022-12-14 15:36:39 +00:00
Michael Goulet
957ab6ae52
Combine projection and opaque into alias
2022-12-13 17:48:55 +00:00
Michael Goulet
89b8840543
squash OpaqueTy and ProjectionTy into AliasTy
2022-12-13 17:40:27 +00:00
Michael Goulet
ad55e4c972
Use ty::OpaqueTy everywhere
2022-12-13 17:29:26 +00:00
Philipp Krones
d05e2865a0
Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup
2022-12-01 18:29:38 +01:00
Santiago Pastorino
3f059a49a4
Introduce PredicateKind::Clause
2022-11-25 00:04:54 -03:00
Cameron Steffen
6819e85501
Change InferCtxtBuilder from enter to build
2022-10-07 07:10:40 -05:00
Cameron Steffen
3b328e7049
Introduce TypeErrCtxt
...
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.
2022-10-07 07:06:16 -05:00
lcnr
70f4c712c5
remove the Subst
trait, always use EarlyBinder
2022-09-19 11:37:27 +02:00
Michael Goulet
ccbc96508a
Add traits::fully_solve_obligation
that acts like traits::fully_normalize
...
It spawns up a trait engine, registers the single obligation, then fully
solves it
2022-08-04 13:50:56 +00:00
Jack Huey
cf8ea64d9d
Introduce EarlyBinder
2022-05-10 22:47:18 -04:00
Deadbeef
adf8c381f2
Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
...
This reverts commit ff2439b7b9
, reversing
changes made to 2a9e0831d6
.
2021-12-12 12:34:46 +08:00
flip1995
8fea1d94f3
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
2021-12-06 12:33:31 +01:00
Santiago Pastorino
23f752f278
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
...
This reverts commit 18bb8c61a9
, reversing
changes made to d9baa36190
.
2021-12-03 10:11:21 -03:00
Deadbeef
99eeb66e0f
Fix tools
2021-11-29 21:19:50 +08:00
Deadbeef
6d23824ef4
Make select_* methods return Vec for TraitEngine
2021-11-08 23:35:23 +08:00
Cameron Steffen
e165c12932
Make diangostic item names consistent
2021-10-02 19:38:19 -05:00
Deadbeef
80bff87c6f
move Constness into TraitPredicate
2021-08-13 09:26:33 +00:00
flip1995
2b20f49841
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
2021-07-29 12:16:06 +02:00
flip1995
6c27482115
Merge commit '3ae8faff4d46ad92f194c2a4b941c3152a701b31' into clippyup
2021-06-03 08:41:37 +02:00
flip1995
9f6b5de7de
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
2021-03-25 19:29:11 +01:00
Camille GILLOT
476c5283d5
Do not store attrs in FnKind.
2021-03-09 19:09:33 +01:00
flip1995
ac912be984
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup
2021-01-30 18:06:34 +01:00
Jack Huey
e73b8dcbca
Review changes
2021-01-16 18:56:37 -05:00
Jonas Schievink
1464dcedfb
Thread Constness
through selection
2020-11-22 02:13:53 +01:00
Matthew Jasper
adb7fc6283
Fix tools
2020-10-06 11:19:30 +01:00
LeSeulArtichaut
28f9b84042
ty.kind
-> ty.kind()
in rustdoc and clippy
2020-09-04 18:27:33 +02:00
Bastian Kauschke
6ce37fab95
introduce PredicateAtom
2020-07-27 21:07:37 +02:00
Bastian Kauschke
88787083f4
this might be unqualified, but at least it's now quantified
2020-07-27 21:06:36 +02:00
Bastian Kauschke
dfa1af2059
clippy
2020-07-27 21:06:36 +02:00
Eduard-Mihai Burtescu
30c046ede4
Use 'tcx for references to AccessLevels wherever possible.
2020-07-03 00:04:48 +03:00
Dylan MacKenzie
ea06c72fdd
Call skip_binder
or no_bound_vars
before self_ty
2020-06-01 12:18:57 -07:00
Bastian Kauschke
091239ee60
introduce newtype'd Predicate<'tcx>
2020-05-20 15:44:34 +02:00
Bastian Kauschke
2722522fac
rename Predicate
to PredicateKind
, introduce alias
2020-05-20 15:38:03 +02:00
Philipp Hansch
502a66de3d
Cleanup: future_not_send: use return_ty
method
2020-04-19 14:00:03 +02:00
Roland Kuhn
d2cbbff217
add lint futures_not_send
2020-04-17 13:54:05 +02:00