diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-10-01 08:20:37 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-10-01 08:20:37 +0800 |
commit | baee4b97bceb6009f8275ac86fafd614b4953bf5 (patch) | |
tree | a5b1d8f8bb0a2b6a7069c99164b6ced310a8081e /Notes | |
parent | ad4403e113204129f5ae5db9217b5d8e9aa885e5 (diff) | |
download | mrust-baee4b97bceb6009f8275ac86fafd614b4953bf5.tar.gz |
Notes - Add crate search
Diffstat (limited to 'Notes')
-rw-r--r-- | Notes/CrateSearch.txt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Notes/CrateSearch.txt b/Notes/CrateSearch.txt new file mode 100644 index 00000000..eabb50c2 --- /dev/null +++ b/Notes/CrateSearch.txt @@ -0,0 +1,42 @@ +Problem: Multiple crates with the same name can exist in one executable + +E.g. +- `librustc` and `rustc` +- rustc/src/libnum and vendor/num/ +- bitflags-0.7.0 and bitflags-0.8.2 + +When a crate's source specfies `extern crate foo;`, +- First `--extern foo=foo.hir` should be used (if present) +- A search should be performed of the search directories for the specified crate name + - This might consider wildcard matches + +Once the crate is located, that crate's unique specifier should be stored for if/when the referencer is referenced itself. + + + +Cases: +- Loading from `extern crate` with `--extern` + - Just use the specified path +- Loading from `extern crate` and searching + - Search for a suitable crate +- Loading from a crate's extern list + - Only use the specified crate + +TODO: How should the unique specifier be determined/obtained when loading? +- It could just be the base filename (and do a path search for that exact filename) + - Requires encoding the filename in the item paths. +- It could be extracted from the filename in a standard format. + - Ties to the filename format +- It could be stored in the metadata + - Disconnect between filename and tag, possible lookup errors? + - Would require that the filename be exactly `lib<internalname>.hir` for external reference loading to work. + - Could store the internal name _and_ the base filename in the crate metadata? (and error if an incompatible file is picked) + +NOTE: The specifier should be present on the crate name used for internal lookups. +- This requires `load_crate` to return the specifier/unique name + + + +Command line options: +`--extern` - Override the path for a named crate +`--crate-tag` - Specifies a string to append to the crate name (plus a `-`) during HIR lower |