Commit Graph

22983 Commits

Author SHA1 Message Date
Huon Wilson
72bf201d61 std::rand: move the Isaac implementation to its own file. 2013-10-09 22:22:42 +11:00
bors
3a70df1d3c auto merge of #9753 : alexcrichton/rust/macro-attrs, r=brson
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
2013-10-08 19:26:35 -07:00
Alex Crichton
252d17a07c Allow attributes on macros
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
2013-10-08 19:12:30 -07:00
bors
6c2cdb3436 auto merge of #9772 : alexcrichton/rust/buildsystem, r=thestinger
Reorganize the makefiles to stop building these once per stage because there's
no need to do this at all.

Closes #7002
2013-10-08 14:31:41 -07:00
Alex Crichton
d858360483 Build libuv/jemalloc only once (not per stage)
Reorganize the makefiles to stop building these once per stage because there's
no need to do this at all.

Closes #7002
2013-10-08 14:26:56 -07:00
bors
6db889996b auto merge of #9771 : alexcrichton/rust/snapshots, r=thestinger
Still building locally, we'll see if anything dies...
2013-10-08 13:01:49 -07:00
bors
e42e32291e auto merge of #9757 : erickt/rust/master, r=alexcrichton
I accidentally left an infinite loop in a default method in `num::ToPrimitive::to_u64()`. This fixes it.
2013-10-08 11:06:41 -07:00
Alex Crichton
0cca359da6 Register new snapshots 2013-10-08 09:30:03 -07:00
bors
8db52a5c0e auto merge of #9756 : catamorphism/rust/issue-2354, r=alexcrichton
r? anybody It's more helpful to list the span of each open delimiter seen so far
than to print out an error with the span of the last position in the file.

Closes #2354
2013-10-08 09:11:35 -07:00
bors
e293026e9c auto merge of #9768 : pnkfelix/rust/fsk-fix-issue-9762, r=bstrie
r? anyone

Add bindings for start and ends of keyword ranges; use bindings in match arms.

Also, fixed latent bug that inspired this change: the pattern in `is_any_keyword` had not been updated to match the new range of reserved keyword identifiers.

(I briefly tried to expose the latent bug, but `is_any_keyword` is currently only called in contexts where a failure of this kind merely causes a bit more fruitless compilation before `check_reserved_keywords` is called by the parser, which correctly tags `sizeof` as reserved.)
2013-10-08 07:21:46 -07:00
bors
7ba8033113 auto merge of #9766 : thestinger/rust/fast_ffi, r=huonw
this is no longer used by the compiler
2013-10-08 06:11:35 -07:00
Daniel Micay
313052aeb2 rm useless fast_ffi attributes
this is no longer used by the compiler
2013-10-08 09:03:43 -04:00
Felix S. Klock II
580adc9ad3 Add bindings for start and ends of keyword ranges; use bindings in match arms. 2013-10-08 14:45:02 +02:00
bors
5c8c8bc966 auto merge of #9759 : thestinger/rust/immediate, r=alexcrichton
Closes #9651
2013-10-08 04:16:33 -07:00
Daniel Micay
ac1faba4df make small ty_struct immediate
Closes #9651
2013-10-08 07:11:08 -04:00
bors
e87205c578 auto merge of #9658 : michaelwoerister/rust/namespace_fixes, r=jdm
This should fix some outstanding namespace issues. It also fixes an issue with LLVM metadata uniquing that caused an LLVM assertion when compiling libstd.

One thing to keep in mind is that the `-O` flag and the debug info flags are essentially incompatible. It may work but I would not consider this in any way supported at the moment. On the other hand, there is also good news: With the changes in this PR I am able to compile all of rust with extra-debug-info:
```
make RUSTFLAGS_STAGE2='-Zextra-debug-info' check
```
compiles the whole thing without warning and passes the whole test suite (given that `configure` is run with `--disable-optimize`). That's kind of nice `:)` Still, I'm reluctant to automatically close the related issues (#9167, #9190, #9268) without confirmation from the openers. I'll post to the individual threads once this gets merged.
2013-10-08 03:01:36 -07:00
Michael Woerister
85deeeab59 debuginfo: Unified namespace generation approach for crate-local and external items. Fixed bug related to LLVM metadata uniquing. 2013-10-08 10:35:24 +02:00
bors
c9196290af auto merge of #9674 : ben0x539/rust/raw-str, r=alexcrichton
This branch parses raw string literals as in #9411.
2013-10-07 23:01:39 -07:00
bors
6ddd011ce8 auto merge of #9735 : alexcrichton/rust/privacy, r=cmr
This is the culmination and attempted resolution of #8215. The commits have many more details about implementation details and the consequences of this refinement.

I'll point out specific locations which may be possible causes for alarm. In general, I have been very happy with how things have turned out. I'm a little sad that I couldn't remove privacy from resolve as much as I did, but I blame glob imports (although in theory even some of this can be mitigated as well).
2013-10-07 21:46:39 -07:00
Alex Crichton
7cd6692425 Fix merge fallout of privacy changes 2013-10-07 21:44:02 -07:00
Erick Tryzelaar
6dfc5d5de1 std: fix an infinite loop in num::ToPrimitive and add tests 2013-10-07 19:56:30 -07:00
Benjamin Herr
d7dfe0ae34 pp: add test for raw strs in non-expression positions 2013-10-08 03:47:21 +02:00
bors
132099950f auto merge of #9747 : dim-an/rust/fix-match, r=alexcrichton
When `specialize`ing struct-like enum patterns, compare struct fields to
pattern fields, not pattern fields to pattern fields.

Closes #8351.
2013-10-07 18:46:37 -07:00
Benjamin Herr
9d7b130041 add new enum ast::StrStyle as field to ast::lit_str
For the benefit of the pretty printer we want to keep track of how
string literals in the ast were originally represented in the source
code.

This commit changes parser functions so they don't extract strings from
the token stream without at least also returning what style of string
literal it was. This is stored in the resulting ast node for string
literals, obviously, for the package id in `extern mod = r"package id"`
view items, for the inline asm in `asm!()` invocations.

For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just
the style of string, because it seemed disproportionally cumbersome to
thread that information through the string processing that happens with
those string literals, given the limited advantage raw string literals
would provide in these positions.

The other syntax extensions don't seem to store passed string literals
in the ast, so they also discard the style of strings they parse.
2013-10-08 03:43:28 +02:00
Tim Chevalier
77d9ac37fc syntax: Remove unnecessary @ 2013-10-07 18:37:36 -07:00
Tim Chevalier
bed669cba6 syntax: Display spans for open delimiters when a file ends prematurely
It's more helpful to list the span of each open delimiter seen so far
than to print out an error with the span of the last position in the file.

Closes #2354
2013-10-07 18:06:30 -07:00
bors
b17dc4a946 auto merge of #9751 : thestinger/rust/immediate, r=alexcrichton
This is incorrect, as take glue isn't used for moves.
2013-10-07 16:56:36 -07:00
Benjamin Herr
9787872553 add token::LIT_STR_RAW(ident, num of # symbols)
Treat it as a synonym for LIT_STR for now.
2013-10-08 01:44:05 +02:00
Benjamin Herr
18099fe085 add vim syntax highlighting support for raw string literals 2013-10-08 01:44:05 +02:00
Benjamin Herr
6885c7337f document raw string literals in tutorial.md and rust.md 2013-10-08 01:44:05 +02:00
Benjamin Herr
904c6c43c4 lex raw string literals, like r#"blah"#
Raw string literals are lexed into regular string literals. This is okay
for them to "work" and be usable/testable, but the pretty-printer does
not know about them yet and will just emit regular string literals.
2013-10-08 01:44:05 +02:00
Benjamin Herr
e007f94747 pp: print spaces around '=' in 'extern mod blah = "blah"' 2013-10-08 01:44:05 +02:00
Daniel Micay
f56cf16b80 stop zeroing the drop flag in drop glue
this is only going to cover up real bugs, as it's not part of the model
used to prevent multiple destructor calls
2013-10-07 18:41:20 -04:00
Daniel Micay
a9fb88d4f8 rm special case for ty_struct from take glue
This is incorrect, as take glue isn't used for moves.
2013-10-07 17:18:10 -04:00
Alex Crichton
2c76cdae3e Document visibility in the manual/tutorial
This removes the warning "Note" about visibility not being fully defined, as it
should now be considered fully defined with further bugs being considered just
bugs in the implementation.
2013-10-07 13:00:52 -07:00
Alex Crichton
de7d143176 Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt
to refine privacy. There were a few unfortunate leaks which now must be plugged,
and the most horrible one is the current `shouldnt_be_public` module now inside
`std::rt`. I think that this either needs a slight reorganization of the
runtime, or otherwise it needs to just wait for the external users of these
modules to get replaced with their `rt` implementations.

Other fixes involve making things pub which should be pub, and otherwise
updating error messages that now reference privacy instead of referencing an
"unresolved name" (yay!).
2013-10-07 13:00:52 -07:00
Alex Crichton
439e2770be Extract privacy checking from name resolution
This commit is the culmination of my recent effort to refine Rust's notion of
privacy and visibility among crates. The major goals of this commit were to
remove privacy checking from resolve for the sake of sane error messages, and to
attempt a much more rigid and well-tested implementation of visibility
throughout rust. The implemented rules for name visibility are:

1. Everything pub from the root namespace is visible to anyone
2. You may access any private item of your ancestors.

"Accessing a private item" depends on what the item is, so for a function this
means that you can call it, but for a module it means that you can look inside
of it. Once you look inside a private module, any accessed item must be "pub
from the root" where the new root is the private module that you looked into.
These rules required some more analysis results to get propagated from trans to
privacy in the form of a few hash tables.

I added a new test in which my goal was to showcase all of the privacy nuances
of the language, and I hope to place any new bugs into this file to prevent
regressions.

Overall, I was unable to completely remove the notion of privacy from resolve.
One use of privacy is for dealing with glob imports. Essentially a glob import
can only import *public* items from the destination, and because this must be
done at namespace resolution time, resolve must maintain the notion of "what
items are public in a module". There are some sad approximations of privacy, but
I unfortunately can't see clear methods to extract them outside.

The other use case of privacy in resolve now is one that must stick around
regardless of glob imports. When dealing with privacy, checking a private path
needs to know "what the last private thing was" when looking at a path. Resolve
is the only compiler pass which knows the answer to this question, so it
maintains the answer on a per-path resolution basis (works similarly to the
def_map generated).

Closes #8215
2013-10-07 13:00:52 -07:00
Dmitry Ermolov
da7f41104d Fix bug in match checking
When `specialize`ing struct-like enum patterns, compare struct fields to
pattern fields, not pattern fields to pattern fields.

Closes #8351.
2013-10-07 22:28:18 +04:00
Dmitry Ermolov
822699e57e Add tests for issue 8351 2013-10-07 22:28:18 +04:00
Dmitry Ermolov
fdb49aa917 Hide internal stuff in check_match.rs 2013-10-07 13:33:50 +04:00
bors
8eb28bb7dc auto merge of #9703 : alexcrichton/rust/compiler-features, r=cmr
This implements the necessary logic for gating particular features off by default in the compiler. There are a number of issues which have been wanting this form of mechanism, and this initially gates features which we have open issues for.

Additionally, this should unblock #9255
2013-10-06 14:41:28 -07:00
Alex Crichton
3396365cab Add appropriate #[feature] directives to tests 2013-10-06 14:39:25 -07:00
bors
4db6eba3a2 auto merge of #9741 : catamorphism/rust/rustpkg-remotes, r=cmr
r? @cmr Closes #9193
2013-10-06 09:16:30 -07:00
bors
c05fbc5a2c auto merge of #9593 : fhahn/rust/logging-unsafe-removal, r=alexcrichton
This pull request changes to memory layout of the `CrateMap` struct to use static slices instead of raw pointers. Most of the discussion took place [here](63b5975efa (L1R92)) .

The memory layout of CrateMap changed, without bumping the version number in the struct. Another, more backward compatible, solution would be to keep the old code and increase the version number in the new struct. On the other hand, the `annihilate_fn` pointer was removed without bumping the version number recently.

At the moment, the stage0 compiler does not use the new memory layout, which would lead the segfaults during stage0 compilation, so I've added a dummy `iter_crate_map` function for stage0, which does nothing. Again, this could be avoided if we'd bump the version number in the struct and keep the old code.

I'd like to use a normal `for` loop [here](https://github.com/fhahn/rust/compare/logging-unsafe-removal?expand=1#L1R109), 

        for child in children.iter() {
            do_iter_crate_map(child, |x| f(x), visited);
        }


but for some reason this only yields `error: unresolved enum variant, struct or const 'Some'` and I have no idea why.
2013-10-06 03:21:32 -07:00
Florian Hahn
23176fc567 get_crate_map returns an Option 2013-10-06 11:40:26 +02:00
bors
a623fd339b auto merge of #9682 : skade/rust/clearer-error-message-for-external-type-and-trait, r=alexcrichton
The old error message implied that external traits could never
be implemented locally.
2013-10-06 02:06:32 -07:00
Florian Gilcher
8154d23e44 Clearer error message for external trait and type
The old error message implied that external traits could never
be implemented locally.
2013-10-06 09:56:46 +02:00
Huon Wilson
c5c980ac2a Fix a typo in std::ops documentation 2013-10-06 18:51:58 +11:00
bors
d5e5d22bdb auto merge of #9738 : catamorphism/rust/rustpkg-test-docs-need-to-submit, r=alexcrichton
r? anybody Talk about `rustpkg test` in the tutorial, and update its usage message.

@steveklabnik, it would be great if you could look this over :-)
2013-10-05 22:46:34 -07:00
Tim Chevalier
d7b2c70a13 rustpkg: Fix fetching remote packages
Closes #9193
2013-10-06 00:49:11 -04:00