Skip to content

implement 'use' for rustc #244

Closed
Closed
@graydon

Description

@graydon

Rustc can't 'use' crates yet. In fact it can't even write out crate metadata. It has to learn how.

Tasks here involve:

  • Make up a serial encoding of crate metadata that is efficient to incrementally parse and
    seek around inside of, but also stable and simple enough that we're not likely to break it
    all the time as we hack on rustc.
  • Compose a metadata blob of this sort and write it out as a special .note.rust section via
    LLVM. Not sure exactly what support it has for making up our own section names. Try
    your best.
  • Mangle the symbols inside a given crate using the mangling scheme outlined in this
    mailing list post: https://mail.mozilla.org/pipermail/rust-dev/2010-December/000164.html
  • When you 'use' a crate, scan for the .note.rust section (might need to port the objfile
    sniffer from rustboot, see for example boot/be/elf.ml 'sniff' and friends) and read its
    contents into the compilation-crate namespace. Lazily load additional components of
    the 'use'd crate namespace as references and imports demand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions