Commit Graph

2005 Commits

Author SHA1 Message Date
John Clements
60562ac9f8 whitespace, reindentation, and comments only 2013-09-06 13:35:12 -07:00
John Clements
0954e66442 uncomment mtwt_resolve calls 2013-09-06 13:35:11 -07:00
John Clements
d9ba61c786 ident->name in NamedField, elsewhere 2013-09-06 13:35:11 -07:00
John Clements
7668fb2c75 make ifn macro non-capturing 2013-09-06 13:35:07 -07:00
John Clements
39ca2dbbc5 update librustc to use name comparison in most cases, and mtwt_resolve comparison in others 2013-09-06 13:35:07 -07:00
John Clements
71e72ee862 one-line comment 2013-09-06 13:35:06 -07:00
John Clements
7fd5bdcb9a try removing basically dead code in resolve 2013-09-06 13:35:06 -07:00
John Clements
9ec1623d57 ident->name 2013-09-06 13:35:06 -07:00
bors
510c4d8dcf auto merge of #8993 : pnkfelix/rust/fsk-fix-7740-dont-recur-on-items-during-gather-loans-of-block, r=nikomatsakis
Fix #7740

r? anyone, @nikomatsakis especially.
2013-09-05 04:55:44 -07:00
bors
3c3ae1d0e2 auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonw
These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why.

As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
2013-09-04 23:55:46 -07:00
Alex Crichton
7baff57f26 Improve name mangling for gdb
Remove __extensions__ from method symbols as well as the meth_XXX. The XXX is
now used to append a few characters at the end of the name of the symbol.

Closes #6602
2013-09-04 23:28:23 -07:00
Daniel Micay
b49e9fa794 forbid cast as bool
This is currently unsound since `bool` is represented as `i8`. It will
become sound when `bool` is stored as `i8` but always used as `i1`.

However, the current behaviour will always be identical to `x & 1 != 0`,
so there's no need for it. It's also surprising, since `x != 0` is the
expected behaviour.

Closes #7311
2013-09-04 23:09:51 -04:00
Felix S. Klock II
41e7924670 Fix #7740: gather_loans should not recur into the items of the block.
gather_loans does not need to recurse into any items declared in the
current block.  Rather than special-case `fk_item_fn` and `fk_method`,
just make the GatherLoanVisitor's visit_item method a no-op.

This indirectly implies that the example of #7740 is fixed:

    fn f() {
        static A: &'static char = &'A';
    }

Since we do not recurse into items, we no longer encounter `&'A'`.
2013-09-05 02:32:36 +02:00
Michael Woerister
5b94ae93f3 debuginfo: Fixed some merge fallout 2013-09-04 19:31:13 +02:00
Michael Woerister
c49eb075db debuginfo: Much improved handling of captured variables and by-value arguments. 2013-09-04 18:38:46 +02:00
Michael Woerister
e0b63b0e2a debuginfo: Fixed some merge fallout 2013-09-04 18:38:46 +02:00
Michael Woerister
6b2df76c24 debuginfo: Always copy args to allocas if debuginfo is enabled 2013-09-04 18:38:46 +02:00
Michael Woerister
c19f493129 debuginfo: Added test cases for structs, tuples, enums, etc passed by value.
Also updated documentation comments in debuginfo and renamed DebugContext to CrateDebugContext.
2013-09-04 18:38:46 +02:00
Michael Woerister
30375ccb30 debuginfo: Support for by-value arguments (still excluding some cases of self arguments) 2013-09-04 18:38:46 +02:00
Michael Woerister
b81ea86530 debuginfo: Support for variables captured in closures and closure type descriptions. 2013-09-04 18:38:46 +02:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
bors
b4ff0bca4c auto merge of #8921 : huonw/rust/stability, r=brson
Significant progress on #6875, enough that I'll open new bugs and turn that into a metabug when this lands.

Description & example in the commit message.
2013-09-03 12:22:16 -07:00
bors
c14daba3b2 auto merge of #8947 : thestinger/rust/name, r=huonw
Storing the type name in the `tydesc` aims to avoid the need to pass a type name in almost every single visitor method.

It would likely be much saner for `repr` to simply be passed the `TyDesc` corresponding to the function or just the type name, but this is good enough for now.
2013-09-03 08:06:04 -07:00
Huon Wilson
506f69aed7 Implement support for indicating the stability of items.
There are 6 new compiler recognised attributes: deprecated, experimental,
unstable, stable, frozen, locked (these levels are taken directly from
Node's "stability index"[1]). These indicate the stability of the
item to which they are attached; e.g. `#[deprecated] fn foo() { .. }`
says that `foo` is deprecated.

This comes with 3 lints for the first 3 levels (with matching names) that
will detect the use of items marked with them (the `unstable` lint
includes items with no stability attribute). The attributes can be given
a short text note that will be displayed by the lint. An example:

    #[warn(unstable)]; // `allow` by default

    #[deprecated="use `bar`"]
    fn foo() { }

    #[stable]
    fn bar() { }

    fn baz() { }

    fn main() {
        foo(); // "warning: use of deprecated item: use `bar`"

        bar(); // all fine

        baz(); // "warning: use of unmarked item"
    }

The lints currently only check the "edges" of the AST: i.e. functions,
methods[2], structs and enum variants. Any stability attributes on modules,
enums, traits and impls are not checked.

[1]: http://nodejs.org/api/documentation.html
[2]: the method check is currently incorrect and doesn't work.
2013-09-04 00:12:27 +10:00
Marvin Löbel
7419085337 Modernized a few more types in syntax::ast 2013-09-03 14:45:06 +02:00
Daniel Micay
09ad0cd362 add type name to the tydesc
Closes #8926
2013-09-03 04:44:47 -04:00
Alex Crichton
36a4af49e0 Remove __extensions__ in names for a "pretty name"
As with the previous commit, this is targeted at removing the possibility of
collisions between statics. The main use case here is when there's a
type-parametric function with an inner static that's compiled as a library.
Before this commit, any impl would generate a path item of "__extensions__".
This changes this identifier to be a "pretty name", which is either the last
element of the path of the trait implemented or the last element of the type's
path that's being implemented.  That doesn't quite cut it though, so the (trait,
type) pair is hashed and again used to append information to the symbol.

Essentially, __extensions__ was removed for something nicer for debugging, and
then some more information was added to symbol name by including a hash of the
trait being implemented and type it's being implemented for. This should prevent
colliding names for inner statics in regular functions with similar names.
2013-09-02 23:12:41 -07:00
Daniel Micay
331d2d6d31 repr: handle tuple structs sanely
Closes #8919
2013-09-02 04:10:56 -04:00
Daniel Micay
cc1f0027c7 repr: add support for trait objects
Closes #8916
2013-09-02 02:50:14 -04:00
Marvin Löbel
857f867320 Renamed syntax::ast::ident -> Ident 2013-09-02 02:51:21 +02:00
Marvin Löbel
539f37925c Modernized a few type names in rustc and syntax 2013-09-01 14:43:26 +02:00
bors
a60c6a8b18 auto merge of #8903 : luqmana/rust/en, r=thestinger
Fixes #8735.
2013-08-31 16:25:40 -07:00
bors
04fac7f90d auto merge of #8899 : thestinger/rust/repr, r=huonw 2013-08-31 15:15:40 -07:00
Luqman Aden
ba5f101fa9 librustc: Add export_name attribute to specify symbol name. 2013-08-31 13:23:31 -04:00
Daniel Micay
874611b348 repr: print the name of structs 2013-08-31 03:54:13 -04:00
bors
29449e355a auto merge of #8889 : erickt/rust/cleanup, r=catamorphism
This fixes a couple minor things I've been sitting on. It cleans up some warnings, CapCases some types in librustc's rscope module, and adds a fixme.
2013-08-30 17:20:36 -07:00
Erick Tryzelaar
66e3a4c50e rustc: capitalize types in rscope.rs 2013-08-30 15:10:55 -07:00
Tim Chevalier
8464ee04a4 rustc: Change a stray error! statement to debug! 2013-08-30 14:31:52 -07:00
bors
f9142536a6 auto merge of #8869 : alexcrichton/rust/issue-8847-fix-unused, r=huonw
Closes #8847
2013-08-30 07:35:40 -07:00
bors
f10e50a4be auto merge of #8843 : alexcrichton/rust/fix-bug, r=huonw
Whenever a generic function was encountered, only the top-level items were
recursed upon, even though the function could contain items inside blocks or
nested inside of other expressions. This fixes the existing code from traversing
just the top level items to using a Visitor to deeply recurse and find any items
which need to be translated.

This was uncovered when building code with --lib, because the encode_symbol
function would panic once it found that an item hadn't been translated.

Closes #8134
2013-08-30 02:25:47 -07:00
bors
f94844c558 auto merge of #8820 : alexcrichton/rust/no-io-writer, r=brson
At the same time, this updates the TyVisitor to use a mutable self because it's
probably going to be mutating state as it goes along anyway.
2013-08-30 01:20:44 -07:00
Alex Crichton
6409f6bcf1 Correct the sources of glob imports
Closes #8847
2013-08-29 19:54:10 -07:00
Alex Crichton
2c1d6568f2 Fix a bug with statics inside blocks in generic fns
Whenever a generic function was encountered, only the top-level items were
recursed upon, even though the function could contain items inside blocks or
nested inside of other expressions. This fixes the existing code from traversing
just the top level items to using a Visitor to deeply recurse and find any items
which need to be translated.

This was uncovered when building code with --lib, because the encode_symbol
function would panic once it found that an item hadn't been translated.

Closes #8134
2013-08-29 18:51:29 -07:00
Alex Crichton
97f61e7bbe Remove @io::Writer from sys/repr/reflect
At the same time, this updates the TyVisitor to use a mutable self because it's
probably going to be mutating state as it goes along anyway.
2013-08-28 23:00:46 -07:00
bors
7971c46c44 auto merge of #8718 : bblum/rust/typeof, r=pcwalton
r? anybody
2013-08-28 15:30:38 -07:00
bors
64ed3721f7 auto merge of #8807 : alexcrichton/rust/remove-two-offsets, r=thestinger
Everything that we do is actually inbounds, so there's no reason for us to be exposing two of these functions
2013-08-28 11:00:41 -07:00
bors
9708ef03a6 auto merge of #8806 : klutzy/rust/winmain, r=cmr
Fixes #8510.
2013-08-28 07:25:42 -07:00
Alex Crichton
e3662b1880 Remove offset_inbounds for an unsafe offset function 2013-08-27 23:22:52 -07:00
klutzy
eaa565829d rustc: Use "main" entry point on Windows
Fixes #8510.
2013-08-28 13:43:11 +09:00
Patrick Walton
aac9d6eee9 librustc: Fix merge fallout 2013-08-27 19:09:27 -07:00