Commit graph

127 commits

Author SHA1 Message Date
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
Ethan Brierley
fc5633fed6 Make fields on AbstractConst private 2021-09-04 16:28:55 +01:00
Ethan Brierley
85d6029c13 AbstractConst::root: Always run subst when Node is Leaf 2021-09-04 15:44:26 +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
Camille GILLOT
cebbba081e Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
Camille GILLOT
c676e358a5 Use ItemId as a strongly typed index. 2021-02-15 19:24:58 +01:00
Matthew Jasper
79f6f11816 Remove some unnecessary trait_ref calls 2021-02-13 19:30:07 +00:00
Ellen
7f8530f16b more things are const evaluatable *sparkles* 2021-02-01 20:05:50 +00:00
kadmin
6a03f0350d Add error message for private fn
Bless tests

Update with changes from comments
2021-01-31 20:45:13 +00:00
Tomasz Miąsko
b01976aa26 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.

No functional changes intended.
2021-01-30 00:00:00 +00:00
Jack Huey
3dea68de1d Review changes 2021-01-16 18:56:37 -05:00
Joshua Nelson
a8ff647deb Separate out a hir::Impl struct
This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.
2021-01-12 20:32:33 -05:00
Daniel Henry-Mantilla
a4de27aeec Fixed non-declarative-nor-opaque macros effective privacy.
cc @petrochenkov
2021-01-06 15:13:39 +01:00
Daniel Henry-Mantilla
dd15f410df WIP: attempt to fix the undocument re-export issue 2021-01-06 15:13:39 +01:00
Mara Bos
9e8edc8c22
Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
Rename kw::Invalid -> kw::Empty

See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.

r? `@petrochenkov`
2020-12-30 20:56:58 +00:00
Joshua Nelson
edeac1778c Rename kw::Invalid -> kw::Empty
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.
2020-12-30 09:50:02 -05:00
Joshua Nelson
53da233aec Remove FIXME in rustc_privacy 2020-12-26 19:34:10 -05:00
Jack Huey
ed80815bf2 Move binder for dyn to each list item 2020-12-11 15:02:46 -05:00
Camille GILLOT
032f68d625 Remove ForeignMod struct. 2020-11-26 21:32:27 +01:00
Camille GILLOT
419a9186a4 Store ForeignItem in a side table. 2020-11-26 21:29:27 +01:00
Joshua Nelson
432a33e1e2 Fix typo in comment 2020-11-22 20:32:36 -05:00
LeSeulArtichaut
e0f3119103 Introduce TypeVisitor::BreakTy 2020-11-14 20:25:27 +01:00
Guillaume Gomez
99200f760b Fix even more URLs 2020-11-05 20:11:29 +01:00
bors
0d033dee3e Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk
TypeVisitor: use `std::ops::ControlFlow` instead of `bool`

Implements MCP rust-lang/compiler-team#374.

Blocked on FCP in rust-lang/compiler-team#374.
r? `@lcnr` cc `@jonas-schievink`
2020-10-30 22:53:55 +00:00
Joshua Nelson
bfecb18771 Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
LeSeulArtichaut
9433eb83fe Remove implicit Continue type 2020-10-30 12:27:47 +01:00
LeSeulArtichaut
24e1a7e656 Use ControlFlow::is{break,continue} 2020-10-30 12:27:46 +01:00
LeSeulArtichaut
61f8182cec TypeVisitor: use ControlFlow in rustc_{mir,privacy,traits,typeck} 2020-10-30 12:27:44 +01:00
Vadim Petrochenkov
cee5521a03 Calculate visibilities once in resolve
Then use them through a query based on resolver outputs
2020-10-19 11:57:50 +03:00
Matthew Jasper
f958e6c246 Separate bounds and predicates for associated/opaque types 2020-10-06 11:19:29 +01:00
Erik Hofmayer
138a2e5eaa /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
Erik Hofmayer
dd66ea2d3d Updated html_root_url for compiler crates 2020-09-23 21:14:43 +02:00
Ralf Jung
4322e1b92d
Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark-Simulacrum
Remove redundant nightly features

Removes a bunch of redundant/outdated nightly features. The first commit removes a `core_intrinsics` use for which a stable wrapper has been provided since. The second commit replaces the `const_generics` feature with `min_const_generics` which might get stabilized this year. The third commit is the result of a trial/error run of removing every single feature and then adding it back if compile failed. A bunch of unused features are the result that the third commit removes.
2020-09-20 12:08:22 +02:00
Bastian Kauschke
30ff1ef3d0 support const_evaluatable_checked across crate boundaries 2020-09-18 17:11:34 +02:00
est31
ebdea01143 Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
LeSeulArtichaut
3e14b684dd Change ty.kind to a method 2020-09-04 17:47:51 +02:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00