Skip to content
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

Remove the difference between .rc and .rs files #2176

Closed
brson opened this issue Apr 9, 2012 · 5 comments
Closed

Remove the difference between .rc and .rs files #2176

brson opened this issue Apr 9, 2012 · 5 comments
Assignees
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Milestone

Comments

@brson
Copy link
Contributor

brson commented Apr 9, 2012

This distinction seems to be confusing for newcomers and there is very little practical difference between the two. This would also help eliminate some of the confusing behavior of crate companion mods (#1277).

We would still need a way to signal to cargo which file is the crate file, so we could either keep the .rc extension (having it be the same as .rs), have it scan .rs files for a specific attribute, or add it to the cargo manifest.

@graydon
Copy link
Contributor

graydon commented Apr 10, 2012

We'd need some new place where we put:

  • Linkage metadata (which should only be defined in one place)
  • References to the tree of files you want to compile together into a crate (or inter-file references, like "this mod is defined in this other file")
  • Linkage-level exports and versioning (we haven't done multiple version exports yet, but may well)
  • "Phased" compilation (loading syntax extensions, checking language version compatibility before / during parsing)

If we can work through all those then I agree there might be a way to do this. But crate files do different things than source files at the moment (and have more planned), so we need workalikes for all those "different things" in source files. I do not want to lose the general flavour of the compilation model (one input file, self-describing builds, etc.) though I can see a benefit to this: it'd make splitting and combining crates much less of a chore.

@brson
Copy link
Contributor Author

brson commented Apr 10, 2012

Linkage metadata can already go into the companion mod - their attributes are merged. Reading mods from external files is easy to implement and is (I think) the only difference between .rc and .rs files currently. Not sure about the other points.

@graydon
Copy link
Contributor

graydon commented Apr 10, 2012

Fair enough. I'd be amenable to such a change then. Particularly if we decide on a thought-out approach to #2159 in the sense of a smallest-unit-of-text at the top of a file that we can parse and interpret, to look for an indication of which version of the language to compile with. Either version guarding or feature guarding or something. That's the crucial bit in terms of phased compilation, I think.

@bstrie
Copy link
Contributor

bstrie commented Apr 10, 2012

In talking about metadata at the top of a source file, #1772 could be related as well.

@brson
Copy link
Contributor Author

brson commented Dec 5, 2012

done

@brson brson closed this as completed Dec 5, 2012
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

3 participants