Commit Graph

69576 Commits

Author SHA1 Message Date
bors
6e2977499b Auto merge of #45866 - JohnColanduoni:issue-45731, r=alexcrichton
Disable `mmap`  in `libbacktrace` on Apple platforms

Fixes #45731

libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.
2017-11-08 14:54:03 +00:00
Robin Kruppe
ef0b99930e Disable u128 <-> float tests on emscripten 2017-11-08 14:54:03 +01:00
Michael Woerister
d01b89b948 incr.comp.: Provide session to some more decoding contexts. 2017-11-08 14:52:00 +01:00
Michael Hewson
e06cd316a4 Remove the error check that I think is redundant, and change the test error messages that I don't understand why they changed, so the tests pass 2017-11-08 08:31:08 -05:00
Michael Hewson
02ce3ac1f8 add a NOTE comment to the object safety test so that it passes 2017-11-08 08:29:47 -05:00
Michael Hewson
bbe755c7a6 Switch from using At::eq to InferCtxt::can_eq and demand_eqtype_with_origin
I doubt this changes anything, I was just trying to fix an issue with
error messages and ended up doing this along with other things.
Committing it separately so I can undo it easily.
2017-11-08 08:28:36 -05:00
Michael Hewson
236974619f normalize associated types in both self_ty and self_arg_ty
I was only doing it for self_arg_ty, and ended up causing
run-pass/associated-types-projection-from-known-type-in-impl.rs to fail.
2017-11-08 08:24:33 -05:00
Guillaume Gomez
3d480b4138 Add missing example for Debug trait 2017-11-08 14:11:27 +01:00
bors
4bb96f6519 Auto merge of #45575 - michaelwoerister:tweak-inline-trans-items, r=nikomatsakis
Only instantiate inline- and const-fns if they are referenced (again).

It seems that we have regressed on not translating `#[inline]` functions unless they are actually used. This should bring back this optimization. I also added a regression test this time so it doesn't happen again accidentally.

Fixes #40392.

r? @alexcrichton

UPDATE & PSA
---------------------
This patch **makes translation very lazy** -- in general this is a good thing (we don't want the compiler to do unnecessary work) but it has two consequences:
1. Some error messages are only generated when an item is actually translated. Consequently, this patch will lead to more cases where the compiler will only start emitting errors when the erroneous function is actually used. This has always been true to some extend (e.g. when passing generic values to an intrinsic) but since this is something user-facing it's worth mentioning.
2. When writing tests, one has to make sure that the functions in question are actually generated. In other words, it must not be dead code. This can usually  be achieved by either
    1. making sure the function is exported from the resulting binary or
    2. by making sure the function is called from something that is exported (or `main()`).

Note that it depends on the crate type what functions are exported:
   1. For rlibs and dylibs everything that is reachable from the outside is exported.
   2. For executables, cdylibs, and staticlibs, items are only exported if they are additionally `#[no_mangle]` or have an `#[export_name]`.

The commits in this PR contain many examples of how tests can be updated to comply to the new requirements.
2017-11-08 12:23:34 +00:00
Michael Woerister
d948af1d37 incr.comp.: Remove unused DepKind::WorkProduct. 2017-11-08 11:44:55 +01:00
Michael Woerister
702ce8f0a6 incr.comp.: Remove outdated comment about TraitSelect dep-node. 2017-11-08 11:34:09 +01:00
Michael Woerister
13bc7ad476 incr.comp.: Always verify incr. comp. hashes when running incremental tests. 2017-11-08 11:33:06 +01:00
Michael Woerister
95b0849715 incr.comp.: Adapt nested_items test to new HIR hashing rules. 2017-11-08 11:32:16 +01:00
Michael Woerister
fde0ca5456 incr.comp.: Add some missing reads in HIR map. 2017-11-08 11:31:15 +01:00
Michael Woerister
616b45542b incr.comp.: Make DefSpan an input dep-node so it is not affected by the existing Span/HIR hashing hack. 2017-11-08 11:30:14 +01:00
Niko Matsakis
629efae761 look for the note on the guarantor, not the root cmt
This was causing upvar inference to fail for all cases where the move
was from a projection, not the root variable.
2017-11-08 05:29:03 -05:00
John Colanduoni
8581b59fb3 Disable mmap in libbacktrace on Apple platforms
Fixes #45731

libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.
2017-11-08 02:28:17 -08:00
Michael Hewson
3902643c27 move ExplicitSelf to rustc::ty::util, and use it to implement object safety checks 2017-11-08 05:27:39 -05:00
Michael Woerister
081ef8ed75 Update fastcall-inreg codegen test so that functions actually get instantiated. 2017-11-08 11:09:48 +01:00
bors
f733f484f8 Auto merge of #45862 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #45582, #45766, #45830, #45849
- Failed merges:
2017-11-08 09:43:27 +00:00
Niko Matsakis
dc6af49258 use the derived Debug rather than our custom written ones
That encoding that the custom Debugs was using is rather inscrutable,
and incomplete.
2017-11-08 04:43:13 -05:00
Michael Hewson
0b27dcc665 modify ExplicitSelf::determine to take an is_self_type predicate closure, instead of infcx 2017-11-08 04:31:48 -05:00
Lukas Kalbertodt
e65214441d Add Option::filter() according to RFC 2124 2017-11-08 10:23:12 +01:00
Guillaume Gomez
661c507a2e Rollup merge of #45849 - GuillaumeGomez:more-shortcut, r=QuietMisdreavus
Add "-" shortcut

Fixes #45847.

r? @Havvy
2017-11-08 10:09:18 +01:00
Guillaume Gomez
6392a164f0 Rollup merge of #45830 - pornel:dosglobs, r=dtolnay
Warn about lack of args glob expansion in Windows shell

Because all shells on Linux/macOS expand globs, and even MinGW on Windows emulates this behavior, it's easy to forget that Windows by itself doesn't support glob expansion. This PR documents this cross-platform difference.
2017-11-08 10:09:17 +01:00
Guillaume Gomez
1db95a2354 Rollup merge of #45766 - GuillaumeGomez:trait-methods-list, r=QuietMisdreavus
Add more elements in the sidebar

Fixes #45740.

r? @rust-lang/docs
2017-11-08 10:09:16 +01:00
Guillaume Gomez
0f6e0107c3 Rollup merge of #45582 - GuillaumeGomez:doc-unix-missing-links, r=frewsxcv
Add missing links and examples

r? @rust-lang/docs
2017-11-08 10:09:15 +01:00
bors
49bee9d09a Auto merge of #45735 - tirr-c:issue-45730, r=arielb1
Forbid casting to/from a pointer of unknown kind

Fixes #45730.

Before, it ICE'd when `pointer_kind` encountered `TyInfer`.
2017-11-08 07:12:15 +00:00
bors
e177df3d5c Auto merge of #45379 - cuviper:unit_from_iter, r=alexcrichton
impl FromIterator<()> for ()

This just collapses all unit items from an iterator into one.  This is
more useful when combined with higher-level abstractions, like
collecting to a `Result<(), E>` where you only care about errors:

```rust
use std::io::*;
data = vec![1, 2, 3, 4, 5];
let res: Result<()> = data.iter()
    .map(|x| writeln!(stdout(), "{}", x))
    .collect();
assert!(res.is_ok());
```
2017-11-08 01:32:12 +00:00
Guillaume Gomez
ac398a33a9 Add more elements in the sidebar 2017-11-07 23:45:06 +01:00
Guillaume Gomez
5e116985eb Add "-" shortcut 2017-11-07 22:44:18 +01:00
Nick Cameron
b98290cb1f save-analysis: run rustfmt 2017-11-08 10:43:05 +13:00
Nick Cameron
1328c29d4a save-analysis: fix bug with method ids
This just handles a missing entry, doesn't try to recover, because I couldn't actually find a test case.

cc https://github.com/rust-lang-nursery/rls/issues/558
2017-11-08 10:08:19 +13:00
bors
ee2286149a Auto merge of #44932 - cuviper:unsized-ptr-is_null, r=alexcrichton
Remove `T: Sized` on pointer `as_ref()` and `as_mut()`

`NonZero::is_zero()` was already casting all pointers to thin `*mut u8` to check for null.  The same test on unsized fat pointers can also be used with `as_ref()` and `as_mut()` to get fat references.

(This PR formerly changed `is_null()` too, but checking just the data pointer is not obviously correct for trait objects, especially if `*const self` sorts of methods are ever allowed.)
2017-11-07 20:55:01 +00:00
Nick Cameron
95937990c5 save-analysis: fix regression from #45709
closes https://github.com/nrc/rls-analysis/issues/117
2017-11-08 09:46:06 +13:00
Guillaume Gomez
cef0573734 Add missing links and examples 2017-11-07 20:42:26 +01:00
Michael Hewson
1d29966d3b wrap error code in DiagnosticId::Error so it compiles 2017-11-07 14:32:59 -05:00
Robin Kruppe
ce4664956f Clean up 2017-11-07 20:13:19 +01:00
Robin Kruppe
0a843df264 Implement more efficient saturation 2017-11-07 20:13:19 +01:00
Robin Kruppe
354a5cb250 Make trans const eval error on overflow and NaN, matching HIR const eval. 2017-11-07 20:13:19 +01:00
Robin Kruppe
e999e7b8b2 Extract (f32::MAX + 0.5 ULP) constant 2017-11-07 20:13:19 +01:00
Robin Kruppe
964ba2a6e7 Fix bug in rustc_apfloat 2017-11-07 20:13:19 +01:00
Robin Kruppe
0d6b52c2f3 Saturating casts between integers and floats (both directions).
This affects regular code generation as well as constant evaluation in trans,
but not the HIR constant evaluator because that one returns an error for
overflowing casts and NaN-to-int casts. That error is conservatively
correct and we should be careful to not accept more code in constant
expressions.
The changes to code generation are guarded by a new -Z flag, to be able
to evaluate the performance impact. The trans constant evaluation changes
are unconditional because they have no run time impact and don't affect
type checking either.
2017-11-07 20:13:19 +01:00
Michael Hewson
0d739b5b97 Update/improve documentation of ExpliciSelf 2017-11-07 13:36:10 -05:00
Michael Hewson
6fd215647d Add arbitrary_self_types feature gate error to some tests 2017-11-07 13:36:10 -05:00
Michael Hewson
aa0df3da3d get the old error messages back
- added some old code that used ExplicitSelf::determine to check for eqtype with the expected self type in the simple cases
- this fixes problems with error messages being worse in those cases, which caused some compile-fail tests to fail
2017-11-07 13:36:10 -05:00
Michael Hewson
d03eb2cc2d Fix some of the tests
- removed the inherent impls compile-fail test, because we’ll be
supporting them
- remove E0308-2 because it’s gonna be supported now (behind a feature
gate)
- replaced the mismatched method receiver error message with something
better, so fixed the tests that that broke
2017-11-07 13:36:10 -05:00
Michael Hewson
9a592e61ff Improve feature gate error, and return after emitting errors instead of looping forever 2017-11-07 13:36:10 -05:00
Michael Hewson
a3f5866fe8 Fix the lifetime error in ExplicitSelf
Had to take the infer context as a parameter instead of the type
context, so that the function can be called during inference
2017-11-07 13:36:10 -05:00
Michael Hewson
7dff08de57 Rewrote check_method_receiver and ExplicitSelf, got a borrow checker error
Rewrote ExplicitSelf, adding a new `Other` variant for arbitrary self
types. It’s a bit more sophisticated now, and checks for type equality,
so you have to pass the type context and param env as arguments.
There’s a borrow-checker error here that I have to fix

Rewrote check_method_receiver, so it acts as if arbitrary self types
are allowed, and then checks for ExplicitSelf::Other at the end and
disallows it unless the feature is present.
2017-11-07 13:36:10 -05:00