Commit Graph

74495 Commits

Author SHA1 Message Date
Jeffrey Seyfried
ba8d6d18d0 Fix span bug. 2018-02-17 21:48:35 -08:00
bors
5313e8728f Auto merge of #47408 - eddyb:deref-danger, r=nikomatsakis
Don't promote to 'static the result of dereferences.

This is a **breaking change**, removing copies out of dereferences from rvalue-to-`'static` promotion.

With miri we won't easily know whether the dereference itself would see the same value at runtime as miri (e.g. after mutating a `static`) or even if it can be interpreted (e.g. integer pointers).
One alternative to this ban is defining at least *some* of those situations as UB, i.e. you shouldn't have a reference in the first place, and you should work through raw pointers instead, to avoid promotion.

**EDIT**: The other *may seem* to be to add some analysis which whitelists references-to-constant-values and assume any values produced by arbitrary computation to not be safe to promote dereferences thereof - but that means producing a reference from an associated constant or `const fn` would necessarily obscure it, and in the former case, this could still impact code that runs on stable today. What we do today to track "references to statics" only works because we restrict taking a reference to a `static` at all to other `static`s (which, again, are currently limited in that they can't be read at compile-time) and to runtime-only `fn`s (*not* `const fn`s).

I'm primarily opening this PR with a conservative first approximation (e.g. `&(*r).a` is not allowed, only reborrows are, and in the old borrow only implicit ones from adjustments, at that) for cratering.

r? @nikomatsakis
2018-02-17 19:32:25 +00:00
bors
f6216b2d55 Auto merge of #48294 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

- Successful merges: #48095, #48152, #48234, #48239, #48243, #48260, #48284, #48286
- Failed merges:
2018-02-17 14:31:32 +00:00
Guillaume Gomez
47db61a3c3
Rollup merge of #48286 - SergioBenitez:master, r=BurntSushi
Clarify contiguity of Vec's elements.

Small doc changes for clarity.
2018-02-17 14:45:28 +01:00
Guillaume Gomez
c4f0011353
Rollup merge of #48284 - crawford:string, r=sfackler
Remove unneeded string allocations
2018-02-17 14:45:27 +01:00
Guillaume Gomez
7dd8c090e4
Rollup merge of #48260 - dns2utf8:add_link_to_yield, r=kennytm
[doc] Add link to yield_now

A convenient link.
2018-02-17 14:45:26 +01:00
Guillaume Gomez
01c7f3a345
Rollup merge of #48243 - rust-lang:steveklabnik-patch-1, r=kennytm
spelling fix in comment

r? @Manishearth
2018-02-17 14:45:24 +01:00
Guillaume Gomez
3672caf662
Rollup merge of #48239 - GuillaumeGomez:fix-condvar-example, r=QuietMisdreavus
Fix condvar example

Fixes #48230.

r? @QuietMisdreavus
2018-02-17 14:45:23 +01:00
Guillaume Gomez
62d6ba4638
Rollup merge of #48234 - zombiezen:patch-1, r=steveklabnik
Remove "empty buffer" doc in read_until

This appears copied from fill_buf, but the above paragraph already indicates that a lack of delimiter at the end is EOF.
2018-02-17 14:45:22 +01:00
Guillaume Gomez
6db06f593b
Rollup merge of #48152 - antoyo:primitive-docs-relevant, r=QuietMisdreavus
Primitive docs relevant

This fixes the documentation to show the right types in the examples for many integer methods.

I need to check if the result is correct before we merge.
2018-02-17 14:45:21 +01:00
Guillaume Gomez
8aa2852399
Rollup merge of #48095 - QuietMisdreavus:doctest-assembly, r=GuillaumeGomez
add unit tests for rustdoc's processing of doctests

cc #42018

There's a lot of things that rustdoc will do to massage doctests into something that can be compiled, and a lot of options that can be toggled to affect this. Hopefully this list of tests can show off that functionality.

The first commit is slightly unrelated but doesn't touch public functionality, because i found that if you have a manual `fn main`, it adds an extra line break at the end, whereas it would trim this extra line break if it were putting a `fn main` in automatically. That first commit makes it trim out that whitespace ahead of time.
2018-02-17 14:45:20 +01:00
bors
b298607864 Auto merge of #47956 - retep998:is-nibbles, r=BurntSushi
This is the ideal FileType on Windows. You may not like it, but this is what peak performance looks like.

Theoretically this would fix https://github.com/rust-lang/rust/issues/46484

The current iteration of this PR should not cause existing code to break, but instead merely improves handling around reparse points. Specifically...

* Reparse points are considered to be symbolic links if they have the name surrogate bit set. Name surrogates are reparse points that effectively act like symbolic links, redirecting you to a different directory/file. By checking for this bit instead of specific tags, we become much more general in our handling of reparse points, including those added by third parties.
* If something is a reparse point but does not have the name surrogate bit set, then we ignore the fact that it is a reparse point because it is actually a file or directory directly there, despite having additional handling by drivers due to the reparse point.
* For everything which is not a symbolic link (including non-surrogate reparse points) we report whether it is a directory or a file based on the presence of the directory attribute bit.
* Notably this still preserves invariant that when `is_symlink` returns `true`, both `is_dir` and `is_file` will return `false`. The potential for breakage was far too high.
* Adds an unstable `FileTypeExt` to allow users to determine whether a symbolic link is a directory or a file, since `FileType` by design is incapable of reporting this information.
2018-02-17 11:32:16 +00:00
bors
b85bd51c94 Auto merge of #47926 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis
add transform for uniform array move out

reworked second step for fix #34708
previous try #46686
r? @nikomatsakis
2018-02-17 08:44:41 +00:00
bors
507a46a4aa Auto merge of #47917 - davidtwco:issue-47703, r=nikomatsakis
Fixes NLL: error from URL crate

Fixes #47703.

r? @nikomatsakis
2018-02-17 05:53:55 +00:00
bors
554fe71ac6 Auto merge of #47906 - Zoxc:nocycle, r=nikomatsakis
Add a `fatal_cycle` attribute for queries which indicates that they will cause a fatal error on query cycles

This moves us towards the goal of having cycle errors be non-fatal by not relying on the default implementation of `ty::maps::values::Value` which aborts on errors.

r? @nikomatsakis
2018-02-17 02:58:21 +00:00
Sergio Benitez
22aecb9c6e Clarify contiguity of Vec's elements. 2018-02-16 17:08:08 -08:00
Alex Crawford
c670ae67b6 Remove unneeded string allocations 2018-02-16 15:23:28 -08:00
Guillaume Gomez
a58409dd91 Notify users that this example is shared through integer types 2018-02-16 16:32:11 +01:00
bors
58a8e0c271 Auto merge of #48252 - Mark-Simulacrum:exclude-paths, r=alexcrichton
Fix not running some steps in CI

We'd previously assumed that these paths would be relative to the src
dir, and that for example our various CI scripts would, when calling
x.py, use `../x.py build ../src/tools/...` but this isn't the case --
they use `../x.py` without using the relevant source-relative path.

We eventually may want to make this (actually somewhat logical) change,
but this is not that time.

r? @kennytm
2018-02-16 15:20:10 +00:00
Stefan Schindler
e812da0ed0 Force the link to std:🧵:yield_now() 2018-02-16 12:20:54 +01:00
Stefan Schindler
3bf989f4c9 Add link to yield_now 2018-02-16 10:30:31 +01:00
kennytm
c788433b15
Fix panic when x.py is called without any arguments. 2018-02-16 14:31:25 +08:00
bors
5570cdcc9e Auto merge of #46714 - leodasvacas:refactor-structurally-resolve-type, r=nikomatsakis
Refactor diverging and numeric fallback.

This refactoring tries to make numeric fallback easier to reason about. Instead of applying all fallbacks at an arbitrary point in the middle of inference, we apply the fallback only when necessary and only for
the variable that requires it. The only place that requires early fallback is the target of numeric casts.

The  visible consequences is that some error messages that got `i32` now get `{integer}` because we are less eager about fallback.

The bigger goal is to make it easier to integrate user fallbacks into inference, if we ever figure that out.
2018-02-16 03:38:44 +00:00
Mark Simulacrum
366a65665a Consider paths passed to x.py to be root-relative.
We'd previously assumed that these paths would be relative to the src
dir, and that for example our various CI scripts would, when calling
x.py, use `../x.py build ../src/tools/...` but this isn't the case --
they use `../x.py` without using the relevant source-relative path.

We eventually may want to make this (actually somewhat logical) change,
but this is not that time.
2018-02-15 19:12:26 -07:00
Mark Simulacrum
e78ecd2e70 Prevent silently ignoring unmatched paths
Primarily for CI purposes; this is intended to avoid cases where we
update rustbuild and unintentionally make CI stop running some builds to
the arguments being passed no longer applying for some reason.
2018-02-15 18:11:57 -07:00
bors
efda9bae87 Auto merge of #45404 - giannicic:defaultimpl2, r=nikomatsakis
#37653 support `default impl` for specialization

this commit implements the second part of the `default impl` feature:

>  - a `default impl` need not include all items from the trait
>  - a `default impl` alone does not mean that a type implements the trait

The first point allows rustc to compile and run something like this:

```
trait Foo {
    fn foo_one(&self) -> &'static str;
    fn foo_two(&self) -> &'static str;
}

default impl<T> Foo for T {
    fn foo_one(&self) -> &'static str {
        "generic"
    }
}

struct MyStruct;

fn  main() {
    assert!(MyStruct.foo_one() == "generic");
}
```

but it shows a proper error if trying to call `MyStruct.foo_two()`

The second point allows a `default impl` to be considered as not implementing the `Trait` if it doesn't implement all the trait items.
The tests provided (in the compile-fail section) should cover all the possible trait resolutions.
Let me know if some tests is missed.

See [referenced ](https://github.com/rust-lang/rust/issues/37653) issue for further info

r? @nikomatsakis
2018-02-16 00:03:10 +00:00
Steve Klabnik
137f5bc64e
spelling fix in comment 2018-02-15 14:44:58 -05:00
Guillaume Gomez
ba6a6d0f0a Fix condvar example 2018-02-15 19:00:51 +01:00
Ross Light
e1e79d3a10 Remove "empty buffer" doc in read_until
This appears copied from fill_buf, but the above paragraph already indicates that a lack of delimiter at the end is EOF.
2018-02-15 07:32:42 -08:00
Gianni Ciccarelli
220bb22e1b add Self: Trait<..> inside the param_env of a default impl 2018-02-15 15:31:05 +00:00
bors
1670a532dd Auto merge of #48203 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests

- Successful merges: #47784, #47806, #47846, #48005, #48033, #48065, #48087, #48114, #48126, #48130, #48133, #48151, #48154, #48156, #48162, #48163, #48165, #48167, #48181, #48186, #48195, #48035, #48210
- Failed merges:
2018-02-15 13:35:20 +00:00
bors
c83fa5d91c Auto merge of #48105 - Mark-Simulacrum:exclude-paths, r=alexcrichton
Implement excluding a build-step via --exclude

First step to fixing https://github.com/rust-lang/rust/issues/47911. This doesn't change any CI configuration, but implements what I believe necessary to make that feasible in rustbuild.

In theory this should be sufficient to allow someone to open a PR against .travis.yml and appveyor.yml which splits the Windows 32-bit tests and maybe the OS X tests into multiple builders (depending on what our cost-concerns are) to reduce runtimes.

r? @alexcrichton
cc @kennytm
2018-02-15 10:32:33 +00:00
kennytm
03b089d220
Rollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs, r=QuietMisdreavus
Clarified why `Sized` bound not implicit on trait's implicit `Self` type.

This part of the documentation was a little confusing to me on first read. I've added a couple lines for further explanation. Hopefully this makes things a bit clearer for new readers.
2018-02-15 14:36:48 +08:00
bors
90759befe0 Auto merge of #48202 - nrc:update, r=kennytm
Update RLS

Should fix the RLS test breakage.

r? @alexcrichton
2018-02-15 04:37:19 +00:00
David Wood
98904c2ecc
Normalizing associated types when checking borrows in drops. 2018-02-14 20:12:28 +00:00
Jacob Hughes
38064a9a7c Review change - Expanded on explanation. 2018-02-14 19:14:25 +00:00
Niko Matsakis
552024a52e
check that types "need drop" before we access them
Also, add some comments and remove extra deref.
2018-02-14 18:17:54 +00:00
David Wood
5fd64dde21
Simplified logic and corrected shallow to deep. 2018-02-14 18:17:53 +00:00
David Wood
e7f328ea57
Handle recursive case of dropping structs with field accesses when struct has no dtor. 2018-02-14 18:17:52 +00:00
David Wood
6493ab6f2a
Fixed incorrect reporting of errors when checking borrows in drops. 2018-02-14 18:16:53 +00:00
David Wood
673d97e3ca
Added tests for #47703 2018-02-14 18:16:53 +00:00
Mark Simulacrum
45944f670b Exclude clippy lints from tidy license check 2018-02-14 09:57:21 -07:00
bors
3ec5a99aaa Auto merge of #48209 - kennytm:try-fix-48116, r=alexcrichton
Try to fix 48116 and 48192

The bug #48116 happens because of a misoptimization of the `import_path_to_string` function, where a `names` slice is empty but the `!names.is_empty()` branch is executed.

4d2d3fc5da/src/librustc_resolve/resolve_imports.rs (L1015-L1042)

Yesterday, @eddyb had locally reproduced the bug, and [came across the `position` function](https://mozilla.logbot.info/rust-infra/20180214#c14296834) where the `assume()` call is found to be suspicious. We have *not* concluded that this `assume()` causes #48116, but given [the reputation of `assume()`](https://github.com/rust-lang/rust/pull/45501#issuecomment-340159627), this seems higher relevant. Here we try to see if commenting it out can fix the errors.

Later @alexcrichton has bisected and found a potential bug [in the LLVM side](https://github.com/rust-lang/rust/issues/48116#issuecomment-365624777). We are currently testing if reverting that LLVM commit is enough to stop the bug. If true, this PR can be reverted (keep the `assume()`) and we could backport the LLVM patch instead.

(This PR also includes an earlier commit from #48127 for help debugging ICE happening in compile-fail/parse-fail tests.)

The PR also reverts #48059, which seems to cause #48192.

r? @alexcrichton
cc @eddyb, @arthurprs (#47333)
2018-02-14 16:05:19 +00:00
Alex Crichton
e0da9902a1
Revert "rustbuild: Pass ccache to build scripts"
This reverts commit 64a8730e17.
2018-02-15 00:04:18 +08:00
kennytm
ec36e7e972
Partially revert #47333.
Removed the `assume()` which we assumed is the cause of misoptimization in
issue #48116.
2018-02-15 00:04:18 +08:00
Jacob Hughes
288c0c3081 Clarified why Sized bound not implicit on trait's implicit Self type. 2018-02-14 15:50:26 +00:00
kennytm
ce89c3de76
Rollup merge of #48035 - technicalguy:Early-exit-empty-hashmap-38880, r=arthurprs
Early exit for empty HashMap (issue #38880)

Addresses issue #38880 by checking if the HashMap is empty before computing the value of the hash.

Before (integer keys)
```
running 4 tests
test empty_once ... bench:          13 ns/iter (+/- 0)
test empty_100  ... bench:       1,367 ns/iter (+/- 35)
test exist_once ... bench:          14 ns/iter (+/- 0)
test exist_100  ... bench:       1,518 ns/iter (+/- 40)
```

After
```
running 4 tests
test empty_once ... bench:           2 ns/iter (+/- 0)
test empty_100  ... bench:         221 ns/iter (+/- 0)
test exist_once ... bench:          15 ns/iter (+/- 0)
test exist_100  ... bench:       1,515 ns/iter (+/- 92)
```

When the HashMap is not empty, the performance remains the same, and when it is empty the performance is significantly improved.
2018-02-14 19:54:00 +08:00
kennytm
6436c44201
Rollup merge of #48195 - paoloteti:compiler-builtins-update, r=alexcrichton
Update compiler-builtins to latest master.

- Rebase compiler-rt submodule to LLVM 6
- New VFP intrinsics on ARM
- Add generic conversion from a narrower to a wider FP type (f32 to f64)
- Fixes minor issues on _subsf3, __subdf3 and __aeabi_fcmple
- Split test suite to a separate crate
2018-02-14 18:25:30 +08:00
kennytm
72ef62a816
Rollup merge of #48186 - Mark-Simulacrum:release-notes-cargo, r=alexcrichton
Add note about Cargo cwd change to release notes

r? @alexcrichton
2018-02-14 18:25:29 +08:00
kennytm
accadb2ce5
Rollup merge of #48181 - michaelwoerister:fix-incr-dir-finalization, r=nikomatsakis
incr.comp.: Run cache directory garbage collection before loading dep-graph.

Prior to this PR, the incr. comp. cache directory would only be garbage collected after the final output artifacts were generated. However, compilation often aborts earlier and in the case of the RLS, which starts lots of compilation sessions, we might fill up the cache directory with chunk sessions.

This PR makes the compiler do a garbage collection run before loading the dep-graph.

cc @nrc https://github.com/rust-lang/rust/issues/48172

r? @nikomatsakis
2018-02-14 18:25:28 +08:00