Commit Graph

97 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
60f1944ebf rustc: rename DefPathData::{MacroDef,LifetimeParam} to {Macro,Lifetime}Ns. 2019-05-04 05:10:46 +03:00
Eduard-Mihai Burtescu
2efeb485a9 rustc: collapse relevant DefPathData variants into ValueNs. 2019-05-04 05:10:46 +03:00
Eduard-Mihai Burtescu
e5b9f54cd9 rustc: collapse relevant DefPathData variants into TypeNs. 2019-05-04 05:10:46 +03:00
Vadim Petrochenkov
2cbc25e6fc Merge DefPathData::VariantCtor and DefPathData::StructCtor 2019-03-24 17:59:18 +03:00
David Wood
5c3d1e5d76 Separate variant id and variant constructor id.
This commit makes two changes - separating the `NodeId` that identifies
an enum variant from the `NodeId` that identifies the variant's
constructor; and no longer creating a `NodeId` for `Struct`-style enum
variants and structs.

Separation of the variant id and variant constructor id will allow the
rest of RFC 2008 to be implemented by lowering the visibility of the
variant's constructor without lowering the visbility of the variant
itself.

No longer creating a `NodeId` for `Struct`-style enum variants and
structs mostly simplifies logic as previously this `NodeId` wasn't used.
There were various cases where the `NodeId` wouldn't be used unless
there was an unit or tuple struct or enum variant but not all uses of
this `NodeId` had that condition, by removing this `NodeId`, this must
be explicitly dealt with. This change mostly applied cleanly, but there
were one or two cases in name resolution and one case in type check
where the existing logic required a id for `Struct`-style enum variants
and structs.
2019-03-24 12:10:16 +03:00
Eduard-Mihai Burtescu
a54a41ce47 rustc: provide DisambiguatedDefPathData in ty::print. 2019-03-15 13:25:10 +02:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
varkor
29f7206366 Add const params to Def
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07 15:02:17 +01:00
Mark Mansi
e957ed9d10 move librustc to 2018 2019-02-05 12:45:47 -06:00
ljedrz
272f4dfff6 hir: remove Definitions::hir_to_def_index 2019-02-03 22:27:52 +01:00
ljedrz
e8aeb83a4a hir: add HirId methods 2019-02-03 20:37:04 +01:00
Niko Matsakis
1336b8e8c7 integrate trait aliases into def-paths / metadata
Co-authored-by: Alexander Regueiro <alexreg@me.com>
2019-01-10 17:04:19 -05:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Eduard-Mihai Burtescu
7683180be5 rustc: implement and use Default on more types. 2018-11-21 08:11:50 +02:00
Eduard-Mihai Burtescu
da622a3796 rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns. 2018-11-21 07:27:02 +02:00
Oliver Scherer
3c9258e604 Prefer Default::default over FxHash*::default in struct constructors 2018-10-19 14:34:44 +02:00
Oliver Scherer
ee81739dc1 Deprecate the FxHashMap() and FxHashSet() constructor function hack 2018-10-19 14:34:44 +02:00
Diogo Sousa
2d7edf908d Use full name to identify a macro in a FileName.
Before this two macros with same name would be indistinguishable inside a
`FileName`.  This caused a bug in incremental compilation (see #53097) since
two different macros would map out to the same `StableFilemapId`.

Fixes #53097.
2018-09-19 01:12:13 +01:00
ljedrz
2919ecdb5c A few cleanups for hir 2018-09-12 17:07:00 +02:00
Ariel Ben-Yehuda
5415bb6e8f create a valid DefIdTable for proc macro crates
At least the incremental compilation code, and a few other places in the
compiler, require the CrateMetadata for a loaded target crate to contain a
valid DefIdTable for the DefIds in the target.

Previously, the CrateMetadata for a proc macro contained the crate's
"host" DefIdTable, which is of course incompatible with the "target"
DefIdTable, causing ICEs. This creates a DefIdTable that properly refers
to the "proc macro" DefIds.

Fixes #49482.
2018-08-26 18:48:41 +03:00
Donato Sciarra
c655473378 mv CodeMap SourceMap 2018-08-19 23:00:59 +02:00
Oliver Schneider
53d2ebb0ad Implement existential types 2018-07-18 10:53:08 +02:00
Vadim Petrochenkov
4d1a30c92b Remove most of PartialEq impls from AST and HIR structures 2018-07-14 14:56:57 +03:00
Vadim Petrochenkov
fc74e35981 Remove fallback to parent modules from lexical resolution 2018-07-08 18:16:09 +03:00
Michael Woerister
447f1f3f5c Avoid sorting the item_ids array the StableHash impl of hir::Mod. 2018-07-03 11:16:38 +02:00
bors
bfc1ee4968 Auto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obk
hygiene: Implement transparent marks and use them for call-site hygiene in proc-macros

Fixes https://github.com/rust-lang/rust/issues/50050
2018-06-30 09:19:21 +00:00
Vadim Petrochenkov
9f92fce77c Fortify dummy span checking 2018-06-30 01:53:32 +03:00
Oliver Schneider
013fca8698 Generate DefIds for impl Trait in the def_collector 2018-06-27 11:17:25 +02:00
Vadim Petrochenkov
fffe9fbb51 hygiene: More descriptive names for things involved in late hygienic name resolution 2018-06-23 20:09:21 +03:00
varkor
10229fd9d5 Rename DefPathData::LifetimeDef to LifetimeParam 2018-06-20 12:21:24 +01:00
Oliver Schneider
9b1bd94e37 Add existential type definitons 2018-06-07 17:33:53 +02:00
Zack M. Davis
1b7488d40b scrap find_node_for_hir_id in favor of hir_to_node_id
Michael Woerister pointed out that `hir_to_node_id` (introduced in
August 2017's 28ddd7a4e) supersedes the functionality of
`find_node_for_hir_id` (just a hash lookup compared to that linear
search).
2018-05-28 09:20:14 -07:00
Eduard-Mihai Burtescu
26aad25487 rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants". 2018-05-19 20:34:42 +03:00
John Kåre Alsaker
4d52751d12 Rename InternedString to LocalInternedString and introduce a new thread-safe InternedString 2018-04-27 03:35:32 +02:00
Niko Matsakis
09bd6f3ee7 introduce new DefPathData variants for traits, assoc types 2018-04-23 13:28:14 -04:00
Basile Desloges
4af749f074 Add a map of DefId to Span in the Definitions struct 2018-03-08 11:22:49 +01:00
Aaron Hill
6728f21d85
Generate documentation for auto-trait impls
A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any
synthetic implementations for auto traits. Currently, this is only done
for Send and Sync.

On trait pages, a new 'Auto Implementors' section displays all types
which automatically implement the trait. Effectively, this is a list of
all public types in the standard library.

Synthesized impls for a particular auto trait ('synthetic impls') take
into account generic bounds. For example, a type 'struct Foo<T>(T)' will
have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

'struct Foo<T>(T)'
'struct Wrapper<T>(Foo<T>)'
'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes
this sound somehow

Then Wrapper will have the following impl generated:
'impl<T> Send for Wrapper<T>'
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send'
to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are
taken into account by synthetic impls

However, if a type can *never* implement a particular auto trait
(e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be
generated (in this case, 'impl<T> !Send for MyStruct<T>')

All of this means that a user should be able to copy-paste a synthetic
impl into their code, without any observable changes in behavior
(assuming the rest of the program remains unchanged).
2018-02-18 16:29:24 -05:00
Michael Woerister
c9d25e3269 Use different DefIndex representation that is better suited for variable length integer encodings. 2018-01-08 14:15:17 +01:00
Jeffrey Seyfried
dfa6c25afd Fix hygiene bug. 2017-11-28 18:59:12 -08:00
Mikhail Modin
0e5c95ebcb change separator from . to - 2017-11-09 12:37:16 +03:00
Mikhail Modin
7a6832de99 change MIR dump filenames from nodeN to DefPath 2017-11-09 12:00:17 +03:00
Santiago Pastorino
d19faead2d Make DefIndex use newtype_index macro 2017-11-04 19:22:37 -03:00
Igor Matuszewski
7fa64bcef3 Introduce CrateDisambiguator newtype and fix tests 2017-10-24 17:49:58 +02:00
Michael Woerister
b50e8ebbba Fix infinite recursion in <DepNode as Debug>. 2017-10-05 10:20:13 +02:00
Eduard-Mihai Burtescu
da0a47a081 Use NodeId/HirId instead of DefId for local variables. 2017-09-08 22:00:59 +03:00
Alex Crichton
0cdc58a1bc rustc: Store InternedString in DefPathData
Previously a `Symbol` was stored there, but this ended up causing hash
collisions in situations that otherwise shouldn't have a hash collision. Only
the symbol's string value was hashed, but it was possible for distinct symbols
to have the same string value, fooling various calcuations into thinking that
these paths *didn't* need disambiguating data when in fact they did!

By storing `InternedString` instead we're hopefully triggering all the exising
logic to disambiguate paths with same-name `Symbol` but actually distinct
locations.
2017-09-05 07:47:27 -07:00
Michael Woerister
a8cf6cc6db Add some ID conversion methods to HIR map and Definitions. 2017-08-11 12:11:38 +02:00
Michael Woerister
55e04d9c17 Make Definitions::find_node_for_hir_id() a linear search instead of a binary one.
Unfortunately, the NodeId->HirId array is not sorted. Since this search is only
done right before calling bug!(), let's not waste time allocating a faster lookup.
2017-08-11 12:11:38 +02:00
Michael Woerister
783ccc443b Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId. 2017-08-11 12:11:38 +02:00