Commit Graph

882 Commits

Author SHA1 Message Date
Patrick Walton
4991cc5d19 rustc: Translate by-value pattern bindings 2012-08-01 15:24:11 -07:00
Lindsey Kuper
300e2b8513 Start adding infrastructure for checking trait method bodies. 2012-08-01 11:08:47 -07:00
Lindsey Kuper
d747cd724e Rename convert_class_item to convert_field. 2012-08-01 11:08:47 -07:00
Lindsey Kuper
91bd291009 Fix bad indentation. 2012-08-01 11:08:46 -07:00
Lindsey Kuper
ac4e57c640 Introduce self_info (self_ty packaged up with a node_id). 2012-08-01 11:08:46 -07:00
Lindsey Kuper
361a9b03e6 Fix inaccurate comment. 2012-08-01 11:08:46 -07:00
Niko Matsakis
a334deb5d5 change how we print and explain region types 2012-07-31 22:00:19 -07:00
Patrick Walton
b414db041b rustc: Parse by-reference pattern bindings with the "ref" keyword 2012-07-31 19:26:25 -07:00
Brian Anderson
a841789a41 rustc: Add non_camel_case_types lint check 2012-07-31 18:58:23 -07:00
Graydon Hoare
2a3084b527 Start implementing structured constants. 2012-07-31 18:34:44 -07:00
Patrick Walton
c88933d714 rustc: Implement unary move. Closes #917. 2012-07-31 17:33:20 -07:00
Brian Anderson
7b2026bf21 Introduce 'return', 'match' and 'module' as synonyms 2012-07-31 17:22:30 -07:00
Patrick Walton
2cfe8fb357 rustc: Check self types in method lookup; allow required trait methods to have self types; write self types into metadata 2012-07-31 16:35:11 -07:00
Lindsey Kuper
439afaa329 Change remaining "iface" occurrences to "trait"; deprecate "iface" 2012-07-31 11:52:16 -07:00
Graydon Hoare
290f079474 Frontend bits for #2317, general const-expr classification. 2012-07-30 19:06:06 -07:00
Paul Stansifer
a9cc5066ee Change syntax extension syntax: #m[...] -> m!{...}. 2012-07-30 18:38:15 -07:00
Paul Stansifer
e040ab8423 Impl-ize interner. 2012-07-30 18:04:19 -07:00
Lindsey Kuper
f78776e9d8 rustc: "iface" -> "trait" in comments, error messages, and identifiers.
(Also "interface" -> "trait" in error messages.)
2012-07-30 17:26:14 -07:00
Lindsey Kuper
dbd39f868b rustc: "ifce" -> "trt" in identifiers 2012-07-30 17:26:14 -07:00
Niko Matsakis
5d32d03b89 Fix #2979: inference for lifetimes of & expressions
What we now do is to create a region variable for each &
expression (and also each borrow).  The lifetime of this
variable will be checked by borrowck to ensure it is not greater
than the lifetime of the underlying data.  This both leads to
shorter lifetimes in some cases but also longer in others,
such as taking the address to the interior of unique boxes
tht are rooted in region pointers (e.g., returning a pointer
to the interior of a sendable map).

This may lead to issue #2977 if the rvalue is not POD, because
we may drop the data in trans sooner than borrowck expects us
to.  Need to work out precisely where that fix ought to occur.
2012-07-30 14:49:28 -07:00
Patrick Walton
519deca716 rustc: Make option<&foo> no longer cause LLVM asserts by getting rid of regions in normalize_ty 2012-07-30 11:28:43 -07:00
Brian Anderson
2e231fbcb7 LONG LINES\! 2012-07-30 11:26:20 -07:00
Damian Gryski
1854a736f8 rustc: use new siphash impl instead of sha1
Updating types std::sha1::sha1 -> hash::streaming was a relatively
    small change.  Renaming the variables to reflect that things aren't
    sha1s any more touched far more lines.
2012-07-30 10:46:01 -07:00
Tim Chevalier
082d8314da Rewrite bitv to use classes and optimize its representation
Rewrote bitv as a class that uses a 32-bit int as its representation
for bit vectors of 32 bits or less, and a vector (the old representation)
otherwise. I didn't benchmark very much, but a bit of informal benchmarking
suggested this is a win.

Closes #2341
2012-07-29 18:39:15 -07:00
Patrick Walton
93c2f5e0e4 rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
2012-07-27 19:35:24 -07:00
Tim Chevalier
f7382c454f Forbid duplicate fields in record types and exprs
Closes #3033
2012-07-27 17:33:05 -07:00
Tim Chevalier
a0d05844ed Correctly forbid upvars in nested impls, traits and classes
Previously, resolve was allowing impls, traits or classes that were
nested within a fn to refer to upvars, as well as referring to type
parameters bound by the fn. Fixing this required adding a new kind of
def: def_typaram_binder, which can refer to any of an impl, trait or
class that has bound ty params. resolve uses this to enforce that
methods can refer to their parent item's type parameters, but not to
outer items' type parameters; other stages ignore it. I also made
sure that impl, trait and class methods get checked inside a
MethodRibKind thing so as to forbid upvars, and changed the definition
of MethodRibKind so that its second argument is an optional node_id
(so that required trait method signatures can be checked with a
MethodRibKind as well).
2012-07-27 17:31:42 -07:00
Niko Matsakis
638491712e change region inference to not consider & that appears in a fn
type as indicating region parameterization
2012-07-27 15:49:03 -07:00
Patrick Walton
01e2471cb7 core: Trait-ify various overloaded operators 2012-07-27 14:52:46 -07:00
Tim Chevalier
b6aadf56c8 In resolve, check for duplicate pattern-bound vars
Closes #3038
2012-07-27 13:35:17 -07:00
Tim Chevalier
300f54ebc0 Make alts on uninhabited enum types typecheck and translate properly
Possibly one of the silliest Rust commits ever.

Closes #3037
2012-07-27 13:14:03 -07:00
Eric Holk
6d142c5e25 Removed the rest of the vec::view calls that were marked with #2880. Fixes #2880. 2012-07-26 17:10:48 -07:00
Eric Holk
65beca4e01 Use iteration protocol for ebml, use vec::view in more places (issue #2880) 2012-07-26 17:10:48 -07:00
Graydon Hoare
dbbaa50290 Nomenclature fixes in the lint checker. Fewer double-negatives.
New style is allow(foo), warn(foo), deny(foo) and forbid(foo),
mirrored by -A foo, -W foo, -D foo and -F foo on command line.

These replace -W no-foo, -W foo, -W err-foo, respectively.

Forbid is new, and means "deny, and you can't override it".
2012-07-26 17:08:33 -07:00
Patrick Walton
afd9a75c9e rustc: Fix cross-crate max/min-class-style constructors 2012-07-26 15:30:15 -07:00
Patrick Walton
da80bd17c3 rustc: Introduce a lang_items pass, part of coherence and operator overloading.
This will also help us remove kinds.
2012-07-25 18:37:03 -07:00
Eric Holk
e1d4bd463c 3x faster typechecking 2012-07-25 18:00:29 -07:00
Eric Holk
3aee39a6ec Add #[inline(never)], and also fixed inlining on vec::push 2012-07-25 17:30:13 -07:00
Niko Matsakis
4b8d0539f9 adjust deprecated_use not to warn about sugared closures 2012-07-25 10:19:28 -07:00
Niko Matsakis
cc8086a045 add new deprecated_mode lint pass
It will warn you if you use the default mode for something that
is expensive to copy, and it will warn you if you use any explicit
mode other than copy.  So you should migrate over to using the
default mode for most things (and borrowed pointers when you don't
want to copy) and copy mode for things you really wanted to copy.
2012-07-25 09:19:02 -07:00
Niko Matsakis
99674dc52b avoid capture of bound regions when infering types for closure
expressions. cc #2981
2012-07-25 05:45:52 -07:00
Niko Matsakis
2d3a197f0e comment various region-related things better 2012-07-25 05:45:52 -07:00
Niko Matsakis
7022ede9b3 make unique pointers inherit mutability from owner 2012-07-25 05:45:52 -07:00
Niko Matsakis
168306f11b correct treatment of mutability for deref'd components
Fixes #2980
2012-07-25 05:45:52 -07:00
Patrick Walton
587b0edbbf rustc: Don't require that structs have constructors 2012-07-24 15:29:51 -07:00
Patrick Walton
32e8429341 rustc: Translate struct literals 2012-07-24 13:59:17 -07:00
Graydon Hoare
539a160bb7 Merge pull request #3003 from elliottslaughter/free-cant-fail
Don't emit invoke instructions inside landing pads.
2012-07-24 13:49:24 -07:00
Graydon Hoare
8868b222c3 Fix whitespace. 2012-07-24 13:21:25 -07:00
Graydon Hoare
a63e0e47f0 Update some str functions to slices, merge as_buf and unpack_slice. 2012-07-24 12:35:52 -07:00
Elliott Slaughter
c341eb9052 Don't emit invoke instructions inside landing pads.
We can't throw an exception from inside a landing pad without
corrupting the exception handler, so we have no hope of dealing with
these exceptions anyway. See:

http://llvm.org/docs/ExceptionHandling.html#cleanups

Part of #2861.
2012-07-24 12:20:39 -07:00