Commit graph

83 commits

Author SHA1 Message Date
bors b27661eb33 Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot
Fix clippy lints

I'm currently working on allowing clippy to run on librustdoc after a discussion I had with `@Mark-Simulacrum.` So in the meantime, I fixed a few lints on the compiler crates.
2021-10-02 10:52:09 +00:00
Guillaume Gomez 759eba0a08 Fix clippy lints 2021-10-01 23:17:19 +02:00
Camille GILLOT db9fea508a Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
bors ac2d9fc509 Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank
Migrate in-tree crates to 2021

This replaces #89075 (cherry picking some of the commits from there), and closes #88637 and fixes #89074.

It excludes a migration of the library crates for now (see tidy diff) because we have some pending bugs around macro spans to fix there.

I instrumented bootstrap during the migration to make sure all crates moved from 2018 to 2021 had the compatibility warnings applied first.

Originally, the intent was to support cargo fix --edition within bootstrap, but this proved fairly difficult to pull off. We'd need to architect the check functionality to support running cargo check and cargo fix within the same x.py invocation, and only resetting sysroots on check. Further, it was found that cargo fix doesn't behave too well with "not quite workspaces", such as Clippy which has several crates. Bootstrap runs with --manifest-path ... for all the tools, and this makes cargo fix only attempt migration for that crate. We can't use e.g. --workspace due to needing to maintain sysroots for different phases of compilation appropriately.

It is recommended to skip the mass migration of Cargo.toml's to 2021 for review purposes; you can also use `git diff d6cd2c6c87 -I'^edition = .20...$'` to ignore the edition = 2018/21 lines in the diff.
2021-09-21 19:25:49 +00:00
Mark Rousskov c746be2219 Migrate to 2021 2021-09-20 22:21:42 -04:00
Camille GILLOT d7795d302a Do not store visibility in *ItemRef. 2021-09-20 00:29:53 +02:00
Ellen 8c7954dc42 add a CastKind to Node::Cast 2021-09-09 01:32:03 +01:00
Ellen 406d2ab95d rename mir -> thir around abstract consts 2021-09-09 01:32:03 +01:00
Ellen c170dcf04c tidy 2021-09-09 01:32:03 +01:00
Ellen 4483c2bdf6 dont support blocks 2021-09-09 01:32:03 +01:00
Ellen 9b2913814b as casts and block exprs 2021-09-09 01:32:03 +01:00
Ellen 2987f4ba42 WIP state 2021-09-09 01:32:03 +01:00
Camille GILLOT d119a13137 Rename walk_crate. 2021-09-02 19:23:11 +02:00
Camille GILLOT 7ec973d9ce Stop using walk_crate. 2021-09-02 19:08:58 +02:00
Ellen fcc2badf9b rename const_evaluatable_checked to generic_const_exprs
2021-08-30 11:00:21 +02:00
inquisitivecrystal 8c62fa0575 Treat macros as HIR items 2021-08-28 00:16:34 -07:00
lcnr caa975c89e use ty::Unevaluated instead of def substs pair 2021-08-26 11:00:30 +02:00
lcnr bfaf13af4e make unevaluated const substs optional 2021-08-26 11:00:30 +02:00
lcnr f4b606fd17 require a tcx for TypeVisitor 2021-08-26 10:54:01 +02:00
bors f66e825f73 Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiser
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`

Instead of updating global state to mark attributes as used,
we now explicitly emit a warning when an attribute is used in
an unsupported position. As a side effect, we are to emit more
detailed warning messages (instead of just a generic "unused" message).

`Session.check_name` is removed, since its only purpose was to mark
the attribute as used. All of the callers are modified to use
`Attribute.has_name`

Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed
used' attribute is implemented by simply not performing any checks
in `CheckAttrVisitor` for a particular attribute.

We no longer emit unused attribute warnings for the `#[rustc_dummy]`
attribute - it's an internal attribute used for tests, so it doesn't
mark sense to treat it as 'unused'.

With this commit, a large source of global untracked state is removed.
2021-08-24 03:58:22 +00:00
Frank Steffahn bf88b113ea Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00
Aaron Hill af46699f81
Remove Session.used_attrs and move logic to CheckAttrVisitor
Instead of updating global state to mark attributes as used,
we now explicitly emit a warning when an attribute is used in
an unsupported position. As a side effect, we are to emit more
detailed warning messages (instead of just a generic "unused" message).

`Session.check_name` is removed, since its only purpose was to mark
the attribute as used. All of the callers are modified to use
`Attribute.has_name`

Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed
used' attribute is implemented by simply not performing any checks
in `CheckAttrVisitor` for a particular attribute.

We no longer emit unused attribute warnings for the `#[rustc_dummy]`
attribute - it's an internal attribute used for tests, so it doesn't
mark sense to treat it as 'unused'.

With this commit, a large source of global untracked state is removed.
2021-08-21 13:27:27 -05:00
Vadim Petrochenkov 1fdea560d2 rustc_privacy: Replace HirIds and DefIds with LocalDefIds where possible 2021-08-19 00:01:12 +03:00
Deadbeef 32390a0df6
move Constness into TraitPredicate 2021-08-13 09:26:33 +00:00
bors bb744e1e9f Auto merge of #87568 - petrochenkov:localevel, r=cjgillot
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables

and passes using those tables - primarily privacy checking, stability checking and dead code checking.

All these passes work with definitions rather than with arbitrary HIR nodes.
r? `@cjgillot`
cc `@lambinoo` (#87487)
2021-08-04 02:04:04 +00:00
Vadim Petrochenkov b08576b2ad rustc: Replace HirIds with LocalDefIds in AccessLevels tables
and passes using them - primarily privacy checking, stability checking and dead code checking.

WIP
2021-07-31 19:31:29 +03:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
kadmin 8759f00c73 Actually infer args in visitors 2021-07-26 21:15:18 +00:00
kadmin 3605675bb1 Add inferred args to typeck 2021-07-25 07:28:51 +00:00
kadmin 417b098cfc Add generic arg infer 2021-07-25 07:28:51 +00:00
Camille GILLOT 071a047dc7 Make resolutions a query. 2021-07-06 19:22:27 +02:00
Ellen c318364d48 Add more tests + visit_ty in some places 2021-06-09 19:28:41 +01:00
Ellen 8e7299dfcd Support as casts in abstract consts 2021-06-08 08:02:16 +01:00
Camille Gillot 0f0f3138cb
Revert "Reduce the amount of untracked state in TyCtxt" 2021-06-01 09:05:22 +02:00
Camille GILLOT 5d9f96ab27 Make resolutions a query. 2021-05-30 19:47:00 +02:00
Pietro Albini 9e22b844dd remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
Camille GILLOT 9849327384 Use () for privacy. 2021-05-12 13:58:45 +02:00
klensy f43ee8ebf6 fix few typos 2021-04-19 15:57:08 +03:00
kadmin ea2af70466 Update with comments
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23 17:16:20 +00:00
varkor 8ef81388e2 Some refactoring 2021-03-23 17:16:20 +00:00
kadmin e4e5db4e42 Add has_default to GenericParamDefKind::Const
This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs
2021-03-23 17:16:20 +00:00
mark db5629adcb stabilize or_patterns 2021-03-19 19:45:32 -05:00
Vadim Petrochenkov b25d3ba781 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
Camille GILLOT c05c90275c Remove hir::MacroDef::attrs. 2021-03-09 19:09:36 +01:00
Dylan DPC 66211f6657
Rollup merge of #82066 - matthewjasper:trait-ref-fix, r=jackh726
Ensure valid TraitRefs are created for GATs

This fixes `ProjectionTy::trait_ref` to use the correct substs. Places that need all of the substs have been updated to not use `trait_ref`.

r? ````@jackh726````
2021-02-18 16:57:34 +01:00
bors cb2effd44e Auto merge of #81574 - tmiasko:p, r=oli-obk
Precompute ancestors when checking privacy

Precompute ancestors of the old error node set so that check for private
types and traits in public interfaces can in constant time determine if
the current item has any descendants in the old error set.

This removes disparity in compilation time between public and private type
aliases reported in #50614 (from 30 s to 5 s, in an example making extensive use
of private type aliases).

No functional changes intended.
2021-02-18 10:13:36 +00:00
Camille GILLOT c4e7427081 Only store a LocalDefId in hir::MacroDef. 2021-02-15 19:35:55 +01:00
Camille GILLOT 996dc8d5c5 Only store a LocalDefId in hir::ForeignItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT 786a80e9ea Only store a LocalDefId in hir::ImplItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT a871a0f111 Only store a LocalDefId in hir::TraitItem. 2021-02-15 19:32:28 +01:00