Commit Graph

343 Commits

Author SHA1 Message Date
Nicholas Nethercote 75b164d836 Use `tidy` to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.

For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
  `allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
  sometimes the order is alphabetical, and sometimes there is no
  particular order.
- Sometimes the attributes of a particular kind aren't even grouped
  all together, e.g. there might be a `feature`, then an `allow`, then
  another `feature`.

This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.

Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
  because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
  ignored in `rustfmt.toml`).
2024-06-12 15:49:10 +10:00
Michael Goulet 273b990554 Align Term methods with GenericArg methods 2024-06-03 20:36:27 -04:00
Michael Goulet 1e72c7f536 Add cycle errors to ScrubbedTraitError to remove a couple more calls to new_with_diagnostics 2024-06-03 09:27:52 -04:00
Michael Goulet 27f5eccd1f Move FulfillmentErrorCode to rustc_trait_selection too 2024-06-03 09:27:52 -04:00
Michael Goulet eb0a70a557 Opt-in diagnostics reporting to avoid doing extra work in the new solver 2024-06-03 09:27:52 -04:00
Michael Goulet 3bcdf3058e split out AliasTy -> AliasTerm 2024-05-13 11:59:42 -04:00
Michael Goulet b55d8a3b49 Apply nits, make some bounds into supertraits on inherent traits 2024-05-10 15:44:03 -04:00
Michael Goulet 5e606c0bde Lift `Lift` 2024-05-10 15:44:03 -04:00
Michael Goulet d9eb5232b6 Use ObligationCtxt in favor of TraitEngine in many places 2024-05-02 22:03:01 -04:00
Nicholas Nethercote 6341935a13 Remove `extern crate tracing` from numerous crates. 2024-04-30 16:47:49 +10:00
Nicholas Nethercote 99e036bd21 Remove `extern crate rustc_middle` from numerous crates. 2024-04-29 14:50:45 +10:00
Oli Scherer 8206cffc48 Merge `check_mod_impl_wf` and `check_mod_type_wf` 2024-03-07 06:27:09 +00:00
León Orell Valerian Liehr 05ce209d20
Rename some normalization-related items 2024-02-20 17:30:49 +01:00
lcnr df55f56283 `normalize_projection_ty` is not used with next-solver 2024-02-19 09:06:34 +01:00
Shoyu Vanilla 3856df059e Dejargnonize subst 2024-02-12 15:46:35 +09:00
Nicholas Nethercote 0ac1195ee0 Invert diagnostic lints.
That is, change `diagnostic_outside_of_impl` and
`untranslatable_diagnostic` from `allow` to `deny`, because more than
half of the compiler has be converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow`
attributes, which proves that this change is warranted.
2024-02-06 13:12:33 +11:00
clubby789 fd29f74ff8 Remove unused features 2024-01-25 14:01:33 +00:00
Ali MJ Al-Nasrawy d96003dd2a Correctly handle normalization in implied bounds
Special-case Bevy dependents to not error
2024-01-17 21:27:34 -05:00
Michael Goulet f37a919e96 Remove redundant Code from FulfillmentErrorCode variants 2024-01-12 16:34:39 +00:00
lcnr 3978f545ba add unused `NormalizesTo` predicate 2023-12-07 17:52:51 +01:00
bors 1e9dda77b5 Auto merge of #118120 - compiler-errors:closure-kind, r=lcnr
Remove `PredicateKind::ClosureKind`

We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes.

This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate.

Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-22 21:09:01 +00:00
Nilstrieb 21a870515b Fix `clippy::needless_borrow` in the compiler
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.

Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
Michael Goulet 93298ee0dd Remove ClosureKind predicate kind 2023-11-21 18:35:45 +00:00
Nicholas Nethercote aefbb616af Remove `-Zperf-stats`.
The included measurements have varied over the years. At one point there
were quite a few more, but #49558 deleted a lot that were no longer
used. Today there's just four, and it's a motley collection that doesn't
seem particularly valuable.

I think it has been well and truly subsumed by self-profiling, which
collects way more data.
2023-11-13 09:45:20 +11:00
bors 9c20ddd956 Auto merge of #117507 - nnethercote:rustc_span, r=Nilstrieb
`rustc_span` cleanups

Just some things I found while looking over this crate.

r? `@oli-obk`
2023-11-03 14:57:40 +00:00
lcnr 57253552de dropck_outlives check generator witness needs_drop 2023-11-02 17:20:13 +01:00
Nicholas Nethercote f405ce86c2 Minimize `pub` usage in `source_map.rs`.
Most notably, this commit changes the `pub use crate::*;` in that file
to `use crate::*;`. This requires a lot of `use` items in other crates
to be adjusted, because everything defined within `rustc_span::*` was
also available via `rustc_span::source_map::*`, which is bizarre.

The commit also removes `SourceMap::span_to_relative_line_string`, which
is unused.
2023-11-02 19:35:00 +11:00
Nicholas Nethercote 8ff624a9f2 Clean up `rustc_*/Cargo.toml`.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
Michael Goulet 8fbd78ccea Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
klensy 6950689030 remove some unused crate deps 2023-09-01 19:13:09 +03:00
Mahdi Dibaiee e55583c4b8 refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
Michael Goulet 3f8919c09b get rid of a bit more calls to poly_select 2023-07-06 16:50:12 +00:00
Michael Goulet 52f7384995 Separate select calls that don't need a binder 2023-07-06 16:50:12 +00:00
Michael Goulet 0c73b41cd6 remove TypeWellFormedFromEnv 2023-07-03 21:40:04 +00:00
Michael Goulet 810fbf086d Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
Nilstrieb e43ec03968 Update chalk 2023-07-01 18:03:36 +02:00
Michael Goulet 75a8f68183 Remove unnecessary DefineOpaqueTypes::Bubble from codegen 2023-06-27 21:36:15 +00:00
Michael Goulet 374173cd99 TypeWellFormedInEnv 2023-06-26 23:12:04 +00:00
Michael Goulet fbdef58414 Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
Michael Goulet fdce450eb5
Rollup merge of #112963 - oli-obk:tait_solver_decoupling, r=compiler-errors
Stop bubbling out hidden types from the eval obligation queries

r? `@compiler-errors`

I don't know why these were added, but they are not needed anymore. The relevant test is unaffected and I didn't see anything interesting in logging that would have justified it.

This PR has no effect on the new solver behaviour of cf2dff2b1e/tests/ui/impl-trait/issue-99642.rs (which is overflow) and cf2dff2b1e/tests/ui/impl-trait/issue-99642-2.rs (which is "unstable certainty ICE")
2023-06-23 19:47:20 -07:00
Oli Scherer c996cfec80 Stop bubbling out hidden types from the eval obligation queries 2023-06-23 14:53:31 +00:00
Michael Goulet 46a650f4e0 Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00
Michael Goulet fca56a8d2c s/Clause/ClauseKind 2023-06-19 14:57:42 +00:00
Michael Goulet 6594c75449 Move ConstEvaluatable to Clause 2023-06-17 21:27:13 +00:00
Michael Goulet 52d3fc93f2 Move WF goal to clause 2023-06-17 21:20:20 +00:00
Oli Scherer f3b7dd6388 Add `AliasKind::Weak` for type aliases.
Only use it when the type alias contains an opaque type.

Also does wf-checking on such type aliases.
2023-06-16 19:39:48 +00:00
The 8472 114d5f221c s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
Michael Goulet 3d4da98273 Make TraitEngine::new use the right solver, add compare mode 2023-06-06 18:43:20 +00:00
Michael Goulet e0acff796a New trait solver is a property of inference context 2023-06-06 18:43:06 +00:00
Maybe Waffle e33e20824f Rename `tcx.mk_re_*` => `Region::new_*` 2023-05-29 17:54:53 +00:00