Skip to content

Native function link name should be an attribute #906

New issue

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

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

Already on GitHub? Sign in to your account

Closed
brson opened this issue Sep 12, 2011 · 9 comments
Closed

Native function link name should be an attribute #906

brson opened this issue Sep 12, 2011 · 9 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Sep 12, 2011

Instead of

    fn close(fd: int) -> int = "_close";

we should write

    #[link_name = "_close"]
    fn close(fd: int) -> int;
@lht
Copy link
Contributor

lht commented Nov 11, 2011

Should native mod be moved to attribute also to keep it consistent with native fn?

So

native "cdecl" mod ssl = "crypto" {...}

becomes

#[link_name = "crypto"]
native "cdecl" mod ssl {...}

@lht
Copy link
Contributor

lht commented Nov 11, 2011

Okay, I guess the answer is yes. Issue #547 (Replace some native module syntax with attributes).

@brson
Copy link
Contributor Author

brson commented Nov 11, 2011

Also native mods that are crate directives.

@lht
Copy link
Contributor

lht commented Nov 21, 2011

Now I'm about to start hacking crate directive. The plan is:

  1. change
    mod os_fs = "posix_fs.rs";
    to
    #[path = "posix_fs.rs"] mod os_fs;
    path is chosen over filename, considering it might indicate a directory.
  2. Remove option::t from ast::cdir_src_mod and ast::cdir_dir_mod.
  3. Add native support, so we can parse
#[link_name="real_foo"]
native mod foo;```

I'm not totally sure if moving filename/path to attribute is the plan, please confirm?

@brson
Copy link
Contributor Author

brson commented Nov 21, 2011

Yes. What you propose sounds good.

@lht
Copy link
Contributor

lht commented Nov 22, 2011

Are native item declarations in .rc files allowed? As hinted by the few native rc test cases.

native.rc:
native "cdecl" mod rustrt {
  fn str_buf(str s) -> int;
}

native mod libc = target_libc {
  fn puts(int s) -> ();
}

but the reference states a crate is a sequence of directives.

@brson
Copy link
Contributor Author

brson commented Nov 22, 2011

Seems to be a feature that was never implemented, and I don't think there's any need.

lht added a commit to lht/rust that referenced this issue Nov 23, 2011
The path information was an optional "filename" component of crate
directive AST. It is now replaced by an attribute with metadata named
"path".

With this commit, a directive

  mod foo = "foo.rs";

should be written as:

  #[path = "foo.rs"]
  mod foo;

Closes issue rust-lang#906.
brson pushed a commit that referenced this issue Nov 24, 2011
The path information was an optional "filename" component of crate
directive AST. It is now replaced by an attribute with metadata named
"path".

With this commit, a directive

  mod foo = "foo.rs";

should be written as:

  #[path = "foo.rs"]
  mod foo;

Closes issue #906.
@lht
Copy link
Contributor

lht commented Dec 1, 2011

I guess this can be closed? Or should we remove the tests:

./run-pass/native-mod.rc
./run-pass/native.rc

@brson
Copy link
Contributor Author

brson commented Dec 1, 2011

Let's leave the tests as a reminder that somebody wanted that feature at some point.

@brson brson closed this as completed Dec 1, 2011
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Remove expression from cbmc check descriptions

We have no control over the expression printed. These checks usually
end up printing some temporary variables which are rather confusing. For
now, we replace the message to remove the expressions and make it
 more user friendly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants