Commit Graph

95056 Commits

Author SHA1 Message Date
Andrei Homescu
b9ea653aee Expose VaListImpl as the Rust equivalent of __va_list_tag and implement Clone for it. 2019-06-17 16:04:49 -07:00
Yuki Okushi
3d5ef11f1a Improve wording 2019-06-18 07:53:27 +09:00
Eric Huss
afa4827e98 Bump libgit2-sys to get it to compile on i686-pc-windows-gnu. 2019-06-17 14:34:43 -07:00
Eric Huss
6b25e53538 Add syn to workspace hack.
Cargo's syn now has the `full` feature, so add it here to keep it in sync.
2019-06-17 14:34:43 -07:00
Eric Huss
aedb74b8c3 Update cargo 2019-06-17 14:34:43 -07:00
Mazdak Farrokhzad
6fe2653156
Rollup merge of #61908 - matklad:overflow, r=petrochenkov
don't ICE on large files

This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.

For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.

closes #61904

r? @petrochenkov
2019-06-17 20:56:01 +02:00
Mazdak Farrokhzad
04d6539025
Rollup merge of #61893 - chpio:weak_ptr_eq_methods, r=rkruppe
make `Weak::ptr_eq`s into methods

This makes the `Weak::ptr_eq`s associated function into methods. There's no reason for methods on `Weak`s to be associated functions, as there is no `Dered` thus no possibility of a collision. Also: methods can be called using the associated function syntax.

follow up on https://github.com/rust-lang/rust/pull/55987
[Tracking issue for weak_ptr_eq](https://github.com/rust-lang/rust/issues/55981)
2019-06-17 20:56:00 +02:00
Mazdak Farrokhzad
2d3d0b7e93
Rollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJung
Help LLVM better optimize slice::Iter(Mut)::len

r? @RalfJung

I've included a codegen test that fails without this change as a demonstration of usefulness.
2019-06-17 20:55:58 +02:00
Mazdak Farrokhzad
0800b6ee20
Rollup merge of #61836 - ljedrz:i_still_hate_node_ids, r=ljedrz
Replace some uses of NodeId with HirId

We are still using `NodeId` in some spots where we could use `HirId` instead; this PR targets some of these spots and removes some of the associated `hir::map` functions.
2019-06-17 20:55:57 +02:00
Mazdak Farrokhzad
a2259aae7d
Rollup merge of #61702 - RalfJung:const-enum-cast, r=oli-obk
test more variants of enum-int-casting

As I learned in https://github.com/rust-lang/rust/pull/61673#issuecomment-500213506, there is a code path we are not testing yet. Looks like enum-int-casting with and without an intermediate let-binding is totally different.

EDIT: The reason for this is to get rid of the cycle in definitions such as:
```rust
enum Foo {
    A = 0,
    B = Foo::A as isize + 2,
}
```
This has historically been supported, so a hack adding special treatment to `Enum::Variant as _` was added to keep supporting it.
2019-06-17 20:55:55 +02:00
ljedrz
e1bf56de25 remove superfluous space 2019-06-17 20:31:26 +02:00
Cedric
f7ecf1c548 suggest tuple struct syntax 2019-06-17 20:04:26 +02:00
bors
b25ee64497 Auto merge of #61781 - christianpoveda:intptrcast-model, r=oli-obk,RalfJung
prepare for Intptrcast model

https://github.com/rust-lang/rust/pull/61668 done right (I hope so). r? @RalfJung @oli-obk
2019-06-17 18:04:15 +00:00
ljedrz
61e004d68e fix rebase fallout 2019-06-17 19:05:26 +02:00
ljedrz
72bb5c7067 change NodeId to HirId in some HIR docs 2019-06-17 18:59:27 +02:00
ljedrz
88961b049e simplify ICE handling in HirIdValidator 2019-06-17 18:59:27 +02:00
ljedrz
21fbb59500 fix a HIR doc, simplify one HIR-related function call 2019-06-17 18:59:27 +02:00
ljedrz
1c8551b0eb renamve hir_to_string to node_to_string 2019-06-17 18:59:27 +02:00
ljedrz
d996c4d5a3 remove _by_hir_id if there is no NodeId counterpart 2019-06-17 18:57:21 +02:00
ljedrz
61964d9732 replace some uses of NodeId with HirId 2019-06-17 18:57:20 +02:00
Aleksey Kladov
ccb2dfbfec don't ICE on large files
This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.

For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.
2019-06-17 19:34:47 +03:00
bors
b01a257da1 Auto merge of #61857 - Centril:typeck-extract-expr, r=oli-obk
typeck: extract expr type-checking to expr.rs + refactor check_expr_kind

In this PR we:

- Extract out the bulk of the expression type checking logic from `check/mod.rs` into a new file `check/expr.rs`.

- Refactor `fn check_expr_kind` into several smaller functions.

More functions should probably be moved but I think this is a reasonable start.

r? @oli-obk
cc @eddyb
2019-06-17 13:32:35 +00:00
Lzu Tao
7d69d4ced2 Make use of ptr::null(_mut) instead of casting zero 2019-06-17 10:52:46 +00:00
bors
289b78ac0a Auto merge of #58508 - Zoxc:time-crate, r=oli-obk
Add a RUSTC_TIME env var to time rust crates during bootstrap

Blocked on https://github.com/rust-lang/cargo/pull/6674

r? @michaelwoerister

Example for rustc with https://github.com/rust-lang/rust/pull/58507:
```
  time: 0.460; rss: 94MB	parsing
  time: 0.000; rss: 94MB	attributes injection
  time: 0.000; rss: 94MB	recursion limit
  time: 0.000; rss: 94MB	crate injection
  time: 0.000; rss: 94MB	plugin loading
  time: 0.000; rss: 94MB	plugin registration
  time: 0.044; rss: 94MB	pre ast expansion lint checks
    time: 1.999; rss: 316MB	expand crate
    time: 0.000; rss: 316MB	check unused macros
  time: 2.000; rss: 316MB	expansion
  time: 0.000; rss: 316MB	maybe building test harness
  time: 0.053; rss: 316MB	AST validation
  time: 0.000; rss: 316MB	maybe creating a macro crate
  time: 1.515; rss: 397MB	name resolution
  time: 0.122; rss: 397MB	complete gated feature checking
  time: 0.655; rss: 546MB	lowering ast -> hir
  time: 0.136; rss: 550MB	early lint checks
    time: 0.117; rss: 540MB	validate hir map
  time: 0.606; rss: 540MB	indexing hir
  time: 0.000; rss: 480MB	load query result cache
  time: 0.000; rss: 478MB	dep graph tcx init
  time: 0.000; rss: 478MB	looking for entry point
  time: 0.001; rss: 478MB	looking for plugin registrar
  time: 0.001; rss: 478MB	looking for derive registrar
  time: 0.049; rss: 478MB	loop checking
  time: 0.064; rss: 479MB	attribute checking
  time: 0.166; rss: 484MB	stability checking
  time: 0.699; rss: 566MB	type collecting
  time: 0.006; rss: 566MB	outlives testing
  time: 0.018; rss: 568MB	impl wf inference
    time: 0.002; rss: 583MB	unsafety checking
    time: 0.005; rss: 583MB	orphan checking
  time: 0.227; rss: 583MB	coherence checking
  time: 0.006; rss: 583MB	variance testing
  time: 1.546; rss: 657MB	wf checking
  time: 0.389; rss: 665MB	item-types checking
  time: 13.999; rss: 837MB	item-bodies checking
    time: 1.692; rss: 883MB	rvalue promotion
    time: 0.067; rss: 883MB	intrinsic checking
    time: 0.624; rss: 887MB	match checking
    time: 0.246; rss: 889MB	liveness checking
  time: 2.629; rss: 889MB	misc checking
  time: 0.000; rss: 889MB	borrow checking
  time: 16.754; rss: 1242MB	MIR borrow checking
  time: 0.050; rss: 1242MB	dumping chalk-like clauses
  time: 0.010; rss: 1242MB	MIR effect checking
  time: 0.001; rss: 1242MB	layout testing
    time: 0.829; rss: 1244MB	privacy checking
    time: 0.183; rss: 1247MB	death checking
    time: 0.100; rss: 1248MB	unused lib feature checking
    time: 0.405; rss: 1250MB	lint checking
  time: 1.518; rss: 1250MB	misc checking
  time: 0.000; rss: 1250MB	resolving dependency formats
    time: 2.928; rss: 1332MB	write metadata
      time: 0.014; rss: 1332MB	collecting roots
      time: 7.621; rss: 1488MB	collecting mono items
    time: 7.635; rss: 1488MB	monomorphization collection
    time: 0.557; rss: 1567MB	codegen unit partitioning
    time: 27.971; rss: 2656MB	codegen to LLVM IR
    time: 0.056; rss: 2656MB	assert dep graph
    time: 0.000; rss: 2656MB	serialize dep graph
  time: 195.414; rss: 2656MB	codegen
  time: 0.000; rss: 329MB	serialize work products
    time: 1.664; rss: 331MB	running linker
  time: 1.965; rss: 331MB	linking
[RUSTC-TIMING] rustc test:false 950.103
```
It doesn't really look like the times add up here.
2019-06-17 09:59:57 +00:00
bors
63f21b6ca5 Auto merge of #61889 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from 7b2a7a22 to be5d17fe

Changes:
````
Fix wrong lifetime of TyCtxt
Use replace_region_in_file for creating the lint list
Restructure rename tests
Register rename to the LintStore.
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
Remove pub from RedundantStaticLifetime.visit_type function.
Rename const_static_lifetime to redundant_static_lifetime.
Merge StaticConst and StaticStatic lints into StaticConst.
Use RedundantStaticLifetime in StaticStatic.
Move type-checking logic in StaticConst to RedundantStaticLifetime.
Add lint for statics with explicit static lifetime.
minor fix
make it pass dogfood
run rustfmt
fix padding and put clippy someplaces
show default lint levels
group printing
prelim arg parse
move Lint static def into its own module
switch to sorted usable lints
Update clippy_dev/src/main.rs
initial commit for help improvements on clippy-driver
````

Fixes clippy toolstate.
r? @oli-obk
2019-06-17 07:12:03 +00:00
bors
70456a6cbd Auto merge of #61892 - rijenkii:master, r=Centril
weird-exprs: if if if if

The `if` keyword can be chained as long as there are enough `{...} else {...}` following, and they all return a `bool` (not required for the last one).
`if` expression can be also put inside a `match` arm guard, thus making the whole thing a little bit more confusing.

Discovered this clusterfunk while reading the reference because I have nothing better to do.
2019-06-16 23:25:12 +00:00
bors
4edff843dd Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkov
Stabilize underscore_const_names in 1.37.0

You are now permitted to write:

```rust
const _: $type_expression = $term_expression;
```

That is, we change the [grammar of items](9d1984d7ae/grammar/item.lyg (L3-L42)), as written in [the *`.lyg`* notation](263bf161da (grammar)), from:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" }
  | ...
  ;
```

into:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" }
  | ...
  ;

IdentOrUnderscore =
  | Named:IDENT
  | NoName:"_"
  ;
```

r? @petrochenkov
2019-06-16 20:33:55 +00:00
bors
799cf3f603 Auto merge of #61881 - glaubitz:sparc64-ffi-abi, r=petrochenkov
librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C…

…) (#61306)

In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug.
2019-06-16 17:48:24 +00:00
bors
e3175c34b4 Auto merge of #61754 - nikomatsakis:trait-caching-perf-3, r=pnkfelix
create a "provisional cache" to restore performance in the case of cycles

Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this.

Caveat: I've not run `x.py test` in full yet.

r? @pnkfelix
cc @arielb1

Fixes #60846
2019-06-16 14:58:05 +00:00
bors
37b6a5e5e8 Auto merge of #61739 - chansuke:separate-unit-tests, r=petrochenkov
Separate unit tests

I'm working on #61097.

About half of the modules are done but dozens of modules are still remaining. I will rebase and squash the commits later.
2019-06-16 12:15:01 +00:00
Thomas Heck
387ac060d2 make Weak::ptr_eqs into methods 2019-06-16 14:05:44 +02:00
Rijenkii
7c84efddc4
if if if if 2019-06-16 19:01:05 +07:00
Vadim Petrochenkov
5a9643c95b Fix tidy 2019-06-16 14:17:21 +03:00
chansuke
ce51e653c7 Separate libsyntax_ext module 2019-06-16 14:17:01 +03:00
chansuke
f0c7857704 Separate libfmt_macros module 2019-06-16 14:17:01 +03:00
chansuke
c77d3ae9f2 Separate bootstrap module 2019-06-16 14:17:01 +03:00
chansuke
c2a57c88ea Separate libtest module 2019-06-16 14:17:01 +03:00
chansuke
db55aafd72 Separate libserialize module 2019-06-16 14:17:01 +03:00
chansuke
46e622beb9 Separate librustcdoc module 2019-06-16 14:17:01 +03:00
chansuke
638f63b6e4 Separate librustc module 2019-06-16 14:17:01 +03:00
chansuke
b8bc007729 Separate librustc_metadata module 2019-06-16 14:17:01 +03:00
chansuke
b9266794da Separate librustc_lint module 2019-06-16 14:17:01 +03:00
chansuke
0d77084eff Separate librustc_data_structures module 2019-06-16 14:17:01 +03:00
chansuke
7e35995042 Separate librustc_codegen_ssa module 2019-06-16 14:16:55 +03:00
Matthias Krüger
ce728e1399 submodules: update clippy from 7b2a7a22 to be5d17fe
Changes:
````
Fix wrong lifetime of TyCtxt
Use replace_region_in_file for creating the lint list
Restructure rename tests
Register rename to the LintStore.
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
Remove pub from RedundantStaticLifetime.visit_type function.
Rename const_static_lifetime to redundant_static_lifetime.
Merge StaticConst and StaticStatic lints into StaticConst.
Use RedundantStaticLifetime in StaticStatic.
Move type-checking logic in StaticConst to RedundantStaticLifetime.
Add lint for statics with explicit static lifetime.
minor fix
make it pass dogfood
run rustfmt
fix padding and put clippy someplaces
show default lint levels
group printing
prelim arg parse
move Lint static def into its own module
switch to sorted usable lints
Update clippy_dev/src/main.rs
initial commit for help improvements on clippy-driver
````
2019-06-16 12:40:22 +02:00
chansuke
ed54d10de6 Separate libgraphviz module 2019-06-16 13:08:09 +03:00
chansuke
40a0c835b5 Separate libarena::lib module 2019-06-16 13:08:09 +03:00
chansuke
89292beedb Separate liballoc module 2019-06-16 13:08:09 +03:00
bors
68655029d4 Auto merge of #60730 - matthewjasper:optimize-false-edges, r=pnkfelix
Optimize matches

Attempt to fix or improve #60571

This is breaking some diagnostics because the MIR for match arms isn't in source order any more.

cc @centril
2019-06-16 09:30:34 +00:00
Christian Poveda
1e388703c0 Add special behaviour when int is zero 2019-06-16 03:49:13 -05:00