about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2016-04-28Auto merge of #33208 - nrc:save-json, r=pnkfelixbors-280/+905
save-analysis: dump in JSON format cc #18582
2016-04-28Auto merge of #33161 - jseyfried:parse_tuple_struct_field_vis, r=nikomatsakisbors-7/+108
Parse `pub(restricted)` visibilities on tuple struct fields Parse `pub(restricted)` on tuple struct fields (cc #32409). r? @nikomatsakis
2016-04-28Auto merge of #32980 - Aatch:better-mir-building, r=nagisabors-182/+298
Various improvements to MIR and LLVM IR Construction Primarily affects the MIR construction, which indirectly improves LLVM IR generation, but some LLVM IR changes have been made too. * Handle "statement expressions" more intelligently. These are expressions that always evaluate to `()`. Previously a temporary would be generated as a destination to translate into, which is unnecessary. This affects assignment, augmented assignment, `return`, `break` and `continue`. * Avoid inserting drops for non-drop types in more places. Scheduled drops were already skipped for types that we knew wouldn't need dropping at construction time. However manually-inserted drops like those for `x` in `x = y;` were still generated. `build_drop` now takes a type parameter like its `schedule_drop` counterpart and checks to see if the type needs dropping. * Avoid generating an extra temporary for an assignment where the types involved don't need dropping. Previously an expression like `a = b + 1;` would result in a temporary for `b + 1`. This is so the RHS can be evaluated, then the LHS evaluated and dropped and have everything work correctly. However, this isn't necessary if the `LHS` doesn't need a drop, as we can just overwrite the existing value. * Improves lvalue analysis to allow treating an `Rvalue::Use` as an operand in certain conditions. The reason for it never being an operand is so it can be zeroed/drop-filled, but this is only true for types that need dropping. The first two changes result in significantly fewer MIR blocks being generated, as previously almost every statement would end up generating a new block due to the drop of the `()` temporary being generated.
2016-04-28update features RFCErgenekon Yigit-1/+1
2016-04-28update comments RFC and code snippetsErgenekon Yigit-2/+20
2016-04-27Auto merge of #33151 - ollie27:rustdoc_abi, r=alexcrichtonbors-15/+43
rustdoc: Cleanup ABI rendering Use a common method for rendering `extern "<abi>"`. This now consistently shows `extern fn` rather than `extern "C" fn`.
2016-04-28Address style nitsJeffrey Seyfried-5/+7
2016-04-28Fix a typo in error messages in std::fs testsSimon Wollwage-2/+2
2016-04-27Auto merge of #32791 - LeoTestard:feature-gate-clean, r=nikomatsakisbors-676/+625
Feature gate clean This PR does a bit of cleaning in the feature-gate-handling code of libsyntax. It also fixes two bugs (#32782 and #32648). Changes include: * Change the way the existing features are declared in `feature_gate.rs`. The array of features and the `Features` struct are now defined together by a single macro. `featureck.py` has been updated accordingly. Note: there are now three different arrays for active, removed and accepted features instead of a single one with a `Status` item to tell wether a feature is active, removed, or accepted. This is mainly due to the way I implemented my macro in the first time and I can switch back to a single array if needed. But an advantage of the way it is now is that when an active feature is used, the parser only searches through the list of active features. It goes through the other arrays only if the feature is not found. I like to think that error checking (in this case, checking that an used feature is active) does not slow down compilation of valid code. :) But this is not very important... * Feature-gate checking pass now use the `Features` structure instead of looking through a string vector. This should speed them up a bit. The construction of the `Features` struct should be faster too since it is build directly when parsing features instead of calling `has_feature` dozens of times. * The MacroVisitor pass has been removed, it was mostly useless since the `#[cfg]-stripping` phase happens before (fixes #32648). The features that must actually be checked before expansion are now checked at the time they are used. This also allows us to check attributes that are generated by macro expansion and not visible to MacroVisitor, but are also removed by macro expansion and thus not visible to PostExpansionVisitor either. This fixes #32782. Note that in order for `#[derive_*]` to be feature-gated but still accepted when generated by `#[derive(Trait)]`, I had to do a little bit of trickery with spans that I'm not totally confident into. Please review that part carefully. (It's in `libsyntax_ext/deriving/mod.rs`.):: Note: this is a [breaking change], since programs with feature-gated attributes on macro-generated macro invocations were not rejected before. For example: ```rust macro_rules! bar ( () => () ); macro_rules! foo ( () => ( #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps bar!(); ); ); ``` foo!();
2016-04-28Factor out function call checking to a helper methodJames Miller-49/+30
The logic for checking `call` and `invoke` instructions was duplicated between them, so factor it out to a helper method.
2016-04-28Check when building invoke as well as callsJames Miller-15/+41
LLVM's assertion doesn't provide much insight as to what the problem was. We were already checking `call` instructions ourselves, so this brings the checks from there to `invoke`. Both the `invoke` and `call` checking is controlled by `debug_assertions`.
2016-04-28Handle immediate tuples in `trans_arguments_untupled`James Miller-36/+36
Use either getelementptr or extractvalue depending on whether or not the tuple is immediate or not.
2016-04-28Fix codegen-units testsJames Miller-6/+2
I'm not sure what the signficance of `drop-glue i8` is, nor why one of the tests had it appear while the others had it disappear. Either way it doesn't seem like the presence or absense of it is the focus of the tests.
2016-04-28Move zero-sized type handling logic to `new_operand`James Miller-14/+17
`new_operand` now checks the type it's given and either creates the nil value itself, or produces an empty operand.
2016-04-28Fix translation of `Assign`/`AssignOp` as rvaluesJames Miller-2/+9
In code like `let x = y = z;`, `y = z` goes through `as_rvalue`, which didn't handle it. Now it translates the assignment and produces `()` directly.
2016-04-28Fixup testsJames Miller-6/+0
The drop glue for `i8` is no longer generated as a trans item
2016-04-28Address commentsJames Miller-142/+163
Moves `stmt_expr` into its own module, `expr::stmt`.
2016-04-28Various improvements to MIR and LLVM IR ConstructionJames Miller-107/+195
Primarily affects the MIR construction, which indirectly improves LLVM IR generation, but some LLVM IR changes have been made too. * Handle "statement expressions" more intelligently. These are expressions that always evaluate to `()`. Previously a temporary would be generated as a destination to translate into, which is unnecessary. This affects assignment, augmented assignment, `return`, `break` and `continue`. * Avoid inserting drops for non-drop types in more places. Scheduled drops were already skipped for types that we knew wouldn't need dropping at construction time. However manually-inserted drops like those for `x` in `x = y;` were still generated. `build_drop` now takes a type parameter like its `schedule_drop` counterpart and checks to see if the type needs dropping. * Avoid generating an extra temporary for an assignment where the types involved don't need dropping. Previously an expression like `a = b + 1;` would result in a temporary for `b + 1`. This is so the RHS can be evaluated, then the LHS evaluated and dropped and have everything work correctly. However, this isn't necessary if the `LHS` doesn't need a drop, as we can just overwrite the existing value. * Improves lvalue analysis to allow treating an `Rvalue::Use` as an operand in certain conditions. The reason for it never being an operand is so it can be zeroed/drop-filled, but this is only true for types that need dropping. The first two changes result in significantly fewer MIR blocks being generated, as previously almost every statement would end up generating a new block due to the drop of the `()` temporary being generated.
2016-04-27Add testsJeffrey Seyfried-0/+70
2016-04-27Auto merge of #33199 - mitaa:tokenize-responsibly, r=nrcbors-74/+148
Make some fatal lexer errors recoverable I've kept the changes to a minimum since I'm not really sure if this approach is a acceptable. fixes #12834 cc @nrc
2016-04-27Make some fatal lexer errors recoverablemitaa-74/+148
2016-04-27rustdoc: Render `extern fn` instead of `extern "C" fn`Oliver Middleton-8/+9
2016-04-28Review changes and satisfy make tidyNick Cameron-51/+51
2016-04-27std: Add compatibility with android-9Alex Crichton-36/+138
The Gecko folks currently use Android API level 9 for their builds, so they're requesting that we move back our minimum supported API level from 18 to 9. Turns out, ABI-wise at least, there's not that many changes we need to take care of. The `ftruncate64` API appeared in android-12 and the `log2` and `log2f` APIs appeared in android-18. We can have a simple shim for `ftruncate64` which falls back on `ftruncate` and the `log2` function can be approximated with just `ln(f) / ln(2)`. This should at least get the standard library building on API level 9, although the tests aren't quite happening there just yet. As we seem to be growing a number of Android compatibility shims, they're now centralized in a common `sys::android` module.
2016-04-27Auto merge of #33214 - oli-obk:const_err_var_exprs, r=eddybbors-67/+116
report `const_err` on all expressions that can fail also a drive-by fix for reporting an "overflow in shift *left*" when shifting an `i64` *right* This increases the warning noise for shifting by more than the bitwidth and for `-T::MIN`. I can silence the bitwidth warnings explicitly and fix the const evaluator to make sure `--$expr` is treated exactly like `$expr` (which is kinda wrong, but mathematically right). r? @eddyb
2016-04-27Fix use of the `move` command in the Windows shellTomáš Hübelbauer-1/+1
`move` work both in `cmd` and in Powershell. `mv` works only in Powershell and the book says nothing about which shell is recommended so this could confuse beginners. Closes #33219.
2016-04-27rustc_driver: Allow running the compiler with a FileLoaderAdolfo Ochagavía-10/+34
2016-04-27update Cargo.toml for rustbuildOliver Schneider-0/+1
2016-04-27Avoid using the hir map when visibility checking in `resolve`Jeffrey Seyfried-16/+44
Refactor `ty::Visibility` methods to use a new trait `NodeIdTree` instead of the ast map.
2016-04-27Refactor away a use of `ast_map.span_if_local()`Jeffrey Seyfried-3/+13
2016-04-26std: Allow creating ExitStatus from raw valuesAlex Crichton-0/+42
Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-04-26Auto merge of #33226 - fabricedesre:update-llvm, r=alexcrichtonbors-1/+1
Update llvm to 751345228a0ef03fd147394bb5104359b7a808be Picking up the changes from https://github.com/rust-lang/llvm/commit/751345228a0ef03fd147394bb5104359b7a808be r? @alexcrichton
2016-04-27Refactor `resolve_crate_relative_path` and `resolve_module_relative_path`Jeffrey Seyfried-12/+16
to return a `NameBinding` instead of a `Def`
2016-04-27Refactor away `get_trait_name`Jeffrey Seyfried-13/+4
2016-04-27Refactor away `is_static_method`Jeffrey Seyfried-25/+10
2016-04-27Refactor away `FallbackChecks` and remove dead codeJeffrey Seyfried-63/+6
2016-04-27Refactor field `span` of `NameBinding` from `Option<Span>` to `Span`.Jeffrey Seyfried-14/+13
2016-04-26Update llvm to 751345228a0ef03fd147394bb5104359b7a808beFabrice Desré-1/+1
2016-04-26Auto merge of #31414 - durka:clone-copy, r=alexcrichtonbors-40/+203
special-case #[derive(Copy, Clone)] with a shallow clone If a type is Copy then its Clone implementation can be a no-op. Currently `#[derive(Clone)]` generates a deep clone anyway. This can lead to lots of code bloat. This PR detects the case where Copy and Clone are both being derived (the general case of "is this type Copy" can't be determined by a syntax extension) and generates the shallow Clone impl. Right now this can only be done if there are no type parameters (see https://github.com/rust-lang/rust/issues/31085#issuecomment-178988663), but this restriction can be removed after specialization. Fixes #31085.
2016-04-26Auto merge of #33191 - alexcrichton:rustdoc-create-dir-all-racy, r=steveklabnikbors-6/+9
rustdoc: Handle concurrent mkdir requests It's likely that `rustdoc` as a tool is run concurrently in the same output (e.g. documenting multiple crates as Cargo does), in which case it needs to handle concurrent calls to `fs::create_dir`.
2016-04-26shallow Clone for #[derive(Copy,Clone)]Alex Burka-40/+203
Changes #[derive(Copy, Clone)] to use a faster impl of Clone when both derives are present, and there are no generics in the type. The faster impl is simply returning *self (which works because the type is also Copy). See the comments in libsyntax_ext/deriving/clone.rs for more details. There are a few types which are Copy but not Clone, in violation of the definition of Copy. These include large arrays and tuples. The very existence of these types is arguably a bug, but in order for this optimization not to change the applicability of #[derive(Copy, Clone)], the faster Clone impl also injects calls to a new function, core::clone::assert_receiver_is_clone, to verify that all members are actually Clone. This is not a breaking change, because pursuant to RFC 1521, any type that implements Copy should not do any observable work in its Clone impl.
2016-04-26Auto merge of #33142 - tshepang:split-long-line, r=guillaumegomezbors-2/+2
doc: that line was too long
2016-04-26Update references-and-borrowing.mdKaiyin Zhong-0/+18
add as 2nd example.
2016-04-26allow InternedString to be compared to &str directlyOliver Schneider-3/+25
2016-04-26Auto merge of #33203 - Ryman:patch-3, r=alexcrichtonbors-2/+2
libstd: fix typos in thread::LocalKey docs
2016-04-26don't demote expressions just because const_eval failsOliver Schneider-1/+39
this might introduce subtle bugs to code generation
2016-04-26skip non-const-path errors for nowOliver Schneider-1/+4
Associated constants aren't implemented fully in early const eval
2016-04-26don't report bitshift overflow twiceOliver Schneider-22/+6
2016-04-26skip double negation in const evalOliver Schneider-39/+45
2016-04-26Auto merge of #32989 - GuillaumeGomez:e0393, r=Manishearthbors-2/+31
Add E0393 error explanation Part of #32777. r? @Manishearth cc @steveklabnik