Commit Graph

78612 Commits

Author SHA1 Message Date
est31
7ad9ef3c45 CheckLoopVisitor: also visit closure arguments
This turns an ICE on this code:

fn main() {
    |_: [u8; break]| ();
}

from
    'assertion failed: self.tcx.sess.err_count() > 0', librustc_typeck/check/mod.rs
to
    librustc_mir/hair/cx/expr.rs:543: invalid loop id for break: not inside loop scope

which is at a later stage during compilation and most importantly
fixes of bug #50576 will fix this as well.
2018-05-17 23:54:49 +02:00
bors
612ca14b81 Auto merge of #50593 - nikomatsakis:nll-no-location, r=nikomatsakis
stop considering location when computing outlives relationships

This doesn't (yet?) use SEME regions, but it does ignore the location for outlives constraints. This makes (I believe) NLL significantly faster -- but we should do some benchmarks. It regresses the "get-default" family of use cases for NLL, which is a shame, but keeps the other benefits, and thus represents a decent step forward.

r? @pnkfelix
2018-05-17 21:36:43 +00:00
iancormac84
1839faead0 Removed yet another unused import. 2018-05-17 16:41:34 -04:00
iancormac84
18b032a96b Removed unused import. 2018-05-17 16:41:33 -04:00
iancormac84
b79edf008f Added extra hashing step. 2018-05-17 16:41:33 -04:00
iancormac84
6131c0a98c Fix more unused imports errors. 2018-05-17 16:41:31 -04:00
iancormac84
ef38712f87 Removed unused imports. 2018-05-17 16:41:30 -04:00
iancormac84
9041d81f78 Code structure edits. 2018-05-17 16:41:29 -04:00
iancormac84
659f164167 Removed TypeIdHasher. 2018-05-17 16:41:27 -04:00
iancormac84
9a746d5c1d Removed use of TypeIdHasher in symbol hash generation and replaced it with StableHasher. 2018-05-17 16:41:26 -04:00
iancormac84
a8c2332cc8 Removed use of TypeIdHasher in debuginfo and replaced it with StableHasher. Also corrected erroneous mention of TypeIdHasher in implementation of HashStable trait. 2018-05-17 16:41:18 -04:00
Vadim Petrochenkov
d8bbc1ee1a Fix rebase 2018-05-17 23:32:47 +03:00
Nikita Popov
12308139ec Emit noalias on &mut parameters by default
This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

Noalias annotations will not be emitted by default if either
-C panic=abort (as previously) or LLVM >= 6.0 (new).

-Z mutable-noalias=no is left as an escape-hatch to allow
debugging problems suspected to stem from this change.
2018-05-17 22:27:29 +02:00
Nick Cameron
8de091ed4e Update RLS and Rustfmt 2018-05-18 08:20:36 +12:00
Simonas Kazlauskas
59bb0fe66e Fix align_offset_stride1 & align_to_simple tests 2018-05-17 23:13:43 +03:00
Simonas Kazlauskas
6d5bf8b23f Remove the intrinsic for align_offset
Keep only the language item. This removes some indirection and makes
codegen worse for debug builds, but simplifies code significantly, which
is a good tradeoff to make, in my opinion.

Besides, the codegen can be improved even further with some constant
evaluation improvements that we expect to happen in the future.
2018-05-17 23:13:42 +03:00
Vadim Petrochenkov
dae5f05f43 Remove the proc keyword again 2018-05-17 23:13:09 +03:00
Vadim Petrochenkov
c4352ff198 Turn some functions from token.rs into methods on Ident 2018-05-17 23:13:09 +03:00
Vadim Petrochenkov
f4cbc2388f Pass crate editions to macro expansions, update tests 2018-05-17 23:13:09 +03:00
Vadim Petrochenkov
76bf3454da Keep crate edition in metadata 2018-05-17 23:13:09 +03:00
Vadim Petrochenkov
cd4925d1b8 Add tests 2018-05-17 23:13:09 +03:00
Vadim Petrochenkov
f89e356245 Add two keywords specific to editions 2015 and 2018 respectively 2018-05-17 23:13:09 +03:00
Simonas Kazlauskas
680031b016 Implement [T]::align_to 2018-05-17 23:13:08 +03:00
Vadim Petrochenkov
640884bad0 Add edition to expansion info 2018-05-17 23:13:08 +03:00
Vadim Petrochenkov
ee5b1e15aa Move definition of Edition from libsyntax to libsyntax_pos 2018-05-17 23:13:08 +03:00
varkor
ff0f00d318 Add doc comments mentioning unspecified behaviour upon exhaustion 2018-05-17 20:58:28 +01:00
varkor
1b3ecbcebb Stabilise into_inner 2018-05-17 20:58:28 +01:00
varkor
edad2eff0c Stabilise inclusive_range_methods 2018-05-17 20:58:28 +01:00
Mark Simulacrum
faa1f21298
Rollup merge of #50839 - glassresistor:master, r=steveklabnik
Make sure people know the book is free oline

I've used the tutorial a number of times to relearn rust basics.  When i saw this for a moment I was sad thinking it had been taken offline.
2018-05-17 13:51:30 -06:00
Mark Simulacrum
53ea73a5cd
Rollup merge of #50837 - steveklabnik:revert-49767, r=QuietMisdreavus
Revert #49767

There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.
2018-05-17 13:51:28 -06:00
Mark Simulacrum
54df1bf200
Rollup merge of #50818 - nnethercote:faster-normalize, r=nikomatsakis
Speed up `opt_normalize_projection_type`

`opt_normalize_projection_type` is hot in the serde and futures benchmarks in rustc-perf. These two patches speed up the execution of most runs for them by 2--4%.
2018-05-17 13:51:27 -06:00
Mark Simulacrum
f83e4d7407
Rollup merge of #50806 - oli-obk:gesundheit, r=ehuss
Add `bless` x.py subcommand for easy ui test replacement

fixes #49815

r? @nikomatsakis
2018-05-17 13:51:26 -06:00
Mark Simulacrum
c95267e3a1
Rollup merge of #50791 - bstrie:null, r=QuietMisdreavus
Fix null exclusions in grammar docs

The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.
2018-05-17 13:51:25 -06:00
Mark Simulacrum
77a4296b07
Rollup merge of #50790 - bstrie:grammar, r=steveklabnik
Fix grammar documentation wrt Unicode identifiers

The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*
2018-05-17 13:51:24 -06:00
Mark Simulacrum
e1848df181
Rollup merge of #50649 - nnethercote:tweak-nearest_common_ancestor, r=nikomatsakis
Tweak `nearest_common_ancestor()`.

- Remove the "no nearest common ancestor found" case, because it's never
  hit in practise. (This means `closure_is_enclosed_by` can also be
  removed.)

- Add a comment about why `SmallVec` is used for the "seen" structures.

- Use `&Scope` instead of `Scope` to avoid some `map()` calls.

- Use `any(p)` instead of `position(p).is_some()`.

r? @nikomatsakis
2018-05-17 13:51:22 -06:00
Mark Simulacrum
b3734bd78f
Rollup merge of #50610 - estebank:fmt-str, r=Kimundi
Improve format string errors

Point at format string position inside the formatting string:
```
error: invalid format string: unmatched `}` found
  --> $DIR/format-string-error.rs:21:22
   |
LL |     let _ = format!("}");
   |                      ^ unmatched `}` in format string
```

Explain that argument names can't start with an underscore:
```
error: invalid format string: invalid argument name `_foo`
  --> $DIR/format-string-error.rs:15:23
   |
LL |     let _ = format!("{_foo}", _foo = 6usize);
   |                       ^^^^ invalid argument name in format string
   |
   = note: argument names cannot start with an underscore
```

Fix #23476.

The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.
2018-05-17 13:51:21 -06:00
Mark Simulacrum
0c0bb18a5b
Rollup merge of #50553 - clarcharr:option_xor, r=sfackler
Add Option::xor method

Implements the method requested in #50512.
2018-05-17 13:51:20 -06:00
Mark Simulacrum
6e95b8715c
Rollup merge of #50387 - phansch:remove_leftover_tab, r=alexcrichton
Remove leftover tab in libtest outputs

This removes some tabs that were present in the output of libtest.

Related #19299
Closes #50362
2018-05-17 13:51:19 -06:00
Simonas Kazlauskas
d45378216b Change align_offset to support different strides
This is necessary if we want to implement `[T]::align_to` and is more
useful in general.

This implementation effort has begun during the All Hands and represents
a month of my futile efforts to do any sort of maths. Luckily, I
found the very very nice Chris McDonald (cjm) on IRC who figured out the
core formulas for me! All the thanks for existence of this PR go to
them!

Anyway… Those formulas were mangled by yours truly into the arcane forms
you see here to squeeze out the best assembly possible on most of the
modern architectures (x86 and ARM were evaluated in practice). I mean,
just look at it: *one actual* modulo operation and everything else is
just the cheap single cycle ops! Admitedly, the naive solution might be
faster in some common scenarios, but this code absolutely butchers the
naive solution on the worst case scenario.

Alas, the result of this arcane magic also means that the code pretty
heavily relies on the preconditions holding true and breaking those
preconditions will unleash the UB-est of all UBs! So don’t.
2018-05-17 22:46:02 +03:00
Mikela
cfa26da963
Update tutorial.md 2018-05-17 12:25:24 -07:00
Keith Yeung
8b24644c42 Use EverInit instead of MaybeInit to determine initialization 2018-05-17 12:09:29 -07:00
Alex Crichton
acc874fbcd Revert "bootstrap.py: respect crt-static"
This reverts commit 5ecf29df05.
2018-05-17 10:37:22 -07:00
Alex Crichton
4796871fb7 Revert "musl: don't use the included startfiles with -crt-static"
This reverts commit a5a875d17b.
2018-05-17 10:37:22 -07:00
Alex Crichton
4ac82b4946 Revert "bootstrap: pass crt-static for the compiler host as well"
This reverts commit ec2b861c2f.
2018-05-17 10:37:22 -07:00
Alex Crichton
250bff145f Revert "musl: link crt{begin,end}.o from the system compiler"
This reverts commit 6d9154a830.
2018-05-17 10:37:22 -07:00
Alex Crichton
14507f50df Revert "Add a test for issue 36710."
This reverts commit bd94bf5738.
2018-05-17 10:37:22 -07:00
Alex Crichton
127977153a Revert "compiletest: escape CXX the same way as CC for MSVC"
This reverts commit 490d05055a.
2018-05-17 10:37:22 -07:00
steveklabnik
eac94d1053 Revert #49767
There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.
2018-05-17 13:19:41 -04:00
varkor
f90033303b Make sure the type we think is uninhabited actually is 2018-05-17 18:16:59 +01:00
varkor
05067cf99e Fix an ICE when attempting to transmute an uninhabited type 2018-05-17 18:15:24 +01:00