about summary refs log tree commit diff
path: root/src/librustc_trans
AgeCommit message (Collapse)AuthorLines
2017-09-04Auto merge of #43067 - pornel:libdeps, r=nrcbors-5/+43
Compact display of static lib dependencies Fixes #33173 Instead of displaying one dependency per line, I've changed the format to display them all in one line. As a bonus they're in format of linker flags (`-lfoo`), so the output can be copy&pasted if one is actually going to link as suggested.
2017-09-04rustc_mir: use Local instead of Lvalue in Storage{Live,Dead}.Eduard-Mihai Burtescu-9/+7
2017-09-03rustc_mir: use Local in ProjectionElem::Index.Eduard-Mihai Burtescu-2/+4
2017-09-03rustc_mir: implement visit_local instead/along visit_lvalue where possible.Eduard-Mihai Burtescu-38/+39
2017-09-02Minor compilation fixKornel-1/+1
2017-09-01x86: return single-float aggregates in a float registerJosh Stone-6/+35
Following Clang's lead, and anecdotal evidence from the `float_one` part of `run-make/extern-fn-struct-passing-abi`, use a floating point register to return single-float aggregates, except on MSVC targets.
2017-09-01powerpc64: improve extern struct ABIJosh Stone-13/+51
These fixes all have to do with the 64-bit PowerPC ELF ABI for big-endian targets. The ELF v2 ABI for powerpc64le already worked well. - Return after marking return aggregates indirect. Fixes #42757. - Pass one-member float aggregates as direct argument values. - Aggregate arguments less than 64-bit must be written in the least- significant bits of the parameter space. - Larger aggregates are instead padded at the tail. (i.e. filling MSBs, padding the remaining LSBs.) New tests were also added for the single-float aggregate, and a 3-byte aggregate to check that it's filled into LSBs. Overall, at least these formerly-failing tests now pass on powerpc64: - run-make/extern-fn-struct-passing-abi - run-make/extern-fn-with-packed-struct - run-pass/extern-pass-TwoU16s.rs - run-pass/extern-pass-TwoU8s.rs - run-pass/struct-return.rs
2017-08-30Auto merge of #43968 - petrochenkov:span2, r=michaelwoeristerbors-8/+8
Make fields of `Span` private I actually tried to intern spans and benchmark the result<sup>*</sup>, and this was a prerequisite. This kind of encapsulation will be a prerequisite for any other attempt to compress span's representation, so I decided to submit this change alone. The issue https://github.com/rust-lang/rust/issues/43088 seems relevant, but it looks like `SpanId` won't be able to reuse this interface, unless the tables are global (like interner that I tried) and are not a part of HIR. r? @michaelwoerister anyway <sup>*</sup> Interning means 2-3 times more space is required for a single span, but duplicates are free. In practice it turned out that duplicates are not *that* common, so more memory was wasted by interning rather than saved.
2017-08-30Auto merge of #43903 - oli-obk:alignto, r=aturonbors-0/+12
Add align_offset intrinsic see https://github.com/rust-lang/rfcs/pull/2043 for details and the plan towards stabilization (reexport in `core::mem` via various convenience functions) as per @scottmcm 's [comment](https://github.com/rust-lang/rfcs/pull/2043#issuecomment-316818169), this is just the intrinsic (which is obviously unstable).
2017-08-30Make fields of `Span` privateVadim Petrochenkov-8/+8
2017-08-29Auto merge of #44049 - alexcrichton:nounwind-allocators, r=BurntSushibors-0/+2
std: Mark allocation functions as nounwind This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-28std: Mark allocation functions as nounwindAlex Crichton-0/+2
This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-6/+23
2017-08-27Auto merge of #44060 - taleks:issue-43205, r=arielb1bors-3/+23
Fixes issue #43205: ICE in Rvalue::Len evaluation. - fixes evaluation of array length for zero-sized type referenced by rvalue operand. - adds test to verify fix. *Cause of the issue*. Zero-sized aggregates are handled as operands, not lvalues. Therefore while visiting `Assign` statement by `LocalAnalyser`, `mark_as_lvalue()` is not called for related `Local`. This behaviour is controlled by `rvalue_creates_operand()` method. As result it causes error later, when rvalue operand is evaluated in `trans_rvalue_operand()` while handling `Rvalue::Len` case. Array length evaluation invokes `trans_lvalue()` which expects referenced `Local` to be value, not operand. *How it is fixed*. In certain cases result of `Rvalue::Len` can be evaluated without calling `trans_lvalue()`. Method `evaluate_array_len()` is introduced to handle length evaluation for zero-sized types referenced by Locals. *Some concerns*. - `trans_lvalue()` has two other entry points in `rvalue.rs`: it is invoked while handling `Rvalue::Ref` and `Rvalue::Discriminant`. There is a chance those may produce the same issue, but I've failed to write a specific test that leads to this. - `evaluate_array_len()` performs the same check (matches lvalue and `Local`), which is performed again in `trans_lvalue()`. Without changing `trans_lvalue()` signature to make it aware that caller deals with rvalue, it seems there is no cheap solution to avoid this check.
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-3/+15
2017-08-23Fixes issue #43205: ICE in Rvalue::Len evaluation.Alexey Tarasov-3/+23
- fixes evaluation of array length for zero-sized type referenced by rvalue operand. - adds test to verify fix. Cause of the issue. Zero-sized aggregates are handled as operands, not lvalues. Therefore while visiting Assign statement by LocalAnalyser, mark_as_lvalue() is not called for related Local. This behaviour is controlled by rvalue_creates_operand() method. As result it causes error later, when rvalue operand is evaluated in trans_rvalue_operand() while handling Rvalue::Len case. Array length evaluation invokes trans_lvalue() which expects referenced Local to be value, not operand. How it is fixed. In certain cases result of Rvalue::Len can be evaluated without calling trans_lvalue(). Method evaluate_array_len() is introduced to handle length evaluation for zero-sized types referenced by Locals.
2017-08-22Tell the linker when we want to link a static executableSamuel Holland-2/+14
If the C runtime is linked statically, explicitly tell the linker that the executable should be static.
2017-08-22Disable PIE when linking staticallySamuel Holland-1/+1
Static PIE support, while supported on musl, requires a patch to GCC. Until/unless it is merged, adding '-pie' to the linker command line will override '-static' and create a binary that requires a dynamic interpreter (ld.so).
2017-08-22--print=native-static-libsKornel-1/+37
2017-08-22Split print functionKornel-4/+6
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-4/+14
2017-08-22Auto merge of #43690 - scalexm:issue-28229, r=nikomatsakisbors-4/+14
Generate builtin impls for `Clone` This fixes a long-standing ICE and limitation where some builtin types implement `Copy` but not `Clone` (whereas `Clone` is a super trait of `Copy`). However, this PR has a few side-effects: * `Clone` is now marked as a lang item. * `[T; N]` is now `Clone` if `T: Clone` (currently, only if `T: Copy` and for `N <= 32`). * `fn foo<'a>() where &'a mut (): Clone { }` won't compile anymore because of how bounds for builtin traits are handled (e.g. same thing currently if you replace `Clone` by `Copy` in this example). Of course this function is unusable anyway, an error would pop as soon as it is called. Hence, I'm wondering wether this PR would need an RFC... Also, cc-ing @nikomatsakis, @arielb1. Related issues: #28229, #24000.
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-131/+10
2017-08-21Add align_offset intrinsicOliver Schneider-0/+12
see https://github.com/rust-lang/rfcs/pull/2043 for details
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-131/+10
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-6/+6
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-6/+6
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-105/+105
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-105/+105
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-6/+6
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-5/+9
2017-08-14Rename `BuiltinShim` -> `CloneShim`scalexm-6/+6
2017-08-14Do not store `ty`scalexm-2/+2
2017-08-14Make `Clone` a lang item and generate builtin impls.scalexm-4/+14
Fixes #28229. Fixes #24000.
2017-08-13Auto merge of #43836 - taleks:issue-39827, r=arielb1bors-1/+5
Fix for issue #39827 *Cause of the issue* While preparing for `trans_intrinsic_call()` invoke arguments are processed with `trans_argument()` method which excludes zero-sized types from argument list (to be more correct - all arguments for which `ArgKind` is `Ignore` are filtered out). As result `volatile_store()` intrinsic gets one argument instead of expected address and value. *How it is fixed* Modification of the `trans_argument()` method may cause side effects, therefore change was implemented in `volatile_store()` intrinsic building code itself. Now it checks function signature and if it was specialised with zero-sized type, then emits `C_nil()` instead of accessing non-existing second argument.
2017-08-13Addresses comments in PR #43836Alexey Tarasov-43/+3
- removes warnings introduced in changeset 0cd3587 - makes documentation more neat and grammatically correct
2017-08-12Fix some typosBastien Orivel-3/+3
2017-08-12Fixes issue 39827: ICE in volatile_store intrinsicAlexey Tarasov-4/+48
- adds handling of zero-sized types for volatile_store. - adds type size checks and warnigns for other volatile intrinsics. - adds a test to check warnings emitting. Cause of the issue While preparing for trans_intrinsic_call() invoke arguments are processed with trans_argument() method which excludes zero-sized types from argument list (to be more correct - all arguments for which ArgKind is Ignore are filtered out). As result volatile_store() intrinsic gets one argument instead of expected address and value. How it is fixed Modification of the trans_argument() method may cause side effects, therefore change was implemented in volatile_store() intrinsic building code itself. Now it checks function signature and if it was specialised with zero-sized type, then emits C_nil() instead of accessing non-existing second argument. Additionally warnings are added for all volatile operations which are specialised with zero-sized arguments. In fact, those operations are omitted in LLVM backend if no memory affected at all, e.g. number of elements is zero or type is zero-sized. This was not explicitly documented before and could lead to potential issues if developer expects volatile behaviour, but type has degraded to zero-sized.
2017-08-12Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperiobors-1/+1
Fix some typos I wrote a really naive script and found those typos in the documentation.
2017-08-12Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-120/+17
# Conflicts: # src/librustc_mir/build/scope.rs
2017-08-11Auto merge of #43766 - michaelwoerister:trans-scheduler-touch-up, r=alexcrichtonbors-0/+10
Improve LLVM/trans scheduling a bit Currently it's possible that the main thread is waiting on LLVM threads to finish work while its implicit token is going to waste. This PR let's the main thread take over, so one of the running LLVM threads can free its token earlier. r? @alexcrichton
2017-08-11Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+9
2017-08-11It now completely compiles without LLVM!!!bjorn3-1/+2
2017-08-11Actually make rustc_driver compile without llvmbjorn3-120/+6
2017-08-10Auto merge of #43589 - aidanhs:aphs-fix-system-malloc, r=alexcrichtonbors-0/+9
Make a disable-jemalloc build work Fixes #43510. I've tested this up to building a stage1 compiler. r? @alexcrichton cc @cuviper @vorner @cuviper your fix was almost correct, you just had a stray `!` in there which caused the second error you saw.
2017-08-11Fix some typosBastien Orivel-1/+1
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-4/+4
2017-08-10Fix cross-crate global allocators on windowsAidan Hobson Sayers-0/+9
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-4/+4
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.