Skip to content

Add attribute to indicate entry point, #[main] #4483

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
wants to merge 5 commits into from

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented Jan 14, 2013

#4207

Functions marked with #[main] will take precedence over 'main' if it's there.

Move duplicate main check from trans to resolve and change
trans to use main fn indicated in session.
Attribute to allow naming the entry point something other than `main`.
Functions explicitly marked with #[main] have
precedence over the regular `main` fn.
@kud1ing
Copy link

kud1ing commented Jan 14, 2013

#4482 might be related

// or multple functions marked
// with #[main]
self.session.span_fatal(item.span,
~"multiple 'main' functions");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when functions are given in particular order like this: main - main - #[main]
I think it would print out "multiple 'main' functions" error.
https://gist.github.com/4530073

or this also would lead to similar result
https://gist.github.com/4530083

@luqmana
Copy link
Member Author

luqmana commented Jan 14, 2013

Hmm I didn't see ILyoan's work when I started working on this last night and hadn't checked before making the pull request.

Also, thanks for pointing out the bugs.

@kud1ing
Copy link

kud1ing commented Jan 14, 2013

Rust became so popular that people happen to work on the same stuff all the time ;(

@brson
Copy link
Contributor

brson commented Jan 14, 2013

Oh, my. I didn't see this request before I pulled @ILyoan's (this is the second time I've done this to people's pull requests now). I'll see if there's any additional work I can merge from yours @luqmana.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

The two look essentially equivalent, so I'm not going to try to pull anything out of this branch. Sorry about that @luqmana. Please let me know if you would like me to pull any specific thing.

@brson brson closed this Jan 14, 2013
@luqmana
Copy link
Member Author

luqmana commented Jan 14, 2013

No worries, it's fine. I think the only major difference is that in my changes for the test driver it doesn't remove the functions from the AST but just removes the attributes while ILyoan's just removes the fn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants