Dylan DPC
b727132e23
Rollup merge of #108161 - WaffleLapkin:const_param_ty, r=BoxyUwU
...
Add `ConstParamTy` trait
This is a bit sketch, but idk.
r? `@BoxyUwU`
Yet to be done:
- [x] ~~Figure out if it's okay to implement `StructuralEq` for primitives / possibly remove their special casing~~ (it should be okay, but maybe not in this PR...)
- [ ] Maybe refactor the code a little bit
- [x] Use a macro to make impls a bit nicer
Future work:
- [ ] Actually™ use the trait when checking if a `const` generic type is allowed
- [ ] _Really_ refactor the surrounding code
- [ ] Refactor `marker.rs` into multiple modules for each "theme" of markers
2023-05-02 11:44:50 +05:30
Maybe Waffle
9a716dafbe
Add a ConstParamTy
trait
2023-04-27 15:46:21 +00:00
Boxy
842419712a
rename needs_subst
to has_param
2023-04-27 08:35:19 +01:00
clubby789
0138513635
Fix static string lints
2023-04-25 18:59:55 +01:00
Maybe Waffle
c727edc0b7
Remove some useless ty::Binder::dummy
calls
2023-04-25 16:47:00 +00:00
Maybe Waffle
46b01abbcd
Replace tcx.mk_trait_ref
with ty::TraitRef::new
2023-04-25 16:12:44 +00:00
Maybe Waffle
e496fbec92
Split {Idx, IndexVec, IndexSlice}
into their own modules
2023-04-24 13:53:35 +00:00
Oli Scherer
1ce80e210d
Allow LocalDefId
as the argument to def_path_str
2023-04-21 22:27:20 +00:00
Guillaume Gomez
aa87addfb3
Rollup merge of #110417 - jsoref:spelling-compiler, r=Nilstrieb
...
Spelling compiler
This is per https://github.com/rust-lang/rust/pull/110392#issuecomment-1510193656
I'm going to delay performing a squash because I really don't expect people to be perfectly happy w/ my changes, I really am a human and I really do make mistakes.
r? Nilstrieb
I'm going to be flying this evening, but I should be able to squash / respond to reviews w/in a day or two.
I tried to be careful about dropping changes to `tests`, afaict only two files had changes that were likely related to the changes for a given commit (this is where not having eagerly squashed should have given me an advantage), but, that said, picking things apart can be error prone.
2023-04-18 14:50:51 +02:00
Josh Soref
e09d0d2a29
Spelling - compiler
...
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04:00
Maybe Waffle
9534541dd4
Use Item::expect_*
and ImplItem::expect_*
more
2023-04-17 18:00:27 +00:00
lcnr
a19adefa0e
region error cleanup
...
- require `TypeErrCtxt` to always result in an error
- move `resolve_regions_and_report_errors` to the `ObligationCtxt`
- merge `process_registered_region_obligations` into `resolve_regions`
2023-04-12 10:24:36 +02:00
Nilstrieb
07cd3826e0
Small clippy::correctness fixes
...
Nothing was really incorrect before, but it did get nicer.
2023-04-09 22:39:23 +02:00
Scott McMurray
4abb455529
Update ty::VariantDef
to use IndexVec<FieldIdx, FieldDef>
...
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`.
There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places.
Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-30 09:23:40 -07:00
bors
cf073ec2cb
Auto merge of #109202 - compiler-errors:new-solver-fast-reject-faster-2, r=lcnr
...
Don't pass `TreatProjections` separately to `fast_reject`
Don't pass `TreatProjections` separately to `fast_reject`, and instead use the original approach of switching on two variants of `TreatParams` (undoes this: https://github.com/rust-lang/rust/pull/108830#pullrequestreview-1330371417 ).
Fixes the regression introduced in https://github.com/rust-lang/rust/pull/108830#issuecomment-1468116419
2023-03-23 23:53:56 +00:00
Michael Goulet
fc0cbe8340
Don't split up TreatProjections and TreatParams anymore
2023-03-23 18:57:02 +00:00
Matthias Krüger
acd7f878ae
Rollup merge of #107718 - Zoxc:z-time, r=nnethercote
...
Add `-Z time-passes-format` to allow specifying a JSON output for `-Z time-passes`
This adds back the `-Z time` option as that is useful for [my rustc benchmark tool](https://github.com/Zoxc/rcb ), reverting https://github.com/rust-lang/rust/pull/102725 . It now uses nanoseconds and bytes as the units so it is renamed to `time-precise`.
2023-03-23 19:55:43 +01:00
bors
9bdb4881c7
Auto merge of #109119 - lcnr:trait-system-cleanup, r=compiler-errors
...
a general type system cleanup
removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.
changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR.
also removes some other small - and imo unnecessary - helpers.
r? types
2023-03-22 05:33:18 +00:00
John Kåre Alsaker
b0dc15c61b
Reduce output spam
2023-03-21 18:18:25 +01:00
Michael Goulet
2eb1c08e43
Use local key in providers
2023-03-21 15:38:51 +00:00
lcnr
791ce0b7b5
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
lcnr
d2b7604db9
always make define_opaque_types
explicit
2023-03-15 14:00:15 +01:00
Michael Goulet
84d254ead0
Better names?
2023-03-13 16:34:16 +00:00
Michael Goulet
c32527fb92
Treat projections with infer as placeholder during fast reject in new solver
2023-03-13 16:34:16 +00:00
Michael Goulet
fd34549686
Remove body_def_id from Inherited
2023-03-09 23:25:23 +00:00
Michael Goulet
0f4255ece2
Dedup copy field errors for identical types
2023-03-08 00:00:19 +00:00
Michael Goulet
a439c0293c
may not => cannot
2023-03-08 00:00:18 +00:00
Mu42
2fe288fd29
emit the suspicious_auto_trait_impls for negative impls as well
2023-03-06 20:04:33 +08:00
est31
6df5ae4fb0
Match unmatched backticks in comments in compiler/
2023-03-03 08:39:00 +01:00
bors
0978711950
Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, r=compiler-errors,davidtwco,estebank,oli-obk
...
diagnostics: if AssocFn has self argument, describe as method
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515
This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods >
> Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html ), for example, `x.foo()`, as well as the usual function call notation.
In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-23 00:19:12 +00:00
Alan Egerton
695072daa6
Remove type-traversal trait aliases
2023-02-22 17:04:58 +00:00
Michael Howell
3d056c3125
diagnostics: if AssocFn has self argument, describe as method
...
Discussed in
https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515
This commit also changes the tooltips on rustdoc intra-doc links
targeting methods.
2023-02-22 08:40:33 -07:00
bors
9aa5c24b7d
Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstrieb
...
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref
r? `@ghost`
2023-02-17 17:42:51 +00:00
Kyle Matsuda
c183110cc2
remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata
2023-02-16 17:05:56 -07:00
Kyle Matsuda
d822b97a27
change usages of type_of to bound_type_of
2023-02-16 17:01:52 -07:00
Maybe Waffle
a32d392741
Copy ty::AssocItem
all other the place
2023-02-15 20:22:41 +00:00
Camille GILLOT
065f0b222d
Move query out of path.
2023-02-14 20:27:38 +00:00
Camille GILLOT
40cb4d1bc7
Even less HIR.
2023-02-14 20:27:38 +00:00
Camille GILLOT
2a51e73ac9
Do not fetch HIR for inherent impls.
2023-02-14 19:55:45 +00:00
Camille GILLOT
03dff82d59
Add of_trait
to DefKind::Impl.
2023-02-14 19:55:44 +00:00
Matthias Krüger
5f3d360844
Rollup merge of #107942 - compiler-errors:tighter-inherent-impl-bad-spans, r=Nilstrieb
...
Tighter spans for bad inherent `impl` self types
Self-explanatory
2023-02-13 23:25:12 +01:00
Michael Goulet
e20f6ff1dc
Tighter spans for bad inherent impl types
2023-02-13 18:41:18 +00:00
Alan Egerton
dea342d861
Make visiting traits generic over the Interner
2023-02-13 10:24:49 +00:00
Alan Egerton
ba55a453eb
Alias folding/visiting traits instead of re-export
2023-02-13 10:24:46 +00:00
Edward Shen
af5a37e844
Modify existing bounds if they exist
2023-02-06 11:26:36 -08:00
David Tolnay
4501d3abe1
Autotrait bounds on dyn-safe trait methods
2023-02-03 08:33:40 -08:00
David Tolnay
9e1c600f74
Disallow impl autotrait for trait object
2023-02-03 08:33:40 -08:00
Matthias Krüger
4ac1796267
Rollup merge of #107125 - WaffleLapkin:expect_an_item_in_your_hir_by_the_next_morning, r=Nilstrieb
...
Add and use expect methods to hir.
[The future has come](https://github.com/rust-lang/rust/pull/106090/files#r1070062462 ).
r? `@Nilstrieb`
tbh I'm not even sure if it's worth it
2023-01-30 17:50:08 +01:00
Gary Guo
94e59cb6e2
Rename is_object_safe
to check_is_object_safe
to hint side effects
2023-01-28 15:07:57 +00:00
Camille GILLOT
1974b6b68d
Introduce GeneratorWitnessMIR.
2023-01-27 18:58:44 +00:00
Vincenzo Palazzo
7d2c1103d7
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
bors
94a300b9b8
Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnr
...
Check ADT fields for copy implementations considering regions
Fixes #88901
r? `@ghost`
2023-01-20 21:29:52 +00:00
Maybe Waffle
70f9d52079
Add and use expect methods to hir.
2023-01-20 17:40:50 +00:00
bors
56ee85274e
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
...
Remove some `ref` patterns from the compiler
Previous PR: https://github.com/rust-lang/rust/pull/105368
r? `@Nilstrieb`
2023-01-20 04:52:28 +00:00
Scott McMurray
925dc37313
Stop using BREAK
& CONTINUE
in compiler
...
Switching them to `Break(())` and `Continue(())` instead.
libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17 23:17:51 -08:00
Matthias Krüger
68f12338af
Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
...
Remove double spaces after dots in comments
Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17 20:21:25 +01:00
Maybe Waffle
6a28fb42a8
Remove double spaces after dots in comments
2023-01-17 08:09:33 +00:00
Maybe Waffle
09485eaae1
rustc_hir_analysis
: remove ref
patterns
2023-01-17 07:48:19 +00:00
Maybe Waffle
d60e772e14
rustc_hir_analysis
: some general code improvements
2023-01-17 07:48:19 +00:00
Kyle Matsuda
6e969ea85e
fix various subst_identity vs skip_binder
2023-01-14 00:30:03 -07:00
Kyle Matsuda
f29a334c90
change impl_trait_ref query to return EarlyBinder; remove bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14 00:29:56 -07:00
Kyle Matsuda
be130b57d4
change usages of impl_trait_ref to bound_impl_trait_ref
2023-01-14 00:23:32 -07:00
Michael Goulet
16cfadbfe8
Suggest lifetime bound in illegal Copy impl
2023-01-13 23:06:29 +00:00
Michael Goulet
8cf7f40a89
Check ADT fields for copy implementations considering regions
2023-01-13 23:06:29 +00:00
fee1-dead
7779386a3a
Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk
...
Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`
Makes sense for this function to live with its sibling `resolve_regions_and_report_errors`, around which it's basically just a wrapper.
2023-01-09 23:35:29 +08:00
Michael Goulet
5d828d2440
Rollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser
...
Reduce spans for `unsafe impl` errors
Because huge spans aren't great for IDEs.
Prior art: https://github.com/rust-lang/rust/pull/103749
2023-01-03 17:19:27 -08:00
Michael Goulet
c104ee9f6d
Move check_region_obligations_and_report_errors to TypeErrCtxt
2023-01-03 23:58:12 +00:00
Troy Neubauer
4cb9030a66
Implement fix for #67535
2023-01-01 18:26:28 -08:00
Lukas Markeffsky
035d854947
reduce spans for unsafe impl
errors
2023-01-01 18:48:57 +01:00
Michael Goulet
8973b3e3cc
Bubble up ErrorGuaranteed from region constraints in method item compare
2022-12-24 21:37:00 +00:00
Matthias Krüger
d23cb738d2
Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
...
rustc: Remove needless lifetimes
2022-12-24 00:31:41 +01:00
Oli Scherer
a9af75cdbc
Give opaque types a better coherence error
2022-12-21 17:44:30 +00:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes
2022-12-20 22:10:40 +01:00
Nilstrieb
8bfd6450c7
A few small cleanups for newtype_index
...
Remove the `..` from the body, only a few invocations used it and it's
inconsistent with rust syntax.
Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18 21:47:28 +01:00
Nilstrieb
88d5f7f4ce
Make #[custom_encodable]
an attribute for newtype_index
...
Makes the syntax a little more rusty.
2022-12-18 21:02:14 +01:00
Michael Goulet
96cb18e864
Combine identical alias arms
2022-12-13 17:48:55 +00:00
Michael Goulet
61adaf8187
Combine projection and opaque into alias
2022-12-13 17:48:55 +00:00
Guillaume Gomez
a2e485c25c
Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errors
...
Use the power of adding helper function to simplify code w/ `Mutability`
r? `@compiler-errors`
2022-11-26 17:47:23 +01:00
Santiago Pastorino
974e2837bb
Introduce PredicateKind::Clause
2022-11-25 00:04:54 -03:00
Maybe Waffle
da40965300
Add Mutability::{is_mut,is_not}
2022-11-23 20:26:31 +00:00
Maybe Waffle
9b9c7d0ecc
Depend on Mutability
ordering
2022-11-23 20:26:31 +00:00
Manish Goregaokar
53eab246db
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
...
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases
r? ````@lcnr````
fixes #99840
2022-11-22 22:54:38 -05:00
Maybe Waffle
b80356a5ab
Use tcx.require_lang_item
instead of unwrapping
2022-11-22 17:19:19 +00:00
Oli Scherer
7658e0fccf
Stop passing the self-type as a separate argument.
2022-11-21 20:39:46 +00:00
Oli Scherer
9e4c3f41c1
Use iterators instead of slices at more sites
2022-11-21 20:34:28 +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
Michael Goulet
b5b6467810
Add rustc_deny_explicit_impl
2022-11-14 03:23:41 +00:00
Michael Goulet
bc345d7bd0
Move fallback_has_occurred to FnCtxt
2022-11-06 02:40:25 +00:00
Matthias Krüger
61c6cdb5f4
Rollup merge of #103915 - chenyukang:yukang/fix-103874, r=lcnr
...
Improve use of ErrorGuaranteed and code cleanup
Part of #103874
2022-11-04 06:40:32 +01:00
yukang
ab22f5521b
change error_reported to use Result instead of an option
2022-11-03 04:57:44 +08:00
Nicholas Nethercote
c8c25ce5a1
Rename some OwnerId
fields.
...
spastorino noticed some silly expressions like `item_id.def_id.def_id`.
This commit renames several `def_id: OwnerId` fields as `owner_id`, so
those expressions become `item_id.owner_id.def_id`.
`item_id.owner_id.local_def_id` would be even clearer, but the use of
`def_id` for values of type `LocalDefId` is *very* widespread, so I left
that alone.
2022-10-29 20:28:38 +11:00
Nicolas Barrios
770538ef9b
Add fix suggestions for E0199, E0200, and E0569
2022-10-20 20:08:27 -04:00
bors
75dbd5b8c3
Auto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot
...
Make `overlapping_impls` not generic
Trying to win back perf from #101632 .
2022-10-16 02:05:30 +00:00
Cameron Steffen
c4068c76a8
Make overlapping_impls non-generic
...
This improves perf
2022-10-13 14:54:48 -05:00
Camille GILLOT
112ce80726
Report duplicate definition in impls with overlap check.
2022-10-13 16:50:24 +00:00
Cameron Steffen
283abbf0e7
Change InferCtxtBuilder from enter to build
2022-10-07 07:10:40 -05:00
Cameron Steffen
4a68373217
Introduce TypeErrCtxt
...
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.
2022-10-07 07:06:16 -05:00
Maybe Waffle
a8f7e244b7
Refactor rustc lint API
2022-10-01 10:03:06 +00:00
lcnr
1fc86a63f4
rustc_typeck to rustc_hir_analysis
2022-09-27 10:37:23 +02:00