]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #63400 - petrochenkov:resplit, r=eddyb
Mazdak Farrokhzad [Sat, 10 Aug 2019 13:27:31 +0000 (15:27 +0200)]
Rollup merge of #63400 - petrochenkov:resplit, r=eddyb

Try to break resolve into more isolated parts

Some small step towards resolve librarification.

"Late resolution" is the pass that resolves most of names in a crate beside imports and macros.
It runs when the crate is fully expanded and its module structure is fully built.
So we just walk through the crate and resolve all the expressions, types, etc.

This pass is pretty self-contained, but it was previously done by implementing `Visitor` on the whole `Resolver` (which is used for many other tasks), and fields specific to this pass were indiscernible from the global `Resolver` state.

This PR moves the late resolution pass into a separate visitor and a separate file, fields specific to this visitor are moved from `Resolver` as well.

I'm especially happy about `current_module` being removed from `Resolver`.
It was used even for operations not related to visiting and changing the `current_module` position in process.
It was also used as an implicit argument for some functions used in this style
```rust
let orig_current_module = mem::replace(&mut self.current_module, module);
self.resolve_ident_somewhere();
self.current_module = orig_current_module;
```
and having effects on e.g. privacy checking somewhere deeply inside `resolve_ident_somewhere`.
Now we explicitly pass a `ParentScope` to those functions instead, which includes the module and some other data describing our position in the crate relatively to which we resolve names.

Rustdoc was one of the users of `current_module`, it set it for resolving intra-doc links.
Now it passes it explicitly as an argument as well (I also supported resolving paths from rustdoc in unnamed blocks as a drive-by fix).

Visibility resolution is also changed to use early resolution (which is correct because it's used during the work of `BuildReducedGraphVisitor`, i.e. integration of a new AST fragment into the existing partially built module structures.) instead of untimely late resolution (which worked only due to restrictions on paths in visibilities like inability to refer to anything except ancestor modules).
This slightly regresses its diagnostics because late resolution has a more systematic error detection and recovery currently.
Due to changes in `current_module` and visibilities `BuildReducedGraphVisitor` ended up almost as heavily affected by this refactoring as late resolution.

Fixes https://github.com/rust-lang/rust/issues/63223 (due to visibility resolution changes).

4 years agoresolve: Address FIXME from the previous commit
Vadim Petrochenkov [Fri, 9 Aug 2019 22:40:05 +0000 (01:40 +0300)]
resolve: Address FIXME from the previous commit

Make the `is_import` flag in `ScopeSet` independent from namespace
Fix rebase

4 years agoFix calls to resolver from rustdoc and HIR lowering
Vadim Petrochenkov [Thu, 8 Aug 2019 23:16:45 +0000 (02:16 +0300)]
Fix calls to resolver from rustdoc and HIR lowering

Cleanup some surrounding code.
Support resolution of intra doc links in unnamed block scopes.
(Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.)

Fix one test hitting file path limits on Windows.

4 years agoresolve: Move some more code around
Vadim Petrochenkov [Thu, 8 Aug 2019 20:57:35 +0000 (23:57 +0300)]
resolve: Move some more code around

Move methods logically belonging to build-reduced-graph into `impl BuildReducedGraphVisitor` and `build_reduced_graph.rs`
Move types mostly specific to late resolution closer to the late resolution visitor

4 years agoresolve: Turn `resolve_error` into a method on `Resolver`
Vadim Petrochenkov [Thu, 8 Aug 2019 20:32:58 +0000 (23:32 +0300)]
resolve: Turn `resolve_error` into a method on `Resolver`

Rename it to `report_error` and move into `diagnostics.rs`

Also turn `check_unused` into a method on `Resolver`

4 years agoresolve: Remove `Deref<Target=Resolver>` implementations
Vadim Petrochenkov [Thu, 8 Aug 2019 11:06:42 +0000 (14:06 +0300)]
resolve: Remove `Deref<Target=Resolver>` implementations

It's now immediately clear what fields belong to the global resolver state and what are specific to passes/visitors.

4 years agoresolve: Track whole parent scope in the visitors
Vadim Petrochenkov [Thu, 8 Aug 2019 00:44:16 +0000 (03:44 +0300)]
resolve: Track whole parent scope in the visitors

Instead of tracking current module and other components separately.
(`ParentScope` includes the module as a component.)

4 years agoresolve: Move late resolution visitor into a separate file
Vadim Petrochenkov [Wed, 7 Aug 2019 23:39:02 +0000 (02:39 +0300)]
resolve: Move late resolution visitor into a separate file

4 years agoresolve: Move late resolution into a separate visitor
Vadim Petrochenkov [Mon, 5 Aug 2019 18:18:50 +0000 (21:18 +0300)]
resolve: Move late resolution into a separate visitor

Move `Resolver` fields specific to late resolution to the new visitor.
The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`.
Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it.

Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.

4 years agoAuto merge of #63428 - Centril:rollup-c2ru1z1, r=Centril
bors [Sat, 10 Aug 2019 06:14:13 +0000 (06:14 +0000)]
Auto merge of #63428 - Centril:rollup-c2ru1z1, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #63056 (Give built-in macros stable addresses in the standard library)
 - #63337 (Tweak mismatched types error)
 - #63350 (Use associated_type_bounds where applicable - closes #61738)
 - #63394 (Add test for issue 36804)
 - #63399 (More explicit diagnostic when using a `vec![]` in a pattern)
 - #63419 (check against more collisions for TypeId of fn pointer)
 - #63423 (Mention that tuple structs are private if any of their fields are)

Failed merges:

r? @ghost

4 years agoRollup merge of #63423 - estebank:priv-tuple, r=zackmdavis
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:25 +0000 (08:13 +0200)]
Rollup merge of #63423 - estebank:priv-tuple, r=zackmdavis

Mention that tuple structs are private if any of their fields are

CC #39703

4 years agoRollup merge of #63419 - RalfJung:typeid, r=alexcrichton
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:24 +0000 (08:13 +0200)]
Rollup merge of #63419 - RalfJung:typeid, r=alexcrichton

check against more collisions for TypeId of fn pointer

Cc https://github.com/rust-lang/rfcs/pull/2738#issuecomment-519923318

4 years agoRollup merge of #63399 - estebank:vec-in-pat, r=Centril
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:22 +0000 (08:13 +0200)]
Rollup merge of #63399 - estebank:vec-in-pat, r=Centril

More explicit diagnostic when using a `vec![]` in a pattern

```
error: unexpected `(` after qualified path
  --> $DIR/vec-macro-in-pattern.rs:3:14
   |
LL |         Some(vec![x]) => (),
   |              ^^^^^^^
   |              |
   |              unexpected `(` after qualified path
   |              in this macro invocation
   |              use a slice pattern here instead
   |
   = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```

Fix #61933.

4 years agoRollup merge of #63394 - jackh726:issue-36804, r=jonas-schievink
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:21 +0000 (08:13 +0200)]
Rollup merge of #63394 - jackh726:issue-36804, r=jonas-schievink

Add test for issue 36804

I slightly reduced the repro that ICEs on nightly-2017-01-20.

Closes #36804

4 years agoRollup merge of #63350 - iluuu1994:use-associated-type-bounds, r=Centril
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:19 +0000 (08:13 +0200)]
Rollup merge of #63350 - iluuu1994:use-associated-type-bounds, r=Centril

Use associated_type_bounds where applicable - closes #61738

4 years agoRollup merge of #63337 - estebank:break-ee0308, r=Centril
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:17 +0000 (08:13 +0200)]
Rollup merge of #63337 - estebank:break-ee0308, r=Centril

Tweak mismatched types error

- Change expected/found for type mismatches in `break`
- Be more accurate when talking about diverging match arms
- Tweak wording of function without a return value
- Suggest calling bare functions when their return value can be coerced to the expected type
- Give more parsing errors when encountering `foo(_, _, _)`

Fix #51767, fix #62677, fix #63136, cc #37384, cc #35241, cc #51669.

4 years agoRollup merge of #63056 - petrochenkov:macstd2, r=alexcrichton
Mazdak Farrokhzad [Sat, 10 Aug 2019 06:13:16 +0000 (08:13 +0200)]
Rollup merge of #63056 - petrochenkov:macstd2, r=alexcrichton

Give built-in macros stable addresses in the standard library

Continuation of https://github.com/rust-lang/rust/pull/62086.

Derive macros corresponding to traits from libcore are now available through the same paths as those traits:
- `Clone` - `{core,std}::clone::Clone`
- `PartialEq` - `{core,std}::cmp::PartialEq`
- `Eq` - `{core,std}::cmp::Eq`
- `PartialOrd` - `{core,std}::cmp::PartialOrd`
- `Ord` - `{core,std}::cmp::Ord`
- `Default` - `{core,std}::default::Default`
- `Debug` - `{core,std}::fmt::Debug`
- `Hash` - `{core,std}::hash::Hash`
- `Copy` - `{core,std}::marker::Copy`

Fn-like built-in macros are now available through libcore and libstd's root module, by analogy with non-builtin macros defined by libcore and libstd:
```rust
{core,std}::{
    __rust_unstable_column,
    asm,
    assert,
    cfg,
    column,
    compile_error,
    concat,
    concat_idents,
    env,
    file,
    format_args,
    format_args_nl,
    global_asm,
    include,
    include_bytes,
    include_str,
    line,
    log_syntax,
    module_path,
    option_env,
    stringify,
    trace_macros,
}
```

Derive macros without a corresponding trait in libcore or libstd are still available only through prelude (also see https://github.com/rust-lang/rust/pull/62507).
Attribute macros also keep being available only through prelude, mostly because they don't have an existing practice to follow. An advice from the library team on their eventual placement would be appreciated.
```rust
    RustcDecodable,
    RustcEncodable,
    bench,
    global_allocator,
    test,
    test_case,
```

r? @alexcrichton

4 years agoAuto merge of #62756 - newpavlov:stabilize_dur_float, r=alexcrichton
bors [Sat, 10 Aug 2019 01:16:48 +0000 (01:16 +0000)]
Auto merge of #62756 - newpavlov:stabilize_dur_float, r=alexcrichton

Stabilize duration_float

Closes: #54361
4 years agoAuto merge of #63415 - nikic:bump-llvm-2, r=alexcrichton
bors [Fri, 9 Aug 2019 21:20:48 +0000 (21:20 +0000)]
Auto merge of #63415 - nikic:bump-llvm-2, r=alexcrichton

Update LLVM submodule

Fixes #63361.

r? @alexcrichton

4 years agoGive built-in macros stable addresses in the standard library
Vadim Petrochenkov [Sat, 27 Jul 2019 22:51:21 +0000 (01:51 +0300)]
Give built-in macros stable addresses in the standard library

4 years agoMention that tuple structs are private if their fields are
Esteban Küber [Fri, 9 Aug 2019 19:52:02 +0000 (12:52 -0700)]
Mention that tuple structs are private if their fields are

4 years agocheck against more collisions for TypeId of fn pointer
Ralf Jung [Fri, 9 Aug 2019 18:04:18 +0000 (20:04 +0200)]
check against more collisions for TypeId of fn pointer

4 years agoUpdate LLVM submodule
Nikita Popov [Fri, 9 Aug 2019 17:17:18 +0000 (19:17 +0200)]
Update LLVM submodule

4 years agoreview comments: use structured suggestion
Esteban Küber [Fri, 9 Aug 2019 16:39:30 +0000 (09:39 -0700)]
review comments: use structured suggestion

4 years agoMore explicit diagnostic when using a `vec![]` in a pattern
Esteban Küber [Fri, 9 Aug 2019 01:24:00 +0000 (18:24 -0700)]
More explicit diagnostic when using a `vec![]` in a pattern

```
error: unexpected `(` after qualified path
  --> $DIR/vec-macro-in-pattern.rs:3:14
   |
LL |         Some(vec![x]) => (),
   |              ^^^^^^^
   |              |
   |              unexpected `(` after qualified path
   |              in this macro invocation
   |              use a slice pattern here instead
   |
   = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
```

4 years agofix tests
Esteban Küber [Fri, 9 Aug 2019 14:57:16 +0000 (07:57 -0700)]
fix tests

4 years agoreview comments: typo and rewording
Esteban Küber [Thu, 8 Aug 2019 23:56:57 +0000 (16:56 -0700)]
review comments: typo and rewording

4 years agoreview comment: review wording or missing return error
Esteban Küber [Thu, 8 Aug 2019 22:55:18 +0000 (15:55 -0700)]
review comment: review wording or missing return error

4 years agoExtend suggestion support for traits and foreign items
Esteban Küber [Thu, 8 Aug 2019 22:53:32 +0000 (15:53 -0700)]
Extend suggestion support for traits and foreign items

4 years agoDifferentiate between tuple structs and tuple variants
Esteban Küber [Thu, 8 Aug 2019 21:59:24 +0000 (14:59 -0700)]
Differentiate between tuple structs and tuple variants

4 years agoTweak wording of fn without explicit return
Esteban Küber [Thu, 8 Aug 2019 21:53:00 +0000 (14:53 -0700)]
Tweak wording of fn without explicit return

4 years agoreview comments
Esteban Küber [Thu, 8 Aug 2019 19:32:18 +0000 (12:32 -0700)]
review comments

4 years agoRecover parser from `foo(_, _)`
Esteban Küber [Thu, 8 Aug 2019 19:31:24 +0000 (12:31 -0700)]
Recover parser from `foo(_, _)`

4 years agoWhen suggesting fn call use an appropriate number of placeholder arguments
Esteban Küber [Thu, 8 Aug 2019 19:01:22 +0000 (12:01 -0700)]
When suggesting fn call use an appropriate number of placeholder arguments

4 years agoSuggest calling function on type error when finding bare fn
Esteban Küber [Wed, 7 Aug 2019 05:29:10 +0000 (22:29 -0700)]
Suggest calling function on type error when finding bare fn

4 years agoChange wording for function without return value
Esteban Küber [Wed, 7 Aug 2019 05:22:04 +0000 (22:22 -0700)]
Change wording for function without return value

Fix #62677

4 years agoBe more accurate when mentioning type of found match arms
Esteban Küber [Wed, 7 Aug 2019 05:20:42 +0000 (22:20 -0700)]
Be more accurate when mentioning type of found match arms

4 years agoDo not suggest using ! with break
Esteban Küber [Wed, 7 Aug 2019 00:24:39 +0000 (17:24 -0700)]
Do not suggest using ! with break

4 years agoTweak mismatched types error on break expressions
Esteban Küber [Tue, 6 Aug 2019 21:20:39 +0000 (14:20 -0700)]
Tweak mismatched types error on break expressions

4 years agoAuto merge of #63408 - Centril:rollup-skqrez3, r=Centril
bors [Fri, 9 Aug 2019 12:14:57 +0000 (12:14 +0000)]
Auto merge of #63408 - Centril:rollup-skqrez3, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #62672 (Deprecate `try!` macro)
 - #62950 (Check rustbook links on all platforms when running locally)
 - #63114 (Remove gensym in format_args)
 - #63397 (Add tests for some ICEs)
 - #63403 (Improve test output)
 - #63404 (enable flt2dec tests in Miri)
 - #63407 (reduce some test sizes in Miri)

Failed merges:

r? @ghost

4 years agoRollup merge of #63407 - RalfJung:miri-test-sizes, r=Centril
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:35 +0000 (14:07 +0200)]
Rollup merge of #63407 - RalfJung:miri-test-sizes, r=Centril

reduce some test sizes in Miri

4 years agoRollup merge of #63404 - RalfJung:flt2dec, r=Centril
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:34 +0000 (14:07 +0200)]
Rollup merge of #63404 - RalfJung:flt2dec, r=Centril

enable flt2dec tests in Miri

With ldexp implemented (thanks to @christianpoveda), we can finally enable these tests in Miri. Well, most of them -- some are just too slow.

4 years agoRollup merge of #63403 - sntdevco:master, r=Centril
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:32 +0000 (14:07 +0200)]
Rollup merge of #63403 - sntdevco:master, r=Centril

Improve test output

I'm continuing to improve the test output for liballoc and libcore

4 years agoRollup merge of #63397 - JohnTitor:add-tests-for-ices, r=Centril
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:31 +0000 (14:07 +0200)]
Rollup merge of #63397 - JohnTitor:add-tests-for-ices, r=Centril

Add tests for some ICEs

Closes #43623
Closes #44405

r? @Centril

4 years agoRollup merge of #63114 - matthewjasper:hygienic-format-args, r=petrochenkov
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:29 +0000 (14:07 +0200)]
Rollup merge of #63114 - matthewjasper:hygienic-format-args, r=petrochenkov

Remove gensym in format_args

This also fixes some things to allow us to export opaque macros from libcore:

* Don't consider items that are only reachable through opaque macros as public/exported (so they aren't linted as needing docs)
* Mark private items reachable from the root of libcore as unstable - they are now reachable (in principle) in other crates via macros in libcore

r? @petrochenkov

4 years agoRollup merge of #62950 - mati865:linkcheck, r=alexcrichton
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:28 +0000 (14:07 +0200)]
Rollup merge of #62950 - mati865:linkcheck, r=alexcrichton

Check rustbook links on all platforms when running locally

cc https://github.com/rust-lang/rust/issues/62739

4 years agoRollup merge of #62672 - lzutao:deprecated-try-macro, r=Centril
Mazdak Farrokhzad [Fri, 9 Aug 2019 12:07:26 +0000 (14:07 +0200)]
Rollup merge of #62672 - lzutao:deprecated-try-macro, r=Centril

Deprecate `try!` macro

Replaces #62077

Fixes rust-lang/rust-clippy#1361
Fixes #61000

4 years agoexplain Miri disabling
Ralf Jung [Fri, 9 Aug 2019 11:55:22 +0000 (13:55 +0200)]
explain Miri disabling

4 years agoDon't use associated type bounds in docs until it is stable
Ilija Tovilo [Fri, 9 Aug 2019 11:40:54 +0000 (13:40 +0200)]
Don't use associated type bounds in docs until it is stable

4 years agoreduce some test sizes in Miri
Ralf Jung [Fri, 9 Aug 2019 09:43:25 +0000 (11:43 +0200)]
reduce some test sizes in Miri

4 years agoAdd missing #![feature(associated_type_bounds)]
Ilija Tovilo [Thu, 8 Aug 2019 22:33:57 +0000 (00:33 +0200)]
Add missing #![feature(associated_type_bounds)]

4 years agoMiri is really slow
Ralf Jung [Fri, 9 Aug 2019 09:18:17 +0000 (11:18 +0200)]
Miri is really slow

4 years agoCheck links on all platforms when running locally
Mateusz Mikuła [Tue, 6 Aug 2019 12:55:57 +0000 (14:55 +0200)]
Check links on all platforms when running locally

4 years agoAuto merge of #63302 - nikic:bump-llvm, r=alexcrichton
bors [Fri, 9 Aug 2019 08:24:43 +0000 (08:24 +0000)]
Auto merge of #63302 - nikic:bump-llvm, r=alexcrichton

Update LLVM submodule

This pulls in a newer version of the LLVM 9 release branch.

Fixes #62932.

r? @alexcrichton

4 years agoenable flt2dec tests in Miri
Ralf Jung [Fri, 9 Aug 2019 08:07:59 +0000 (10:07 +0200)]
enable flt2dec tests in Miri

4 years agoMerge pull request #1 from rust-lang/master
Sayan Nandan [Fri, 9 Aug 2019 07:31:05 +0000 (13:01 +0530)]
Merge pull request #1 from rust-lang/master

Merge recent changes into master

4 years agoImprove tests for liballoc/btree/set
Sayan Nandan [Fri, 9 Aug 2019 07:23:14 +0000 (12:53 +0530)]
Improve tests for liballoc/btree/set

4 years agoImprove tests for libcore/slice
Sayan Nandan [Fri, 9 Aug 2019 07:21:34 +0000 (12:51 +0530)]
Improve tests for libcore/slice

4 years agoImprove test output for libcore/time
Sayan Nandan [Fri, 9 Aug 2019 07:17:27 +0000 (12:47 +0530)]
Improve test output for libcore/time

4 years agoAuto merge of #61937 - AaronKutch:master, r=scottmcm
bors [Fri, 9 Aug 2019 04:41:20 +0000 (04:41 +0000)]
Auto merge of #61937 - AaronKutch:master, r=scottmcm

Improve `ptr_rotate` performance, tests, and benches

The corresponding issue is #61784. I am not actually sure if miri can handle the test, but I can change the commit if necessary.

4 years agoAllow deprecated try macro in test crates
Lzu Tao [Sun, 14 Jul 2019 08:16:46 +0000 (08:16 +0000)]
Allow deprecated try macro in test crates

4 years agoPostpone deprecating try! until 1.39.0
Lzu Tao [Mon, 15 Jul 2019 17:42:08 +0000 (17:42 +0000)]
Postpone deprecating try! until 1.39.0

4 years agoDeprecate `try!` macro
BO41 [Sun, 23 Jun 2019 12:19:46 +0000 (12:19 +0000)]
Deprecate `try!` macro

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
4 years agoAuto merge of #63395 - Centril:rollup-kt805cj, r=Centril
bors [Thu, 8 Aug 2019 23:39:01 +0000 (23:39 +0000)]
Auto merge of #63395 - Centril:rollup-kt805cj, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #63162 (Miri tests: use xargo to build separate libstd)
 - #63289 (Don't recommend `extern crate` syntax)
 - #63373 (gitignore: add comment explaining policy)
 - #63374 (move of packed fields might or might not occur when they actually are sufficiently aligned)
 - #63381 (reduce visibility)
 - #63387 (Test interaction between `async { ... }` and `?`, `return`, and `break`)

Failed merges:

r? @ghost

4 years agoRollup merge of #63387 - Centril:async-block-control-flow-tests, r=cramertj
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:36 +0000 (01:38 +0200)]
Rollup merge of #63387 - Centril:async-block-control-flow-tests, r=cramertj

Test interaction between `async { ... }` and `?`, `return`, and `break`

Per the second checkbox in https://github.com/rust-lang/rust/issues/62121#issuecomment-506884048, test that `async { .. }` blocks:
1. do not allow `break` expressions.
2. get targeted by `return` and not the parent function.
3. get targeted by `?` and not the parent function.

Works towards resolving blockers in #63209.

r? @cramertj

4 years agoRollup merge of #63381 - matklad:reduce-visibility, r=Centril
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:34 +0000 (01:38 +0200)]
Rollup merge of #63381 - matklad:reduce-visibility, r=Centril

reduce visibility

r? @petrochenkov

4 years agoRollup merge of #63374 - RalfJung:pin-packed, r=cramertj
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:33 +0000 (01:38 +0200)]
Rollup merge of #63374 - RalfJung:pin-packed, r=cramertj

move of packed fields might or might not occur when they actually are sufficiently aligned

See https://github.com/taiki-e/pin-project/pull/34, where it was pointed out that we actually don't move fields of 1-aligned types when dropping a packed struct -- but e.g. in a `packed(2)` struct, we don't do something similar for 2-aligned types. The code for that is [here](https://github.com/rust-lang/rust/blob/db7c773a6be2f050d1d1504763819ea3916f5428/src/librustc_mir/util/alignment.rs#L7).

4 years agoRollup merge of #63373 - RalfJung:gitignore, r=alexcrichton
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:32 +0000 (01:38 +0200)]
Rollup merge of #63373 - RalfJung:gitignore, r=alexcrichton

gitignore: add comment explaining policy

Based on https://github.com/rust-lang/rust/pull/63307#issuecomment-518539503, I added a comment what I think should be gitignored and what not. This is just a proposal, obviously.  Also see https://github.com/rust-lang/rust/pull/53768 for some more discussion.

The summary is that if there are junk files that you create locally and are fine leaving around (such as `mir_dump`), git has the option for you to add them to `.git/info/exclude`. Others might prefer to keep their working dir clean of those same junk files, so we shouldn't just ignore them for everyone.

I then also cleaned up a few more things, but there were many things that I had no idea where they came from so I didn't touch them.

4 years agoRollup merge of #63289 - kornelski:missingcrate, r=zackmdavis
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:30 +0000 (01:38 +0200)]
Rollup merge of #63289 - kornelski:missingcrate, r=zackmdavis

Don't recommend `extern crate` syntax

`extern crate` syntax is not a good recommendation any more, so I've changed it to just print a suggested crate name.

4 years agoRollup merge of #63162 - RalfJung:miri-xargo, r=alexcrichton
Mazdak Farrokhzad [Thu, 8 Aug 2019 23:38:29 +0000 (01:38 +0200)]
Rollup merge of #63162 - RalfJung:miri-xargo, r=alexcrichton

Miri tests: use xargo to build separate libstd

This uses `cargo miri setup` to prepare the libstd that is used for testing Miri, instead of adjusting the entire bootstrap process to make sure the libstd that already gets built is fit for Miri.

The issue with our current approach is that with `test-miri = true`, libstd and the test suite get built with `--cfg miri`, which e.g. means hashbrown uses no SIMD, and not all things are tested. Such global side-effects seem like footguns waiting to go off.

On the other hand, the new approach means we install xargo as a side-effect of doing `./x.py test src/tools/miri`, which might be surprising, and we also both have to build xargo and another libstd which costs some extra time. Not sure if the tools builders have enough time budget for that. Maybe there is a way to cache xargo?

We have to first first land https://github.com/rust-lang/miri/pull/870 in Miri and then update this PR to include that change (also to get CI to test Miri before bors), but I wanted to get the review started here.

Cc @oli-obk (for Miri) @alexcrichton (for CI) @Mark-Simulacrum (for bootstrap)

Fixes https://github.com/rust-lang/rust/issues/61833, fixes https://github.com/rust-lang/rust/issues/63219

4 years agoAdd test for issue-44405
Yuki Okushi [Thu, 8 Aug 2019 23:37:55 +0000 (08:37 +0900)]
Add test for issue-44405

4 years agoAdd test for issue-43623
Yuki Okushi [Thu, 8 Aug 2019 23:37:40 +0000 (08:37 +0900)]
Add test for issue-43623

4 years agoAdd test for issue 36804
Jack [Thu, 8 Aug 2019 23:16:08 +0000 (19:16 -0400)]
Add test for issue 36804

4 years agoTest interaction btw async blocks and ?, return, break.
Mazdak Farrokhzad [Thu, 8 Aug 2019 20:38:26 +0000 (22:38 +0200)]
Test interaction btw async blocks and ?, return, break.

4 years agoUse associated_type_bounds where applicable - closes #61738
Ilija Tovilo [Wed, 31 Jul 2019 19:00:35 +0000 (21:00 +0200)]
Use associated_type_bounds where applicable - closes #61738

4 years agoremove confusing remark
Ralf Jung [Thu, 8 Aug 2019 19:02:11 +0000 (21:02 +0200)]
remove confusing remark

4 years agomore alphabetical
Ralf Jung [Thu, 8 Aug 2019 17:43:44 +0000 (19:43 +0200)]
more alphabetical

4 years agotweak ignores
Ralf Jung [Thu, 8 Aug 2019 17:42:46 +0000 (19:42 +0200)]
tweak ignores

4 years agoupdate miri
Ralf Jung [Thu, 8 Aug 2019 17:32:33 +0000 (19:32 +0200)]
update miri

4 years agodon't set RUSTC_DEBUG_ASSERTIONS here; let cargo-miri do that
Ralf Jung [Sat, 3 Aug 2019 15:26:01 +0000 (17:26 +0200)]
don't set RUSTC_DEBUG_ASSERTIONS here; let cargo-miri do that

4 years agoinstall and use xargo inside the build dir
Ralf Jung [Sat, 3 Aug 2019 12:30:57 +0000 (14:30 +0200)]
install and use xargo inside the build dir

4 years agolet us try to find out where that panic is coming from
Ralf Jung [Fri, 2 Aug 2019 12:20:42 +0000 (14:20 +0200)]
let us try to find out where that panic is coming from

4 years agodont test Miri by default (also be more verbose when being verbose)
Ralf Jung [Fri, 2 Aug 2019 15:56:55 +0000 (17:56 +0200)]
dont test Miri by default (also be more verbose when being verbose)

4 years agoremove test-miri from config.toml.example
Ralf Jung [Thu, 1 Aug 2019 19:06:25 +0000 (21:06 +0200)]
remove test-miri from config.toml.example

4 years agomore comments
Ralf Jung [Wed, 31 Jul 2019 13:39:30 +0000 (15:39 +0200)]
more comments

4 years agoremove test-miri flag from bootstrap
Ralf Jung [Wed, 31 Jul 2019 13:26:56 +0000 (15:26 +0200)]
remove test-miri flag from bootstrap

4 years agoMiri test: call 'cargo miri test' and use the sysroot it has set up
Ralf Jung [Wed, 31 Jul 2019 13:24:09 +0000 (15:24 +0200)]
Miri test: call 'cargo miri test' and use the sysroot it has set up

4 years agosimplify a match
Ralf Jung [Wed, 31 Jul 2019 07:01:42 +0000 (09:01 +0200)]
simplify a match

4 years agobootstrap: get rid of TEST_MIRI env var
Ralf Jung [Tue, 30 Jul 2019 19:23:59 +0000 (21:23 +0200)]
bootstrap: get rid of TEST_MIRI env var

4 years agoAuto merge of #63380 - Centril:rollup-tzfhtnu, r=Centril
bors [Thu, 8 Aug 2019 17:19:22 +0000 (17:19 +0000)]
Auto merge of #63380 - Centril:rollup-tzfhtnu, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #63261 (bump rand in libcore/liballoc test suites)
 - #63316 (Update rustfmt to 1.4.4)
 - #63332 (Add an overflow check in truncate implementation for Unix.)
 - #63342 (Don't use remap-path-prefix in dep-info files.)
 - #63366 (doc: Fix typo in float from bytes methods)
 - #63370 (Fix ICE #63364)
 - #63377 (Improved documentation for compile_error!())
 - #63379 (Add test for issue 53096)

Failed merges:

r? @ghost

4 years agoreduce visibility
Aleksey Kladov [Thu, 8 Aug 2019 14:58:06 +0000 (16:58 +0200)]
reduce visibility

4 years agoRollup merge of #63379 - jackh726:issue-53096, r=Centril,oli-obk
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:44 +0000 (16:33 +0200)]
Rollup merge of #63379 - jackh726:issue-53096, r=Centril,oli-obk

Add test for issue 53096

Closes #53096

r? @oli-obk

4 years agoRollup merge of #63377 - SOF3:issues/63375, r=Centril
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:43 +0000 (16:33 +0200)]
Rollup merge of #63377 - SOF3:issues/63375, r=Centril

Improved documentation for compile_error!()

Fixes #63375

4 years agoRollup merge of #63370 - JohnTitor:fix-ice-63364, r=varkor
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:41 +0000 (16:33 +0200)]
Rollup merge of #63370 - JohnTitor:fix-ice-63364, r=varkor

Fix ICE #63364

Fixes #63364

r? @estebank cc @varkor

4 years agoRollup merge of #63366 - lzutao:fix-float-to-le-bytes-typo, r=Centril
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:40 +0000 (16:33 +0200)]
Rollup merge of #63366 - lzutao:fix-float-to-le-bytes-typo, r=Centril

doc: Fix typo in float from bytes methods

Thanks @That3Percent for pointing it out.
r? @Centril

4 years agoRollup merge of #63342 - ehuss:remap-path-dep-info, r=alexcrichton
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:39 +0000 (16:33 +0200)]
Rollup merge of #63342 - ehuss:remap-path-dep-info, r=alexcrichton

Don't use remap-path-prefix in dep-info files.

This changes it so that dep-info files do not use remapped paths.

Having remapped paths causes problems with Cargo because if you remap to a nonexistent path (like `/rustc/$HASH` which rustc distributions do), then Cargo's change tracking thinks the files don't exist and will always rebuild.

I don't actually know if this is a good idea. I think it makes sense, but I do not know what the exact requirements are for reproducible builds. I consider these files separate from the binary artifacts generated, and as a build-system helper, so it seems reasonable to me.

I'm also not sure if this needs a test. I'll definitely add one on the cargo side if this is merged.

Closes #63329

4 years agoRollup merge of #63332 - marmistrz:truncate, r=alexcrichton
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:37 +0000 (16:33 +0200)]
Rollup merge of #63332 - marmistrz:truncate, r=alexcrichton

Add an overflow check in truncate implementation for Unix.

Closes #63326.
cc @alexcrichton

4 years agoRollup merge of #63316 - topecongiro:rustfmt-1.4.4, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:36 +0000 (16:33 +0200)]
Rollup merge of #63316 - topecongiro:rustfmt-1.4.4, r=Mark-Simulacrum

Update rustfmt to 1.4.4

The update includes bug fixes.

4 years agoRollup merge of #63261 - RalfJung:rand, r=nikomatsakis
Mazdak Farrokhzad [Thu, 8 Aug 2019 14:33:34 +0000 (16:33 +0200)]
Rollup merge of #63261 - RalfJung:rand, r=nikomatsakis

bump rand in libcore/liballoc test suites

This pulls in the fix for https://github.com/rust-random/rand/issues/779, which trips Miri when running these test suites.

`SmallRng` (formerly used by libcore) is no longer built by default, it needs a feature gate. I opted to switch to `StdRng` instead. Or should I enable the feature gate?

4 years agoMove test
Jack [Thu, 8 Aug 2019 14:13:55 +0000 (10:13 -0400)]
Move test