Skip to content

Importing/Exporting an impl (not type) from another module #2393

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
erickt opened this issue May 17, 2012 · 1 comment
Closed

Importing/Exporting an impl (not type) from another module #2393

erickt opened this issue May 17, 2012 · 1 comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-type-system Area: Type system C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@erickt
Copy link
Contributor

erickt commented May 17, 2012

Perhaps I'm trying to be too fancy. I'm writing an app that uses a generic type from a library called request<T> seen here. It comes with an iface/impl named request that adds a couple functions to the request. My app only needs one instance of this type, so I created a module like this:

import mre_request = mre::request::request;

export mre_request;
export request;
export request_data;

type request_data = {
    mut session: option<mre::session::session>,
    mut user: option<mre::user::user>,
};

type request = mre::request::request<request_data>;

This doesn't quite the interface I'd like though. The users of this library have to do import request::{request, mre_request} in order to get the type and impl in scope. I'd much rather my other parts of the app just do import request::request to get the type/impl. Is there any way to simplify this down? Maybe we could allow importing/exporting just the impl from a module? Or maybe we could allow exporting just a single instantiated type, as in:

import mre::request::request;

export request_data;
export request = request<request_data>;

type request_data = {
    mut session: option<mre::session::session>,
    mut user: option<mre::user::user>,
};
@catamorphism
Copy link
Contributor

Example is too obsolete for me to easily map it onto current syntax, sorry :-) Reopen the issue still exists.

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
Use cargo_metadata in cargo-miri

Closes rust-lang#2393

Added `cargo_metadata` to `cargo-miri` and changed metadata from manual parsing to `cargo_metadata` invocations. Thus, removed local `Metadata` struct too.

Happy to fix if anything isn't right :)
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* The Kani reference now includes an
  ["Attributes"](https://model-checking.github.io/kani/reference/attributes.html)
  section that describes each of the attributes available in Kani (by
  @adpaco-aws)
* Users' choice of SAT solver, specified by the `solver` attribute, is
  now propagated to the loop-contract synthesizer (by @qinheping)
* Unit tests generated by the concrete playback feature now compile
  correctly when using `RUSTFLAGS="--cfg=kani"` (by @jaisnan)
* The Rust toolchain is updated to 2023-02-16 (by @tautschnig)
tshepang pushed a commit to tshepang/rust that referenced this issue May 20, 2025
Remove unused references and simplify one
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-type-system Area: Type system C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants