]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agomake recursive-zst test unleashed
Ralf Jung [Mon, 27 Apr 2020 11:08:02 +0000 (13:08 +0200)]
make recursive-zst test unleashed

4 years agoAuto merge of #71600 - Dylan-DPC:rollup-7tvzi9n, r=Dylan-DPC
bors [Mon, 27 Apr 2020 02:38:50 +0000 (02:38 +0000)]
Auto merge of #71600 - Dylan-DPC:rollup-7tvzi9n, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68716 (Stabilize `Span::mixed_site`)
 - #71263 (Remove unused abs_path method from rustc_span::source_map::FileLoader)
 - #71409 (Point at the return type on `.into()` failure caused by `?`)
 - #71419 (add message for resolution failure because wrong namespace)
 - #71438 (Tweak some suggestions in `rustc_resolve`)
 - #71589 (remove Unique::from for shared pointer types)

Failed merges:

r? @ghost

4 years agoRollup merge of #71589 - RalfJung:unique-no-shr, r=SimonSapin
Dylan DPC [Mon, 27 Apr 2020 01:26:18 +0000 (03:26 +0200)]
Rollup merge of #71589 - RalfJung:unique-no-shr, r=SimonSapin

remove Unique::from for shared pointer types

r? @SimonSapin

4 years agoRollup merge of #71438 - estebank:resolve-sugg-tiny, r=petrochenkov
Dylan DPC [Mon, 27 Apr 2020 01:26:17 +0000 (03:26 +0200)]
Rollup merge of #71438 - estebank:resolve-sugg-tiny, r=petrochenkov

Tweak some suggestions in `rustc_resolve`

4 years agoRollup merge of #71419 - contrun:wrong-namespace-rustc-resolve, r=petrochenkov
Dylan DPC [Mon, 27 Apr 2020 01:26:15 +0000 (03:26 +0200)]
Rollup merge of #71419 - contrun:wrong-namespace-rustc-resolve, r=petrochenkov

add message for resolution failure because wrong namespace

closes https://github.com/rust-lang/rust/issues/71406

4 years agoRollup merge of #71409 - estebank:point-at-ret-question-mark-op, r=petrochenkov
Dylan DPC [Mon, 27 Apr 2020 01:26:13 +0000 (03:26 +0200)]
Rollup merge of #71409 - estebank:point-at-ret-question-mark-op, r=petrochenkov

Point at the return type on `.into()` failure caused by `?`

Fix #35946.

4 years agoRollup merge of #71263 - shlevy:FileLoader-remove-abs_path, r=Xanewok
Dylan DPC [Mon, 27 Apr 2020 01:26:11 +0000 (03:26 +0200)]
Rollup merge of #71263 - shlevy:FileLoader-remove-abs_path, r=Xanewok

Remove unused abs_path method from rustc_span::source_map::FileLoader

4 years agoRollup merge of #68716 - petrochenkov:stabmixed, r=dtolnay
Dylan DPC [Mon, 27 Apr 2020 01:26:05 +0000 (03:26 +0200)]
Rollup merge of #68716 - petrochenkov:stabmixed, r=dtolnay

Stabilize `Span::mixed_site`

Closes https://github.com/rust-lang/rust/issues/65049.
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446

Pre-requisite for https://github.com/rust-lang/rust/pull/68717 ("Stabilize fn-like proc macros in expression, pattern and statement positions").

Stabilization report: https://github.com/rust-lang/rust/pull/68716#issuecomment-581076337.

4 years agoAuto merge of #71468 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Sun, 26 Apr 2020 23:31:54 +0000 (23:31 +0000)]
Auto merge of #71468 - matthiaskrgr:submodule_upd, r=Dylan-DPC

submodules: update clippy from 891e1a85 to d01a4981

Changes:
````
`predecessors_for` will be removed soon
Rustup "Remove `BodyAndCache`"
span_lint_and_note now takes an Option<Span> for the note_span instead of just a span
Make lint also capture blocks and closures, adjust language to mention other mutex types
don't test the code in the lint docs
Switch to matching against full paths instead of just the last element of the path
Lint for holding locks across await points
fix crash on issue-69020-assoc-const-arith-overflow.rs
update stderr file
util/fetch_prs_between.sh: Add Markdown formatted Link
factor ifs into function, add differing mutex test
Update the changelog update documentation
Apply suggestions from PR review
update span_lint_and_help call to six args
test for mutex eq, add another test case
use if chain
cargo dev fmt
fix map import to rustc_middle
dev update_lints
fix internal clippy warnings
change visitor name to OppVisitor
use Visitor api to find Mutex::lock calls
add note about update-all-refs script, revert redundant pat to master
move closures to seperate fns, remove known problems
use span_lint_and_help, cargo dev fmt
creating suggestion
progress work on suggestion for auto fix
Implement unsafe_derive_deserialize lint
Update empty_enum.stderr
Formatting and naming
Formatting and naming
Cleanup: `node_id` -> `hir_id`
Fix issue #2907.
Don't trigger toplevel_ref_arg for `for` loops
Cleanup: future_not_send: use `return_ty` method
Remove badge FIXME from Cargo.toml
Change note_span argument for span_lint_and_note.
Add an Option<Span> argument to span_lint_and_help.
Fixes internal lint warning in code base.
Implement collapsible_span_lint_calls lint.
````

Fixes #71453

r? @Dylan-DPC

4 years agoAuto merge of #71593 - Dylan-DPC:rollup-ms7j94u, r=Dylan-DPC
bors [Sun, 26 Apr 2020 20:12:48 +0000 (20:12 +0000)]
Auto merge of #71593 - Dylan-DPC:rollup-ms7j94u, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71421 (Add a function to turn Box<T> into Box<[T]>)
 - #71537 (Remove support for self-opening)
 - #71551 (Minor refactoring around IndexVec usage in generator transformation)
 - #71569 ([miri] Throw UB if target size and data size don't match)
 - #71576 (check that `AsRef` and `AsMut` are inlined)

Failed merges:

 - #71558 (Cleanup and document `-Z tls-model` )

r? @ghost

4 years agoRollup merge of #71576 - lcnr:inline-as_mut, r=oli-obk
Dylan DPC [Sun, 26 Apr 2020 19:02:40 +0000 (21:02 +0200)]
Rollup merge of #71576 - lcnr:inline-as_mut, r=oli-obk

check that `AsRef` and `AsMut` are inlined

Adds a regression test for #58867

r? @Dylan-DPC

4 years agoRollup merge of #71569 - samrat:miri-ub-on-size-mismatch, r=RalfJung
Dylan DPC [Sun, 26 Apr 2020 19:02:39 +0000 (21:02 +0200)]
Rollup merge of #71569 - samrat:miri-ub-on-size-mismatch, r=RalfJung

[miri] Throw UB if target size and data size don't match

Issue: https://github.com/rust-lang/miri/issues/1355

If an extern C function is defined as

```
extern "C" {
    fn malloc(size: u32) -> *mut std::ffi::c_void;
}
```

on a 64-bit machine(ie. pointer sizes don't match), return undefined behaviour from Miri when [converting the argument into machine_usize](https://github.com/rust-lang/miri/blob/master/src/shims/foreign_items.rs#L200)

4 years agoRollup merge of #71551 - gizmondo:gen-index-vec, r=jonas-schievink
Dylan DPC [Sun, 26 Apr 2020 19:02:36 +0000 (21:02 +0200)]
Rollup merge of #71551 - gizmondo:gen-index-vec, r=jonas-schievink

Minor refactoring around IndexVec usage in generator transformation

Replace hash map with IndexVec for liveness data.
Utilize IndexVec::push return value to avoid redundant object creation.

r? @eddyb

4 years agoRollup merge of #71537 - Mark-Simulacrum:no-self-open, r=davidtwco
Dylan DPC [Sun, 26 Apr 2020 19:02:35 +0000 (21:02 +0200)]
Rollup merge of #71537 - Mark-Simulacrum:no-self-open, r=davidtwco

Remove support for self-opening

This was only used for linkage test cases, which is already covered by
the [run-make-fulldeps/symbol-visibility test](https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/symbol-visibility/Makefile) -- which fairly extensively makes
sure we're correctly exporting the right symbols at the right visibility (for
various Rust crate types).

This fixes #10379 and resolves #10356 by removing the test case (and underlying support in the compiler). AFAICT, the better way to test visibility is via nm, like the symbol visibility test. It seems like that's sufficient; I suspect that given that we don't use this we should just drop it (android is tier 2 anyway). But happy to hear otherwise.

4 years agoRollup merge of #71421 - elichai:2020-04-boxed-slice, r=sfackler
Dylan DPC [Sun, 26 Apr 2020 19:02:32 +0000 (21:02 +0200)]
Rollup merge of #71421 - elichai:2020-04-boxed-slice, r=sfackler

Add a function to turn Box<T> into Box<[T]>

Hi,
I think this is very useful, as currently it's not possible in safe rust to do this without re-allocating.
an alternative implementation of the same function can be:
```rust
pub fn into_boxed_slice<T>(boxed: Box<T>) -> Box<[T]> {
    unsafe {
        let slice = slice::from_raw_parts_mut(Box::into_raw(boxed), 1);
        Box::from_raw(slice)
    }
}
```

The only thing that makes me a little uncomfortable is this line :
> The alignment of array types is greater or equal to the alignment of its element type

from https://rust-lang.github.io/unsafe-code-guidelines/layout/arrays-and-slices.html

But then I see:
> The alignment of &T, &mut T, *const T and *mut T are the same, and are at least the word size.
> The alignment of &[T] is the word size.

from https://rust-lang.github.io/unsafe-code-guidelines/layout/pointers.html#representation

So I do believe this is valid(FWIW it also passes in miri https://play.rust-lang.org/?gist=c002b99364ee6b29862aeb3565a91c19)

4 years agoPoint at the return type on `.into()` failure caused by `?`
Esteban Küber [Wed, 22 Apr 2020 00:20:12 +0000 (17:20 -0700)]
Point at the return type on `.into()` failure caused by `?`

Fix #35946.

4 years agoTweak some suggestions in `rustc_resolve`
Esteban Küber [Wed, 22 Apr 2020 18:58:21 +0000 (11:58 -0700)]
Tweak some suggestions in `rustc_resolve`

4 years agoremove Unique::from for shared pointer types
Ralf Jung [Sun, 26 Apr 2020 17:00:57 +0000 (19:00 +0200)]
remove Unique::from for shared pointer types

4 years agoAdjust style
Ralf Jung [Sun, 26 Apr 2020 16:44:38 +0000 (18:44 +0200)]
Adjust style

4 years agoAuto merge of #71579 - Dylan-DPC:rollup-h9om2g3, r=Dylan-DPC
bors [Sun, 26 Apr 2020 15:48:58 +0000 (15:48 +0000)]
Auto merge of #71579 - Dylan-DPC:rollup-h9om2g3, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71490 (Cleanup and document `-C relocation-model`)
 - #71562 (fix more clippy warnings)
 - #71571 (Fix since attribute for nonzero_bitor impl's)
 - #71574 (proc_macro: Fix since attributes for new Span methods)
 - #71575 (Fix stable(since) attribute for BTreeMap::remove_entry)

Failed merges:

r? @ghost

4 years agoStabilize `Span::mixed_site`
Vadim Petrochenkov [Fri, 31 Jan 2020 21:18:14 +0000 (00:18 +0300)]
Stabilize `Span::mixed_site`

4 years agoRename ArgumentSizeMismatch to ScalarSizeMismatch
Samrat Man Singh [Sun, 26 Apr 2020 14:41:14 +0000 (20:11 +0530)]
Rename ArgumentSizeMismatch to ScalarSizeMismatch

4 years agoAdd success and fail tests for into_boxed_slice
Elichai Turkel [Wed, 22 Apr 2020 14:23:20 +0000 (17:23 +0300)]
Add success and fail tests for into_boxed_slice

4 years agoAdd a function to turn Box<T> into Box<[T]> (into_boxed_slice)
Elichai Turkel [Wed, 22 Apr 2020 09:39:29 +0000 (12:39 +0300)]
Add a function to turn Box<T> into Box<[T]> (into_boxed_slice)

4 years agosubmodules: update clippy from 891e1a85 to b7c802b5
Matthias Krüger [Sun, 26 Apr 2020 12:33:18 +0000 (14:33 +0200)]
submodules: update clippy from 891e1a85 to b7c802b5

Changes:
````
rustup to https://github.com/rust-lang/rust/pull/70043
map_clone: avoid suggesting `copied()` for &mut
fix redundant_pattern_matching lint
Add tests for #1654
Don't trigger while_let_on_iterator when the iterator is recreated every iteration
Update issue_2356.stderr reference file
Update while_let_on_iterator tests
Fix while_let_on_iterator suggestion and make it MachineApplicable
Add lifetime test case for `new_ret_no_self`
rustup https://github.com/rust-lang/rust/pull/71215/
Downgrade match_bool to pedantic
Run fetch before testing if master contains beta
The beta branch update should not require a force push
Add a note to the beta sections of release.md
Remove apt-get upgrade again
Always use the deploy script and templates of the master branch
README: fix lit count line
clippy_dev: make it fatal when the regex for updating lint count does not match
`predecessors_for` will be removed soon
Rustup "Remove `BodyAndCache`"
Only run (late) internal lints, when they are warn/deny/forbid
Only run cargo lints, when they are warn/deny/forbid
span_lint_and_note now takes an Option<Span> for the note_span instead of just a span
Make lint also capture blocks and closures, adjust language to mention other mutex types
don't test the code in the lint docs
Switch to matching against full paths instead of just the last element of the path
Lint for holding locks across await points
Also mention `--fix` for nightly users
fix crash on issue-69020-assoc-const-arith-overflow.rs
Address review comments
remark fixes
Update CHANGELOG.md for Rust 1.43 and 1.44
update stderr file
util/fetch_prs_between.sh: Add Markdown formatted Link
factor ifs into function, add differing mutex test
Update the changelog update documentation
Apply suggestions from PR review
update span_lint_and_help call to six args
test for mutex eq, add another test case
use if chain
cargo dev fmt
fix map import to rustc_middle
dev update_lints
fix internal clippy warnings
change visitor name to OppVisitor
use Visitor api to find Mutex::lock calls
add note about update-all-refs script, revert redundant pat to master
move closures to seperate fns, remove known problems
use span_lint_and_help, cargo dev fmt
creating suggestion
progress work on suggestion for auto fix
Implement unsafe_derive_deserialize lint
Update empty_enum.stderr
Formatting and naming
Formatting and naming
Cleanup: `node_id` -> `hir_id`
Fix issue #2907.
Don't trigger toplevel_ref_arg for `for` loops
Cleanup: future_not_send: use `return_ty` method
Remove badge FIXME from Cargo.toml
Change note_span argument for span_lint_and_note.
Add an Option<Span> argument to span_lint_and_help.
Fixes internal lint warning in code base.
Implement collapsible_span_lint_calls lint.
````

Fixes #71453

4 years agoRollup merge of #71575 - jplatte:patch-4, r=Mark-Simulacrum
Dylan DPC [Sun, 26 Apr 2020 11:42:35 +0000 (13:42 +0200)]
Rollup merge of #71575 - jplatte:patch-4, r=Mark-Simulacrum

Fix stable(since) attribute for BTreeMap::remove_entry

Stabilized in #70712.

Maybe checking that the since attributes are added correctly should be automated through tidy? This is the third PR I'm opening that fixes a stable(since) attribute for something meant to be stabilized in 1.43 / 1.44 initially but then only stabilized in 1.45. (the other two are #71571, #71574)

4 years agoRollup merge of #71574 - jplatte:patch-2, r=petrochenkov
Dylan DPC [Sun, 26 Apr 2020 11:42:33 +0000 (13:42 +0200)]
Rollup merge of #71574 - jplatte:patch-2, r=petrochenkov

proc_macro: Fix since attributes for new Span methods

Added in #69041, took a while to merge so the since attributes went out of date.

4 years agoRollup merge of #71571 - jplatte:patch-1, r=jonas-schievink
Dylan DPC [Sun, 26 Apr 2020 11:42:32 +0000 (13:42 +0200)]
Rollup merge of #71571 - jplatte:patch-1, r=jonas-schievink

Fix since attribute for nonzero_bitor impl's

Added in #69813, took a while to merge so the since attributes went out of date.

4 years agoRollup merge of #71562 - matthiaskrgr:cl7ppy, r=Dylan-DPC
Dylan DPC [Sun, 26 Apr 2020 11:42:31 +0000 (13:42 +0200)]
Rollup merge of #71562 - matthiaskrgr:cl7ppy, r=Dylan-DPC

fix more clippy warnings

clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}

r? @Dylan-DPC

4 years agoRollup merge of #71490 - petrochenkov:passcheck2, r=davidtwco
Dylan DPC [Sun, 26 Apr 2020 11:42:29 +0000 (13:42 +0200)]
Rollup merge of #71490 - petrochenkov:passcheck2, r=davidtwco

Cleanup and document `-C relocation-model`

As the title says, this is mostly a refactoring and documentation.

One potentially observable change here is that `-C relocation-model=default` now takes the default from the Rust target, rather than from the underlying LLVM target. In other words, `-C relocation-model=default` is now equivalent to not specifying the relocation model on command line at all.
Apparently no one used that option because it has other bugs as well, e.g. PIC `default` wasn't treated as PIC in some places.

4 years agocheck that `AsRef` and `AsMut` are inlined
Bastian Kauschke [Sun, 26 Apr 2020 10:43:00 +0000 (12:43 +0200)]
check that `AsRef` and `AsMut` are inlined

4 years agoFix stable(since) attribute for BTreeMap::remove_entry
Jonas Platte [Sun, 26 Apr 2020 10:31:05 +0000 (12:31 +0200)]
Fix stable(since) attribute for BTreeMap::remove_entry

4 years agoproc_macro: Fix since attributes for new Span methods
Jonas Platte [Sun, 26 Apr 2020 10:08:42 +0000 (12:08 +0200)]
proc_macro: Fix since attributes for new Span methods

4 years agoFix since attribute for nonzero_bitor impl's
Jonas Platte [Sun, 26 Apr 2020 09:28:44 +0000 (11:28 +0200)]
Fix since attribute for nonzero_bitor impl's

4 years agotests: Remove unnecessary `-C relocation-model=dynamic-no-pic`s
Vadim Petrochenkov [Thu, 23 Apr 2020 21:56:19 +0000 (00:56 +0300)]
tests: Remove unnecessary `-C relocation-model=dynamic-no-pic`s

The referenced `sanitizer-address/Makefile` no longer exists, so perhaps these options are no longer necessary as well.
Even if they are still necessary, they should use `-C relocation-model=static` instead.

4 years agorustc-book: Document `-C relocation-model`
Vadim Petrochenkov [Thu, 23 Apr 2020 21:53:25 +0000 (00:53 +0300)]
rustc-book: Document `-C relocation-model`

4 years agocodegen_llvm: Simplify logic for relaxing PIC into PIE
Vadim Petrochenkov [Thu, 23 Apr 2020 18:10:01 +0000 (21:10 +0300)]
codegen_llvm: Simplify logic for relaxing PIC into PIE

4 years agocodegen_llvm: `RelocMode` -> `RelocModel`
Vadim Petrochenkov [Thu, 23 Apr 2020 17:49:00 +0000 (20:49 +0300)]
codegen_llvm: `RelocMode` -> `RelocModel`

4 years agorustc_target: Stop using "string typing" for relocation models
Vadim Petrochenkov [Wed, 22 Apr 2020 21:46:45 +0000 (00:46 +0300)]
rustc_target: Stop using "string typing" for relocation models

Introduce `enum RelocModel` instead.

4 years agoAuto merge of #71495 - Amanieu:update_stdarch, r=sfackler
bors [Sun, 26 Apr 2020 07:41:28 +0000 (07:41 +0000)]
Auto merge of #71495 - Amanieu:update_stdarch, r=sfackler

Update stdarch submodule

Includes :
- https://github.com/rust-lang/stdarch/pull/849 which stabilizes the remaining x86 features for feature detection.
- https://github.com/rust-lang/stdarch/pull/850 which fixes building stdarch on FreeBSD.

Fixes #71473

4 years agoAuto merge of #71434 - pietroalbini:shrink-gha-config, r=Mark-Simulacrum
bors [Sun, 26 Apr 2020 04:30:24 +0000 (04:30 +0000)]
Auto merge of #71434 - pietroalbini:shrink-gha-config, r=Mark-Simulacrum

Shrink GHA configuration

This shrinks our GHA configuration by [taking advantage of two new features GitHub just announced](https://github.blog/2020-04-22-github-actions-community-momentum-enterprise-capabilities-and-developer-improvements/):

* [Default values for `steps[].shell`](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun)
* [Being able to include values in a matrix without having to duplicate the job names.](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations)

The configuration should be functionally equivalent to the previous one.

r? @Mark-Simulacrum

4 years ago[miri] Throw UB if target size and data size don't match
Samrat Man Singh [Sun, 26 Apr 2020 03:28:22 +0000 (08:58 +0530)]
[miri] Throw UB if target size and data size don't match

If an extern C function is defined as

```
extern "C" {
    fn malloc(size: u32) -> *mut std::ffi::c_void;
}
```

on a 64-bit machine(ie. pointer sizes don't match), throw an undefined
behaviour.

4 years agouse defkind.descr in wrong namespace resolve failure
YI [Sun, 26 Apr 2020 02:28:33 +0000 (10:28 +0800)]
use defkind.descr in wrong namespace resolve failure

4 years agoAuto merge of #71566 - Dylan-DPC:rollup-9xoz6fg, r=Dylan-DPC
bors [Sun, 26 Apr 2020 01:12:20 +0000 (01:12 +0000)]
Auto merge of #71566 - Dylan-DPC:rollup-9xoz6fg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70043 (Add all remaining `DefKind`s.)
 - #71140 ([breaking change] Disallow statics initializing themselves)
 - #71392 (Don't hold the predecessor cache lock longer than necessary)
 - #71541 (Add regression test for #26376)
 - #71554 (Replace thread_local with generator resume arguments in box_region.)

Failed merges:

r? @ghost

4 years agofix more clippy warnings
Matthias Krüger [Sat, 25 Apr 2020 08:17:14 +0000 (10:17 +0200)]
fix more clippy warnings

clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}

4 years agoRollup merge of #71554 - gizmondo:68922, r=jonas-schievink
Dylan DPC [Sat, 25 Apr 2020 23:00:20 +0000 (01:00 +0200)]
Rollup merge of #71554 - gizmondo:68922, r=jonas-schievink

Replace thread_local with generator resume arguments in box_region.

Fixes #68922.

Continuation of #70622. Added a short doc, hope it makes sense.

r? @jonas-schievink

4 years agoRollup merge of #71541 - wesleywiser:issue_26376, r=Dylan-DPC
Dylan DPC [Sat, 25 Apr 2020 23:00:19 +0000 (01:00 +0200)]
Rollup merge of #71541 - wesleywiser:issue_26376, r=Dylan-DPC

Add regression test for #26376

Closes #26376

4 years agoRollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, r=nikomatsakis
Dylan DPC [Sat, 25 Apr 2020 23:00:17 +0000 (01:00 +0200)]
Rollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, r=nikomatsakis

Don't hold the predecessor cache lock longer than necessary

#71044 returns a `LockGuard` with the predecessor cache to callers of `Body::predecessors`. As a result, the lock around the predecessor cache could be held for an arbitrarily long time. This PR uses reference counting for ownership of the predecessor cache, meaning the lock is only ever held within `PredecessorCache::compute`. Checking this API for potential sources of deadlock is much easier now, since we no longer have to consider its consumers, only its internals.

This required removing `predecessors_for`, since there is no equivalent to `LockGuard::map` for `Arc` and `Rc`. I believe this could be emulated with `owning_ref::{Arc,Rc}Ref`, but I don't think it's necessary. Also, we continue to return an opaque type from `Body::predecessors` with the lifetime of the `Body`, not `'static`.

This depends on #71044. Only the last two commits are new.

r? @nikomatsakis

4 years agoRollup merge of #71140 - oli-obk:static_cycle, r=RalfJung
Dylan DPC [Sat, 25 Apr 2020 23:00:15 +0000 (01:00 +0200)]
Rollup merge of #71140 - oli-obk:static_cycle, r=RalfJung

[breaking change] Disallow statics initializing themselves

fixes #71078

Self-initialization is unsound because it breaks privacy assumptions that unsafe code can make. In

```rust
pub mod foo {
    #[derive(Debug, Copy, Clone)]
    pub struct Foo {
        x: (),
    }
}

pub static FOO: foo::Foo = FOO;
```

unsafe could could expect that ony functions inside the `foo` module were able to create a value of type `Foo`.

4 years agoRollup merge of #70043 - mark-i-m:def-kind-more, r=eddyb
Dylan DPC [Sat, 25 Apr 2020 23:00:13 +0000 (01:00 +0200)]
Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddyb

Add all remaining `DefKind`s.

r? @eddyb or @Centril

~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~

~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~

4 years agoAuto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPC
bors [Sat, 25 Apr 2020 17:49:00 +0000 (17:49 +0000)]
Auto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`)
 - #69813 (Implement BitOr and BitOrAssign for the NonZero integer types)
 - #70712 (stabilize BTreeMap::remove_entry)
 - #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`)
 - #71544 (Replace filter_map().next() calls with find_map())
 - #71545 (Fix comment in docstring example for Error::kind)
 - #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.)

Failed merges:

r? @ghost

4 years agoRollup merge of #71548 - crlf0710:cursor_bounds, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:34 +0000 (18:30 +0200)]
Rollup merge of #71548 - crlf0710:cursor_bounds, r=Amanieu

Add missing Send and Sync impls for linked list Cursor and CursorMut.

Someone pointed out these to me, and i think it's indeed reasonable to add those impl.

r? @Amanieu

4 years agoRollup merge of #71545 - Askaholic:patch-1, r=jonas-schievink
Dylan DPC [Sat, 25 Apr 2020 16:30:32 +0000 (18:30 +0200)]
Rollup merge of #71545 - Askaholic:patch-1, r=jonas-schievink

Fix comment in docstring example for Error::kind

Saw it while reading the docs.

4 years agoRollup merge of #71544 - cuviper:filter_map_next, r=Mark-Simulacrum
Dylan DPC [Sat, 25 Apr 2020 16:30:30 +0000 (18:30 +0200)]
Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-Simulacrum

Replace filter_map().next() calls with find_map()

These are semantically the same, but `find_map()` is more concise.

4 years agoRollup merge of #71168 - SimonSapin:into_raw_non_null, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:29 +0000 (18:30 +0200)]
Rollup merge of #71168 - SimonSapin:into_raw_non_null, r=Amanieu

Deprecate `{Box,Rc,Arc}::into_raw_non_null`

Per ongoing FCP at https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
See also https://github.com/rust-lang/rust/issues/47336#issuecomment-614054164

4 years agoRollup merge of #70712 - :stabilize-remove-entry, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:27 +0000 (18:30 +0200)]
Rollup merge of #70712 - :stabilize-remove-entry, r=Amanieu

stabilize BTreeMap::remove_entry

This PR stabilizes `BTreeMap::remove_entry` as implemented in https://github.com/rust-lang/rust/pull/68378.

Closes https://github.com/rust-lang/rust/issues/66714

4 years agoRollup merge of #69813 - thomcc:nonzero-bitor, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:24 +0000 (18:30 +0200)]
Rollup merge of #69813 - thomcc:nonzero-bitor, r=Amanieu

Implement BitOr and BitOrAssign for the NonZero integer types

This provides overloaded operators for `NonZero$Int | NonZero$Int`, `NonZero$Int | $Int`, and `$Int | NonZero$Int`. It also provides `BitOrAssign` where `self` is `NonZero$Int`, for symmetry.

It's a pretty small conceptual addition, but is good becasue but avoids a case where the operation is obviously sound, but you'd otherwise need unsafe to do it.

In crates trying to minimize `unsafe` usage, this is unfortunate and makes working with `NonZero` types often not worth it, even if the operations you're doing are clearly sound.

I've marked these as stable as I've been told in the past that trait impls are automatically stable. I'm happy to change it to unstable if this wasn't correct information.

I'm not entirely confident what version I should have put down, so I followed https://www.whatrustisit.com. Hopefully it's correct for this.

Apologies in advance if this has come up before, but I couldn't find it.

4 years agoRollup merge of #69041 - petrochenkov:stabmodispan, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 16:30:22 +0000 (18:30 +0200)]
Rollup merge of #69041 - petrochenkov:stabmodispan, r=Amanieu

proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`

Introduced in https://github.com/rust-lang/rust/pull/47149.
Part of https://github.com/rust-lang/rust/issues/54725.

Motivation: https://github.com/rust-lang/rust/pull/68716#issuecomment-583918919.
Identifiers in proc macros may want to inherit span locations for diagnostics from one tokens (e.g. some tokens from the macro input), but resolve those identifiers from some different location (e.g. from the macro's definition site).
This becomes especially important when multiple resolution locations become available with stabilization of [`Span::mixed_site`](https://github.com/rust-lang/rust/pull/68716).

Why I think this is the right API for setting span's location and hygiene - https://github.com/rust-lang/rust/pull/69041#issuecomment-586644778.

r? @dtolnay

4 years agoReplace thread_local with generator resume arguments in box_region.
Alex Aktsipetrov [Tue, 31 Mar 2020 16:49:05 +0000 (18:49 +0200)]
Replace thread_local with generator resume arguments in box_region.

4 years agoRemove support for self-opening
Mark Rousskov [Fri, 24 Apr 2020 22:31:42 +0000 (18:31 -0400)]
Remove support for self-opening

This was only used for linkage test cases, which is already covered by
the run-make-fulldeps/symbol-visibility test -- which fairly extensively makes
sure we're correctly exporting the right symbols at the right visibility (for
various Rust crate types).

4 years agoUse the correct bound for `Cursor` `Send`
Charles Lew [Sat, 25 Apr 2020 14:48:16 +0000 (22:48 +0800)]
Use the correct bound for `Cursor` `Send`

Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
4 years agoAuto merge of #71439 - Mark-Simulacrum:stage0-next, r=jonas-schievink
bors [Sat, 25 Apr 2020 14:15:10 +0000 (14:15 +0000)]
Auto merge of #71439 - Mark-Simulacrum:stage0-next, r=jonas-schievink

Bump bootstrap compiler

This bumps the bootstrap compiler and the rustfmt that x.py fmt uses.

4 years agoBump rustfmt to most recently shipped
Mark Rousskov [Wed, 22 Apr 2020 20:16:43 +0000 (16:16 -0400)]
Bump rustfmt to most recently shipped

4 years agoBump bootstrap compiler
Mark Rousskov [Wed, 22 Apr 2020 19:45:35 +0000 (15:45 -0400)]
Bump bootstrap compiler

4 years agoAdd a test for `Span::resolved_at` and `Span::located_at`
Vadim Petrochenkov [Sat, 18 Apr 2020 15:49:03 +0000 (18:49 +0300)]
Add a test for `Span::resolved_at` and `Span::located_at`

4 years agoproc_macro: Stabilize `Span::resolved_at` and `Span::located_at`
Vadim Petrochenkov [Mon, 10 Feb 2020 17:42:04 +0000 (20:42 +0300)]
proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`

4 years agoReplace hash map with IndexVec for liveness data.
Alex Aktsipetrov [Sat, 25 Apr 2020 11:46:37 +0000 (13:46 +0200)]
Replace hash map with IndexVec for liveness data.
Utilize IndexVec::push to avoid redundant object creation.

4 years agoAuto merge of #71549 - Dylan-DPC:rollup-j6jlp9l, r=Dylan-DPC
bors [Sat, 25 Apr 2020 10:50:13 +0000 (10:50 +0000)]
Auto merge of #71549 - Dylan-DPC:rollup-j6jlp9l, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71364 (Ignore -Zprofile when building compiler_builtins)
 - #71494 (Fix span of while (let) expressions after lowering)
 - #71517 ( Quick and dirty fix of the unused_braces lint)
 - #71523 (Take a single root node in range_search)
 - #71533 (Revert PR 70566 for const validation fix)

Failed merges:

r? @ghost

4 years agoRollup merge of #71533 - pnkfelix:revert-70566-for-const-validation-fix, r=Dylan-DPC
Dylan DPC [Sat, 25 Apr 2020 09:25:55 +0000 (11:25 +0200)]
Rollup merge of #71533 - pnkfelix:revert-70566-for-const-validation-fix, r=Dylan-DPC

Revert PR 70566 for const validation fix

This is a port of PR #71441 but ported to the master branch, as discussed in [yesterday's T-compiler meeting](https://zulip-archive.rust-lang.org/131828tcompiler/88751weeklymeeting2020042354818.html#195065903)

4 years agoRollup merge of #71523 - Mark-Simulacrum:alloc-inline-dup, r=Amanieu
Dylan DPC [Sat, 25 Apr 2020 09:25:53 +0000 (11:25 +0200)]
Rollup merge of #71523 - Mark-Simulacrum:alloc-inline-dup, r=Amanieu

Take a single root node in range_search

The unsafe code can be justified within range_search, as it makes sure to not
overlap the returned references, but from the callers perspective it's an
entirely safe algorithm and there's no need for the caller to know about the
duplication.

cc @ssomers
r? @Amanieu

4 years agoRollup merge of #71517 - flip1995:unused_braces_hack, r=oli-obk
Dylan DPC [Sat, 25 Apr 2020 09:25:51 +0000 (11:25 +0200)]
Rollup merge of #71517 - flip1995:unused_braces_hack, r=oli-obk

 Quick and dirty fix of the unused_braces lint

cc @lcnr

Adresses #70814

This at least prevents lint output, if no span is available. Even though this also prevents the `unused_parens` lint from emitting, when the `DUMMY_SP` is used there, but I think that should be ok, since error messages without a span are quite useless anyway.

Clippy CI is currently blocked on this bug. If this quick and dirty fix should be rejected, I could try to work around this in Clippy.

r? @shepmaster

4 years agoRollup merge of #71494 - flip1995:while_let_span, r=petrochenkov
Dylan DPC [Sat, 25 Apr 2020 09:25:50 +0000 (11:25 +0200)]
Rollup merge of #71494 - flip1995:while_let_span, r=petrochenkov

Fix span of while (let) expressions after lowering

Credit goes to @alex-700 who found this while trying to fix a suggestion in Clippy.

While `if`, `try`, `for` and `await` expressions get the span of the original expression when desugared, `while` loops got the span of the scrutinee, which lead to weird code, when building the suggestion, that randomly worked: https://github.com/rust-lang/rust-clippy/pull/5511/files#diff-df4e9d2bf840a5f2e3b580bef73da3bcR106-R108

I'm wondering, if `DesugaringKind` should get a variant `WhileLoop` and instead of using the span of the `ast::ExprKind::While` expr directly, a new span with `self.mark_span_with_reason` should be used, like it is done with `for` loops.

There was some fallout, but I think that is acceptable. If not, I need some help to find out where this can be fixed.

4 years agoRollup merge of #71364 - Amanieu:zprofile_compiler_builtins, r=cramertj
Dylan DPC [Sat, 25 Apr 2020 09:25:48 +0000 (11:25 +0200)]
Rollup merge of #71364 - Amanieu:zprofile_compiler_builtins, r=cramertj

Ignore -Zprofile when building compiler_builtins

#70846 made the `compiler_builtins` crate ignore the default codegen-units setting and instead always split each function into a different codegen unit.

This unfortunately breaks `-Zprofile` which requires a single codegen unit per crate (see #71283). You can notice this when building with `cargo -Zbuild-std` and `RUSTFLAGS` containing `-Zprofile`.

This PR works around this issue by just ignoring `-Zprofile` for the `compiler-builtins` crate.

4 years agoAdd missing Send and Sync bounds for linked list Cursor and CursorMut.
Charles Lew [Sat, 25 Apr 2020 08:33:11 +0000 (16:33 +0800)]
Add missing Send and Sync bounds for linked list Cursor and CursorMut.

4 years agoAuto merge of #71458 - ecstatic-morse:bootstrap-cfg-doc, r=Mark-Simulacrum
bors [Sat, 25 Apr 2020 07:26:17 +0000 (07:26 +0000)]
Auto merge of #71458 - ecstatic-morse:bootstrap-cfg-doc, r=Mark-Simulacrum

Set `--cfg bootstrap` for stage0 rustdoc

Resolves #71455.

With this patch, running `./x.py doc --stage 0 src/libstd` with a clean `build` dir successfully outputs docs for `core`, `alloc` and `std` in under a minute. This kind of turnaround for viewing small changes to the standard library documentation is quite nice, and I think we should endeavour to keep it working. I'm not sure how involved that would be though.

r? @Mark-Simulacrum

4 years agoFix comment in docstring example for Error::kind
Askaholic [Sat, 25 Apr 2020 04:33:11 +0000 (04:33 +0000)]
Fix comment in docstring example for Error::kind

4 years agoReplace filter_map().next() calls with find_map()
Josh Stone [Sat, 25 Apr 2020 03:03:45 +0000 (20:03 -0700)]
Replace filter_map().next() calls with find_map()

These are semantically the same, but `find_map()` is more concise.

4 years agoAdd regression test for #26376
Wesley Wiser [Sat, 25 Apr 2020 00:27:17 +0000 (20:27 -0400)]
Add regression test for #26376

4 years agoAuto merge of #71539 - Dylan-DPC:rollup-a2vbfh9, r=Dylan-DPC
bors [Fri, 24 Apr 2020 23:36:52 +0000 (23:36 +0000)]
Auto merge of #71539 - Dylan-DPC:rollup-a2vbfh9, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #69456 (fix misleading type annotation diagonstics)
 - #71330 (Only run dataflow for const qualification if type-based check would fail)
 - #71480 (Improve PanicInfo examples readability)
 - #71485 (Add BinaryHeap::retain as suggested in #42849)
 - #71512 (Remove useless "" args)
 - #71527 (Miscellaneous cleanup in `check_consts`)
 - #71534 (Avoid unused Option::map results)
 - #71535 (Fix typos in docs for keyword "in")

Failed merges:

r? @ghost

4 years agoRollup merge of #71535 - workingjubilee:jubilee-markdown-fix, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:05 +0000 (01:36 +0200)]
Rollup merge of #71535 - workingjubilee:jubilee-markdown-fix, r=Mark-Simulacrum

Fix typos in docs for keyword "in"

Erroneous .md formatting was causing the link to not work on the currently-nightly keyword docs for `in`, and also there was a simple typo.

4 years agoRollup merge of #71534 - cuviper:unused-option-map, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:04 +0000 (01:36 +0200)]
Rollup merge of #71534 - cuviper:unused-option-map, r=Mark-Simulacrum

Avoid unused Option::map results

These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.

r? @Mark-Simulacrum

4 years agoRollup merge of #71527 - ecstatic-morse:debug-check-consts, r=Dylan-DPC
Dylan DPC [Fri, 24 Apr 2020 23:36:02 +0000 (01:36 +0200)]
Rollup merge of #71527 - ecstatic-morse:debug-check-consts, r=Dylan-DPC

Miscellaneous cleanup in `check_consts`

Just changes `RUSTC_LOG` output.

4 years agoRollup merge of #71512 - Rustin-Liu:rustin-patch-bootstrap, r=Mark-Simulacrum
Dylan DPC [Fri, 24 Apr 2020 23:36:01 +0000 (01:36 +0200)]
Rollup merge of #71512 - Rustin-Liu:rustin-patch-bootstrap, r=Mark-Simulacrum

Remove useless "" args

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoRollup merge of #71485 - arlopurcell:binary_heap_retain, r=Amanieu
Dylan DPC [Fri, 24 Apr 2020 23:35:59 +0000 (01:35 +0200)]
Rollup merge of #71485 - arlopurcell:binary_heap_retain, r=Amanieu

Add BinaryHeap::retain as suggested in #42849

This PR implements retain for BinaryHeap as suggested in #42849.

This is my first PR for Rust, so please let me know if I should be doing anything differently, thanks!

4 years agoRollup merge of #71480 - GuillaumeGomez:panic-info-example, r=Dylan-DPC
Dylan DPC [Fri, 24 Apr 2020 23:35:57 +0000 (01:35 +0200)]
Rollup merge of #71480 - GuillaumeGomez:panic-info-example, r=Dylan-DPC

Improve PanicInfo examples readability

cc @Eijebong

r? @Dylan-DPC

4 years agoRollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obk
Dylan DPC [Fri, 24 Apr 2020 23:35:55 +0000 (01:35 +0200)]
Rollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obk

Only run dataflow for const qualification if type-based check would fail

This is the optimization discussed in https://github.com/rust-lang/rust/issues/49146#issuecomment-614012476. We wait for `Qualif::in_any_value_of_ty` to return `true` before running dataflow. For bodies that deal mostly with primitive types, this will avoid running dataflow at all during const qualification.

This also removes the `BitSet` used to cache `in_any_value_of_ty` for each local, which was only necessary for an old version of #64470 that also handled promotability.

4 years agoRollup merge of #69456 - contrun:fix-misleading-compiler-error, r=estebank
Dylan DPC [Fri, 24 Apr 2020 23:35:53 +0000 (01:35 +0200)]
Rollup merge of #69456 - contrun:fix-misleading-compiler-error, r=estebank

fix misleading type annotation diagonstics

This solves the method call part of issue https://github.com/rust-lang/rust/issues/69455

4 years agoUpdate stdarch submodule
Amanieu d'Antras [Thu, 23 Apr 2020 23:38:10 +0000 (00:38 +0100)]
Update stdarch submodule

4 years agoFix typos in docs for keyword "in"
Jubilee Young [Fri, 24 Apr 2020 20:07:57 +0000 (13:07 -0700)]
Fix typos in docs for keyword "in"

4 years agoAvoid unused Option::map results
Josh Stone [Fri, 24 Apr 2020 20:58:41 +0000 (13:58 -0700)]
Avoid unused Option::map results

These are changes that would be needed if we add `#[must_use]` to
`Option::map`, per #71484.

4 years agoadjust tests
Ralf Jung [Wed, 22 Apr 2020 20:50:31 +0000 (22:50 +0200)]
adjust tests

4 years agoRevert "Move early needs_subst bailout to _after_ linting."
Ralf Jung [Wed, 22 Apr 2020 17:03:30 +0000 (19:03 +0200)]
Revert "Move early needs_subst bailout to _after_ linting."

This reverts commit 99492e41b60f21f2f461e8131605e054020d328e.

4 years agotidy
mark [Fri, 24 Apr 2020 19:48:10 +0000 (14:48 -0500)]
tidy

4 years agofix a couple more uses of def_kind
mark [Fri, 24 Apr 2020 19:26:11 +0000 (14:26 -0500)]
fix a couple more uses of def_kind

4 years agoRemove unused `visit_local`
Dylan MacKenzie [Fri, 24 Apr 2020 19:07:44 +0000 (12:07 -0700)]
Remove unused `visit_local`

4 years agoUse `debug` to print illegal operations in a const context
Dylan MacKenzie [Fri, 24 Apr 2020 19:07:33 +0000 (12:07 -0700)]
Use `debug` to print illegal operations in a const context

4 years agoRemove redundant `descr`/`descriptive_variant` methods from HIR.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 20:00:12 +0000 (23:00 +0300)]
Remove redundant `descr`/`descriptive_variant` methods from HIR.

4 years agoTweak `descr` for `AnonConst` and fix `article` for `Use` and `ExternCrate`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 20:00:00 +0000 (23:00 +0300)]
Tweak `descr` for `AnonConst` and fix `article` for `Use` and `ExternCrate`.

4 years agoRemove `Option` from the return type of `def_kind`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 18:55:17 +0000 (21:55 +0300)]
Remove `Option` from the return type of `def_kind`.

4 years agoSplit out the `Generator` case from `DefKind::Closure`.
Eduard-Mihai Burtescu [Fri, 17 Apr 2020 13:55:08 +0000 (16:55 +0300)]
Split out the `Generator` case from `DefKind::Closure`.