Skip to content

RFC: Split core into core + rt #5157

Closed
Closed

Description

@brson

This is an RFC-level change but I don't have a full proposal just now. The basic idea is to make a new crate, rt, that depends on core, and all the scheduler, task, pipes, etc. code lives there. core contains modules for the primitive types, containers and a few other things.

This would mostly be an organizational change. Beyond freeing some niche users from linking to rt it doesn't really enable any new functionality. What it does is make a clear delineation between code that is tied to the scheduler and code that isn't.

By default, crates would link to both core and rt (as they now link to core and rustrt).

There aren't any significant technical obstacles that I know of, but it will require thinking about how task and comm fit into the prelude. Does the prelude live in rt? Do we just not put task and comm in the prelude?

Activity

  1. brson commented on Feb 28, 2013

    @brson
    ContributorAuthor

    This would require making some lang items optional and some overrideable. Exchange heap lang items would have implementations in both core and rt. Local heap items would only have an implementation in rt (though eventually we'll probably find a way to use the local heap outside of tasks).

  2. catamorphism commented on Feb 28, 2013

    @catamorphism
    Contributor

    +1

  3. brson commented on Mar 12, 2013

    @brson
    ContributorAuthor

    This would cause some complications with stack growth since __morestack, which is statically linked to every crate and called from every function, calls two functions in the runtime, but if core doesn't depend on the runtime then how can __morestack call the runtime? We could possibly have core __morestack make a virtual call through two globals that are set up by the runtime, but penalizing core is unfortunate. On the other hand, much of core is templates so the perf cost may not be too bad.

  4. brson commented on Mar 14, 2013

    @brson
    ContributorAuthor

    Logging will present a similar problem to __morestack.

  5. brson commented on Mar 14, 2013

    @brson
    ContributorAuthor

    core::run spawns tasks

  6. brson commented on Mar 14, 2013

    @brson
    ContributorAuthor

    I was also planning on making the io interface use conditions, but conditions depend on tasks, so that would mean that core couldn't have its own blocking I/O implementation.

  7. brson commented on Jun 13, 2013

    @brson
    ContributorAuthor

    I don't think this is feasible now. There is too much runtime code that must be available everywhere for e.g. failure.

  8. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions