]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #78098 - camelid:fixup-docs, r=steveklabnik
Yuki Okushi [Fri, 23 Oct 2020 09:26:28 +0000 (18:26 +0900)]
Rollup merge of #78098 - camelid:fixup-docs, r=steveklabnik

Clean up and improve some docs

* compiler docs
  * Don't format list as part of a code block
  * Clean up some other formatting
* rustdoc book
  * Update CommonMark spec version to latest (0.28 -> 0.29)
  * Clean up some various wording and formatting

3 years agoRollup merge of #77969 - ryan-scott-dev:bigo-notation-consistency, r=m-ou-se
Yuki Okushi [Fri, 23 Oct 2020 09:26:26 +0000 (18:26 +0900)]
Rollup merge of #77969 - ryan-scott-dev:bigo-notation-consistency, r=m-ou-se

Doc formating consistency between slice sort and sort_unstable, and big O notation consistency

Updated documentation for slice sorting methods to be consistent between stable and unstable versions, which just ended up being minor formatting differences.

I also went through and updated any doc comments with big O notation to be consistent with #74010 by italicizing them rather than having them in a code block.

3 years agoRollup merge of #77920 - ayazhafiz:i/mut-ident-spacing, r=jyn514
Yuki Okushi [Fri, 23 Oct 2020 09:26:24 +0000 (18:26 +0900)]
Rollup merge of #77920 - ayazhafiz:i/mut-ident-spacing, r=jyn514

Avoid extraneous space between visibility kw and ident for statics

Today, given a static like `static mut FOO: usize = 1`, rustdoc would
emit `static mut  FOO: usize = 1`, as it emits both the mutability kw
with a space and reserves a space after the mutability kw. This patch
fixes that misformatting.

This patch also adds some tests for emit of other statics, as I could
not find an existing test devoted to statics.

3 years agoRollup merge of #77918 - wcampbell0x2a:cleanup-network-tests, r=m-ou-se
Yuki Okushi [Fri, 23 Oct 2020 09:26:22 +0000 (18:26 +0900)]
Rollup merge of #77918 - wcampbell0x2a:cleanup-network-tests, r=m-ou-se

Cleanup network tests

Some cleanup for network related tests

3 years agoRollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus
Yuki Okushi [Fri, 23 Oct 2020 09:26:20 +0000 (18:26 +0900)]
Rollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus

Fixing escaping to ensure generation of welformed json.

doc tests' json name have a filename in them. When json test output is asked for on windows currently produces invalid json.
Tracking issue for json test output: #49359

3 years agoRollup merge of #77488 - varkor:repr128-incomplete_features, r=jonas-schievink
Yuki Okushi [Fri, 23 Oct 2020 09:26:18 +0000 (18:26 +0900)]
Rollup merge of #77488 - varkor:repr128-incomplete_features, r=jonas-schievink

Mark `repr128` as `incomplete_features`

As mentioned in https://github.com/rust-lang/rust/issues/56071 and noticed in https://github.com/rust-lang/rust/issues/77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it.

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

3 years agoRollup merge of #77339 - fusion-engineering-forks:tryfrom-nonzero-to-nonzero, r=dtolnay
Yuki Okushi [Fri, 23 Oct 2020 09:26:16 +0000 (18:26 +0900)]
Rollup merge of #77339 - fusion-engineering-forks:tryfrom-nonzero-to-nonzero, r=dtolnay

Implement TryFrom between NonZero types.

This will instantly be stable, as trait implementations for stable types and traits can not be `#[unstable]`.

Closes #77258.

@rustbot modify labels: +T-libs

3 years agoRollup merge of #77268 - follower:patch-3, r=jyn514
Yuki Okushi [Fri, 23 Oct 2020 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #77268 - follower:patch-3, r=jyn514

Link to "Contributing to Rust" rather than "Getting Started".

Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that:

 * The GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file.

 * The "Bug Report" section _seems_ to restrict itself to if "a compiler error message [told] you to come here".

 * The previous content of `CONTRIBUTING.md` now lives in the "Contributing to Rust" chapter.

When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific, the choice of linked chapter could be updated.

In the meantime this prevents leading first time contributors into a confusing cul de sac.

_[I wasn't planning to make a PR for this until discussion in #77215 concluded but the discovery that the "first issue" pop-up also links to this document IMO makes it a higher priority to make the link useful sooner rather than later.]_

Related issues:

 * https://github.com/rust-lang/rust/issues/77215

 * https://github.com/rust-lang/rustc-dev-guide/issues/775#issuecomment-699063082

3 years agoreview
Bastian Kauschke [Fri, 23 Oct 2020 07:33:47 +0000 (09:33 +0200)]
review

3 years agoAdd regression test for issue-71732
Yuki Okushi [Fri, 23 Oct 2020 07:22:11 +0000 (16:22 +0900)]
Add regression test for issue-71732

3 years agoMake it regression test of issue-77668
Yuki Okushi [Fri, 23 Oct 2020 07:11:46 +0000 (16:11 +0900)]
Make it regression test of issue-77668

3 years agoAdd a regression test for issue-72616
Yuki Okushi [Fri, 23 Oct 2020 07:10:19 +0000 (16:10 +0900)]
Add a regression test for issue-72616

3 years agoAdd regression test for issue-77475
Yuki Okushi [Fri, 23 Oct 2020 07:09:17 +0000 (16:09 +0900)]
Add regression test for issue-77475

3 years agoDon't re-export std::ops::ControlFlow in the compiler.
Leonora Tindall [Wed, 21 Oct 2020 14:51:13 +0000 (09:51 -0500)]
Don't re-export std::ops::ControlFlow in the compiler.

3 years agochange the order of type arguments on ControlFlow
Leonora Tindall [Fri, 11 Sep 2020 21:36:58 +0000 (16:36 -0500)]
change the order of type arguments on ControlFlow

This allows ControlFlow<BreakType> which is much more ergonomic for
common iterator combinator use cases.

3 years agoDocument inline-const in the Unstable Book
Camelid [Thu, 22 Oct 2020 21:22:09 +0000 (14:22 -0700)]
Document inline-const in the Unstable Book

3 years agoReduce diagram mess in 'match arms have incompatible types' error
David Tolnay [Thu, 22 Oct 2020 21:20:02 +0000 (14:20 -0700)]
Reduce diagram mess in 'match arms have incompatible types' error

3 years agoAdd test of incompatible match arm types with multiline arm
David Tolnay [Thu, 22 Oct 2020 23:08:26 +0000 (16:08 -0700)]
Add test of incompatible match arm types with multiline arm

3 years agoBump LLVM for DeadArgElim fix
Aaron Hill [Thu, 22 Oct 2020 21:57:14 +0000 (17:57 -0400)]
Bump LLVM for DeadArgElim fix

Fixes #76387

Pulls in https://github.com/rust-lang/llvm-project/pull/82

3 years agoimprove const infer error
Bastian Kauschke [Thu, 22 Oct 2020 21:07:48 +0000 (23:07 +0200)]
improve const infer error

3 years agoRetire rustc_dep_node_try_load_from_on_disk_cache.
Camille GILLOT [Sun, 11 Oct 2020 19:18:59 +0000 (21:18 +0200)]
Retire rustc_dep_node_try_load_from_on_disk_cache.

3 years agoRetire rustc_dep_node_force.
Camille GILLOT [Sun, 11 Oct 2020 18:58:31 +0000 (20:58 +0200)]
Retire rustc_dep_node_force.

3 years agoUnify query name and node name.
Camille GILLOT [Sun, 11 Oct 2020 18:46:46 +0000 (20:46 +0200)]
Unify query name and node name.

3 years agoRemove unused category from macros.
Camille GILLOT [Sun, 11 Oct 2020 18:44:24 +0000 (20:44 +0200)]
Remove unused category from macros.

3 years agoRemove unused ProfileCategory.
Camille GILLOT [Sun, 7 Jun 2020 16:45:10 +0000 (18:45 +0200)]
Remove unused ProfileCategory.

3 years agoOnly call `collect_tokens` when we have an attribute to parse
Aaron Hill [Thu, 22 Oct 2020 19:17:40 +0000 (15:17 -0400)]
Only call `collect_tokens` when we have an attribute to parse

3 years agofix save-analysis
Bastian Kauschke [Thu, 22 Oct 2020 19:04:28 +0000 (21:04 +0200)]
fix save-analysis

3 years agoClean up lib docs
Camelid [Mon, 19 Oct 2020 01:17:49 +0000 (18:17 -0700)]
Clean up lib docs

3 years agoAdd test for const panic!(CONST).
Mara Bos [Sun, 18 Oct 2020 13:02:42 +0000 (15:02 +0200)]
Add test for const panic!(CONST).

3 years agoFix const core::panic!(non_literal_str).
Mara Bos [Sat, 5 Sep 2020 15:26:11 +0000 (17:26 +0200)]
Fix const core::panic!(non_literal_str).

3 years agoBless tests
Santiago Pastorino [Tue, 20 Oct 2020 22:59:22 +0000 (19:59 -0300)]
Bless tests

3 years agoAdd ..= const { .. } missing tests and sort them properly
Santiago Pastorino [Tue, 20 Oct 2020 21:53:13 +0000 (18:53 -0300)]
Add ..= const { .. } missing tests and sort them properly

3 years agoMake inline const work for half open ranges
Santiago Pastorino [Mon, 19 Oct 2020 21:44:37 +0000 (18:44 -0300)]
Make inline const work for half open ranges

3 years agoMake inline const work in range patterns
Santiago Pastorino [Mon, 19 Oct 2020 19:18:47 +0000 (16:18 -0300)]
Make inline const work in range patterns

3 years agoRename parse_const_expr to parse_const_block
Santiago Pastorino [Tue, 20 Oct 2020 22:14:17 +0000 (19:14 -0300)]
Rename parse_const_expr to parse_const_block

3 years agoExplain where the closure return type was inferred
Aaron Hill [Thu, 22 Oct 2020 13:47:23 +0000 (09:47 -0400)]
Explain where the closure return type was inferred

Fixes #78193

3 years agoAuto merge of #77720 - matthewjasper:fix-trait-ices, r=nikomatsakis
bors [Thu, 22 Oct 2020 14:40:20 +0000 (14:40 +0000)]
Auto merge of #77720 - matthewjasper:fix-trait-ices, r=nikomatsakis

Fix trait solving ICEs

- Selection candidates that are known to be applicable are preferred
  over candidates that are not.
- Don't ICE if a projection/object candidate is no longer applicable
  (this can happen due to cycles in normalization)
- Normalize supertraits when finding trait object candidates

Closes #77653
Closes #77656

r? `@nikomatsakis`

3 years agoDon't create an empty `LazyTokenStream`
Aaron Hill [Thu, 22 Oct 2020 14:09:08 +0000 (10:09 -0400)]
Don't create an empty `LazyTokenStream`

3 years agoFixup: add missing trailing newline
LeSeulArtichaut [Thu, 22 Oct 2020 12:37:42 +0000 (14:37 +0200)]
Fixup: add missing trailing newline

3 years agoAuto merge of #77871 - Julian-Wollersberger:less-query-context, r=oli-obk
bors [Thu, 22 Oct 2020 12:24:55 +0000 (12:24 +0000)]
Auto merge of #77871 - Julian-Wollersberger:less-query-context, r=oli-obk

Make fewer types generic over QueryContext

While trying to refactor `rustc_query_system::query::QueryContext` to make it dyn-safe, I noticed some smaller things:
* QueryConfig doesn't need to be generic over QueryContext
* ~~The `kind` field on QueryJobId is unused~~
* Some unnecessary where clauses
* Many types in `job.rs` where generic over `QueryContext` but only needed `QueryContext::Query`.
  If handle_cycle_error() could be refactored to not take `error: CycleError<CTX::Query>`, all those bounds could be removed as well.

Changing `find_cycle_in_stack()` in job.rs to not take a `tcx` argument is the only functional change here. Everything else is just updating type signatures. (aka compile-error driven development ^^)

~~Currently there is a weird bug where memory usage suddenly skyrockets when running UI tests. I'll investigate that tomorrow.
A perf run probably won't make sense before that is fixed.~~

EDIT: `kind` actually is used by `Eq`, and re-adding it fixed the memory issue.

3 years agoFix clippy tests
varkor [Thu, 22 Oct 2020 12:23:14 +0000 (13:23 +0100)]
Fix clippy tests

3 years agoFix clippy tests
varkor [Thu, 22 Oct 2020 12:23:14 +0000 (13:23 +0100)]
Fix clippy tests

3 years agoMake closures inherit the parent function's target features
LeSeulArtichaut [Thu, 22 Oct 2020 11:55:19 +0000 (13:55 +0200)]
Make closures inherit the parent function's target features

3 years agoAuto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth
bors [Thu, 22 Oct 2020 07:37:02 +0000 (07:37 +0000)]
Auto merge of #6203 - giraffate:fix_link_to_labeled_issues, r=Manishearth

Fix links to labeled issues

These labels seems wrong.
- <https://github.com/rust-lang/rust-clippy/labels/L-crash%20%3Aboom%3A>
- <https://github.com/rust-lang/rust-clippy/labels/L-bug%20%3Abeetle%3A>

changelog: none

3 years agoNormalize when finding trait object candidates
Matthew Jasper [Thu, 8 Oct 2020 20:52:40 +0000 (21:52 +0100)]
Normalize when finding trait object candidates

3 years agoAuto merge of #78134 - bugadani:arena-nodrop, r=lcnr
bors [Thu, 22 Oct 2020 07:05:21 +0000 (07:05 +0000)]
Auto merge of #78134 - bugadani:arena-nodrop, r=lcnr

Use `DroplessArena` where we know the type doesn't need drop

This PR uses a single `DroplessArena` in resolve instead of three separate `TypedArena`s.

`DroplessArena` checks that the type indeed doesn't need drop, so in case the types change, this will result in visible failures.

3 years agoAuto merge of #78131 - SimonSapin:ar, r=Mark-Simulacrum
bors [Thu, 22 Oct 2020 04:40:06 +0000 (04:40 +0000)]
Auto merge of #78131 - SimonSapin:ar, r=Mark-Simulacrum

Package more llvm-* tools in the rust-dev component, for run-make-fulldeps tests

Fixes https://github.com/rust-lang/rust/issues/78110

3 years agoAuto merge of #78212 - JohnTitor:rollup-j5r6xuy, r=JohnTitor
bors [Thu, 22 Oct 2020 01:35:05 +0000 (01:35 +0000)]
Auto merge of #78212 - JohnTitor:rollup-j5r6xuy, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #77420 (Unify const-checking structured errors for `&mut` and `&raw mut`)
 - #77554 (Support signed integers and `char` in v0 mangling)
 - #77976 (Mark inout asm! operands as used in liveness pass)
 - #78009 (Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling)
 - #78084 (Greatly improve display for small mobile devices screens)
 - #78155 (Fix two small issues in compiler/rustc_lint/src/types.rs)
 - #78156 (Fixed build failure of `rustfmt`)
 - #78172 (Add test case for #77062)
 - #78188 (Add tracking issue number for pin_static_ref)
 - #78200 (Add `ControlFlow::is_{break,continue}` methods)

Failed merges:

r? `@ghost`

3 years agoClean up and improve some docs
Camelid [Mon, 19 Oct 2020 04:54:10 +0000 (21:54 -0700)]
Clean up and improve some docs

* compiler docs
  * Don't format list as part of a code block
  * Clean up some other formatting
* rustdoc book
  * Update CommonMark spec version to latest (0.28 -> 0.29)
  * Clean up some various wording and formatting

3 years agoRollup merge of #78200 - LeSeulArtichaut:controlflow-is-meth, r=scottmcm
Yuki Okushi [Thu, 22 Oct 2020 00:45:45 +0000 (09:45 +0900)]
Rollup merge of #78200 - LeSeulArtichaut:controlflow-is-meth, r=scottmcm

Add `ControlFlow::is_{break,continue}` methods

r? @scottmcm cc #75744

3 years agoRollup merge of #78188 - fusion-engineering-forks:static-ref-tracking-issue, r=withou...
Yuki Okushi [Thu, 22 Oct 2020 00:45:43 +0000 (09:45 +0900)]
Rollup merge of #78188 - fusion-engineering-forks:static-ref-tracking-issue, r=withoutboats

Add tracking issue number for pin_static_ref

Forgot to add a tracking issue in #77726. Opened #78186 as tracking issue.

3 years agoRollup merge of #78172 - wesleywiser:close_77062, r=oli-obk
Yuki Okushi [Thu, 22 Oct 2020 00:45:42 +0000 (09:45 +0900)]
Rollup merge of #78172 - wesleywiser:close_77062, r=oli-obk

Add test case for #77062

Closes #77062

3 years agoRollup merge of #78156 - bishtpawan:bugfix/rustfmt-no-longer-builds, r=lcnr
Yuki Okushi [Thu, 22 Oct 2020 00:45:40 +0000 (09:45 +0900)]
Rollup merge of #78156 - bishtpawan:bugfix/rustfmt-no-longer-builds, r=lcnr

Fixed build failure of `rustfmt`

Fixes #78079
r? @eddyb cc @bjorn3

3 years agoRollup merge of #78155 - est31:rustc_lint_types_refactor, r=davidtwco
Yuki Okushi [Thu, 22 Oct 2020 00:45:38 +0000 (09:45 +0900)]
Rollup merge of #78155 - est31:rustc_lint_types_refactor, r=davidtwco

Fix two small issues in compiler/rustc_lint/src/types.rs

Two small improvements of `compiler/rustc_lint/src/types.rs`

3 years agoRollup merge of #78084 - GuillaumeGomez:improve-mobile-display, r=jyn514,Nemo157
Yuki Okushi [Thu, 22 Oct 2020 00:45:37 +0000 (09:45 +0900)]
Rollup merge of #78084 - GuillaumeGomez:improve-mobile-display, r=jyn514,Nemo157

Greatly improve display for small mobile devices screens

Fixes #78014.

The biggest change being the "search bar". Instead of having everything on one line, I decided to move the search input on its own:

![Screenshot from 2020-10-18 21-54-26](https://user-images.githubusercontent.com/3050060/96378530-c863a800-118c-11eb-8e82-a43fce312b5b.png)

Another change is that now, we "break words" in the listing so that they don't grow too big:

![Screenshot from 2020-10-18 21-57-17](https://user-images.githubusercontent.com/3050060/96378555-ffd25480-118c-11eb-8a71-8f116c7edd93.png)

r? @jyn514

3 years agoRollup merge of #78009 - nielx:fix/CMAKE_SYSTEM_NAME, r=Mark-Simulacrum
Yuki Okushi [Thu, 22 Oct 2020 00:45:35 +0000 (09:45 +0900)]
Rollup merge of #78009 - nielx:fix/CMAKE_SYSTEM_NAME, r=Mark-Simulacrum

Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling

This resolves issues where the cross-build of LLVM fails because it tries to
link to the host's system libraries instead of the target's system libraries.

3 years agoRollup merge of #77976 - oliviacrain:issue-77915-fix, r=matthewjasper
Yuki Okushi [Thu, 22 Oct 2020 00:45:33 +0000 (09:45 +0900)]
Rollup merge of #77976 - oliviacrain:issue-77915-fix, r=matthewjasper

Mark inout asm! operands as used in liveness pass

Variables used in `inout` operands in inline assembly (that is, they're used as both input and output to some arbitrary assembly instruction) are being marked as read and written, but are not marked as being used in the RWU table during the liveness pass. This can result in such expressions triggering an unused variable lint warning. This is incorrect behavior- reads without uses are currently only used for compound assignments. We conservatively assume that an `inout` operand is being read and used in the context of the assembly instruction.

Closes #77915

3 years agoRollup merge of #77554 - varkor:mangle-int-char, r=eddyb
Yuki Okushi [Thu, 22 Oct 2020 00:45:31 +0000 (09:45 +0900)]
Rollup merge of #77554 - varkor:mangle-int-char, r=eddyb

Support signed integers and `char` in v0 mangling

Likely we want more tests, to check the output is correct too: however, I wasn't sure what kind of test we needed, so I just added one similar to that added in https://github.com/rust-lang/rust/pull/77452 for now.

r? @eddyb

3 years agoRollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwco
Yuki Okushi [Thu, 22 Oct 2020 00:45:25 +0000 (09:45 +0900)]
Rollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwco

Unify const-checking structured errors for `&mut` and `&raw mut`

Resolves #77414 as well as a FIXME.

3 years agoFix links to labeled issues
Takayuki Nakata [Wed, 21 Oct 2020 23:51:03 +0000 (08:51 +0900)]
Fix links to labeled issues

3 years agoStrip tokens before printing AST JSON
Aaron Hill [Wed, 21 Oct 2020 23:44:33 +0000 (19:44 -0400)]
Strip tokens before printing AST JSON

3 years agoAuto merge of #78027 - lcnr:lift-by-value, r=varkor
bors [Wed, 21 Oct 2020 23:09:38 +0000 (23:09 +0000)]
Auto merge of #78027 - lcnr:lift-by-value, r=varkor

Lift: take self by value

seems small enough to not warrant an MCP :shrug:

3 years agoUnconditionally capture tokens for attributes.
Aaron Hill [Sat, 26 Sep 2020 23:33:42 +0000 (19:33 -0400)]
Unconditionally capture tokens for attributes.

This allows us to avoid synthesizing tokens in `prepend_attr`, since we
have the original tokens available.

We still need to synthesize tokens when expanding `cfg_attr`,
but this is an unavoidable consequence of the syntax of `cfg_attr` -
the user does not supply the `#` and `[]` tokens that a `cfg_attr`
expands to.

3 years agoMark `repr128` as `incomplete_features`
varkor [Sat, 3 Oct 2020 13:47:28 +0000 (14:47 +0100)]
Mark `repr128` as `incomplete_features`

3 years agoUpdate `compiler_builtins` to 0.1.36
Yuki Okushi [Wed, 21 Oct 2020 22:10:25 +0000 (07:10 +0900)]
Update `compiler_builtins` to 0.1.36

3 years agovalidate rustc_allow_const_fn_unstable targets
Florian Warzecha [Wed, 21 Oct 2020 22:02:26 +0000 (00:02 +0200)]
validate rustc_allow_const_fn_unstable targets

Adds a check to make sure `#[rustc_allow_const_fn_unstable]`
can be applied only to functions.

3 years agoreview
Bastian Kauschke [Wed, 21 Oct 2020 21:52:41 +0000 (23:52 +0200)]
review

3 years agoLift: take self by value
Bastian Kauschke [Fri, 16 Oct 2020 19:59:49 +0000 (21:59 +0200)]
Lift: take self by value

3 years agovalidate allow_internal_unstable target
Florian Warzecha [Wed, 21 Oct 2020 20:49:08 +0000 (22:49 +0200)]
validate allow_internal_unstable target

Adds a check to make sure `#[allow_internal_unstable]`
can be applied only to macro definitions.

3 years agoAuto merge of #78077 - petrochenkov:qvis, r=davidtwco
bors [Wed, 21 Oct 2020 20:23:26 +0000 (20:23 +0000)]
Auto merge of #78077 - petrochenkov:qvis, r=davidtwco

Calculate visibilities once in resolve

Then use them through a query based on resolver outputs.

Item visibilities were previously calculated in three places - initially in `rustc_resolve`, then in `rustc_privacy` during type privacy checkin, and then in `rustc_metadata` during metadata encoding.
The visibility logic is not entirely trivial, especially for things like constructors or enum variants, and all of it was duplicated.

This PR deduplicates all the visibility calculations, visibilities are determined once during early name resolution and then stored in `ResolverOutputs` and are later available through `tcx` as a query `tcx.visibility(def_id)`.
(This query existed previously, but only worked for other crates.)

Some special cases (e.g. visibilities for closure types, which are needed for type privacy checking) are not processed in resolve, but deferred and performed directly in the query instead.

3 years agoUpdate to rustc-demangle 0.1.18
varkor [Wed, 21 Oct 2020 20:11:11 +0000 (21:11 +0100)]
Update to rustc-demangle 0.1.18

3 years agoAdd test for const generics demangling
varkor [Wed, 7 Oct 2020 20:17:07 +0000 (21:17 +0100)]
Add test for const generics demangling

3 years agoUpdate rustc-demangle
varkor [Wed, 7 Oct 2020 19:52:02 +0000 (20:52 +0100)]
Update rustc-demangle

3 years agoDo not print type for placeholder values
varkor [Wed, 7 Oct 2020 18:31:23 +0000 (19:31 +0100)]
Do not print type for placeholder values

3 years agoSupport signed integers and `char` in v0 mangling
varkor [Sun, 4 Oct 2020 23:28:05 +0000 (00:28 +0100)]
Support signed integers and `char` in v0 mangling

3 years agoAdd `ControlFlow::is_{break,continue}` methods
LeSeulArtichaut [Wed, 21 Oct 2020 19:50:08 +0000 (21:50 +0200)]
Add `ControlFlow::is_{break,continue}` methods

3 years agoExplain the `Opaque` special case in specialization
Nadrieril [Wed, 21 Oct 2020 19:15:02 +0000 (20:15 +0100)]
Explain the `Opaque` special case in specialization

3 years agoswitch allow_internal_unstable const fns to rustc_allow_const_fn_unstable
Florian Warzecha [Wed, 21 Oct 2020 18:54:20 +0000 (20:54 +0200)]
switch allow_internal_unstable const fns to rustc_allow_const_fn_unstable

3 years agoFix ICE from projection cycle
Matthew Jasper [Thu, 8 Oct 2020 20:49:36 +0000 (21:49 +0100)]
Fix ICE from projection cycle

Cycles in normalization can cause evaluations to change from Unknown to
Err. This means that some selection that were applicable no longer are.

To avoid this:
* Selection candidates that are known to be applicable are prefered
  over candidates that are not.
* We don't ICE if a candidate is no longer applicable.

3 years agoAdd a test for #53708
Nadrieril [Wed, 21 Oct 2020 18:24:59 +0000 (19:24 +0100)]
Add a test for #53708

This issue was accidentally fixed recently, probably by #70743

3 years agoAuto merge of #78195 - tmiasko:instcombine, r=jonas-schievink
bors [Wed, 21 Oct 2020 17:44:48 +0000 (17:44 +0000)]
Auto merge of #78195 - tmiasko:instcombine, r=jonas-schievink

Disable "optimization to avoid load of address" in InstCombine

The transformation is incorrect #78192. Disable it.

3 years agoadd rustc_allow_const_fn_unstable attribute
Florian Warzecha [Wed, 21 Oct 2020 10:36:07 +0000 (12:36 +0200)]
add rustc_allow_const_fn_unstable attribute

allow_internal_unstable is currently used
to side-step feature gate and stability checks.
While it was originally only meant to be used
only on macros, its use was expanded to
const functions.

This commit prepares stricter checks for the usage of allow_internal_unstable (only on macros)
and introduces the rustc_allow_const_fn_unstable attribute for usage on functions.

See rust-lang/rust#69399

3 years agoAuto merge of #77250 - Aaron1011:feature/flat-token-collection, r=petrochenkov
bors [Wed, 21 Oct 2020 15:03:14 +0000 (15:03 +0000)]
Auto merge of #77250 - Aaron1011:feature/flat-token-collection, r=petrochenkov

Rewrite `collect_tokens` implementations to use a flattened buffer

Instead of trying to collect tokens at each depth, we 'flatten' the
stream as we go allong, pushing open/close delimiters to our buffer
just like regular tokens. One capturing is complete, we reconstruct a
nested `TokenTree::Delimited` structure, producing a normal
`TokenStream`.

The reconstructed `TokenStream` is not created immediately - instead, it is
produced on-demand by a closure (wrapped in a new `LazyTokenStream` type). This
closure stores a clone of the original `TokenCursor`, plus a record of the
number of calls to `next()/next_desugared()`. This is sufficient to reconstruct
the tokenstream seen by the callback without storing any additional state. If
the tokenstream is never used (e.g. when a captured `macro_rules!` argument is
never passed to a proc macro), we never actually create a `TokenStream`.

This implementation has a number of advantages over the previous one:

* It is significantly simpler, with no edge cases around capturing the
  start/end of a delimited group.

* It can be easily extended to allow replacing tokens an an arbitrary
  'depth' by just using `Vec::splice` at the proper position. This is
  important for PR #76130, which requires us to track information about
  attributes along with tokens.

* The lazy approach to `TokenStream` construction allows us to easily
  parse an AST struct, and then decide after the fact whether we need a
  `TokenStream`. This will be useful when we start collecting tokens for
  `Attribute` - we can discard the `LazyTokenStream` if the parsed
  attribute doesn't need tokens (e.g. is a builtin attribute).

The performance impact seems to be neglibile (see
https://github.com/rust-lang/rust/pull/77250#issuecomment-703960604). There is a
small slowdown on a few benchmarks, but it only rises above 1% for incremental
builds, where it represents a larger fraction of the much smaller instruction
count. There a ~1% speedup on a few other incremental benchmarks - my guess is
that the speedups and slowdowns will usually cancel out in practice.

3 years agoAdd tracking issue number for pin_static_ref.
Mara Bos [Wed, 21 Oct 2020 14:30:41 +0000 (16:30 +0200)]
Add tracking issue number for pin_static_ref.

3 years agoAuto merge of #78178 - JohnTitor:rollup-dslazzj, r=JohnTitor
bors [Wed, 21 Oct 2020 11:22:17 +0000 (11:22 +0000)]
Auto merge of #78178 - JohnTitor:rollup-dslazzj, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #77726 (Add Pin::static_ref, static_mut.)
 - #78002 (Tweak "object unsafe" errors)
 - #78056 (BTreeMap: split off most code of remove and split_off)
 - #78063 (Improve wording of "cannot multiply" type error)
 - #78094 (rustdoc: Show the correct source filename in page titles, without `.html`)
 - #78101 (fix static_ptr_ty for foreign statics)
 - #78118 (Inline const followups)

Failed merges:

r? `@ghost`

3 years agoFix formatting
bishtpawan [Wed, 21 Oct 2020 06:12:52 +0000 (11:42 +0530)]
Fix formatting

3 years agoBless liveness-asm output
Olivia Crain [Wed, 21 Oct 2020 05:56:22 +0000 (00:56 -0500)]
Bless liveness-asm output

3 years agoLimit liveness-asm tests to x86_64
Olivia Crain [Wed, 21 Oct 2020 05:34:01 +0000 (00:34 -0500)]
Limit liveness-asm tests to x86_64

3 years agoRollup merge of #78118 - spastorino:inline-const-followups, r=petrochenkov
Yuki Okushi [Wed, 21 Oct 2020 04:59:44 +0000 (13:59 +0900)]
Rollup merge of #78118 - spastorino:inline-const-followups, r=petrochenkov

Inline const followups

r? @petrochenkov

Follow ups of #77124

3 years agoRollup merge of #78101 - RalfJung:foreign-static, r=oli-obk
Yuki Okushi [Wed, 21 Oct 2020 04:59:43 +0000 (13:59 +0900)]
Rollup merge of #78101 - RalfJung:foreign-static, r=oli-obk

fix static_ptr_ty for foreign statics

Cc https://github.com/rust-lang/rust/issues/74840

This does not fix that issue but fixes a problem in `static_ptr_ty` that we noticed while discussing that issue. I also added and updated a few comments. The one about `internal` locals being ignored does not seem to have been true [even in the commit that introduced it](https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139).

r? @oli-obk

3 years agoRollup merge of #78094 - camelid:rustdoc-fix-source-title, r=jyn514
Yuki Okushi [Wed, 21 Oct 2020 04:59:41 +0000 (13:59 +0900)]
Rollup merge of #78094 - camelid:rustdoc-fix-source-title, r=jyn514

rustdoc: Show the correct source filename in page titles, without `.html`

Previously the title would be

    lib.rs.html -- source

if `lib.rs` was the actual source filename. Now the title is

    lib.rs - source

3 years agoRollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank
Yuki Okushi [Wed, 21 Oct 2020 04:59:39 +0000 (13:59 +0900)]
Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank

Improve wording of "cannot multiply" type error

For example, if you had this code:

    fn foo(x: i32, y: f32) -> f32 {
        x * y
    }

You would get this error:

    error[E0277]: cannot multiply `f32` to `i32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`

However, that's not usually how people describe multiplication. People
usually describe multiplication like how the division error words it:

    error[E0277]: cannot divide `i32` by `f32`
     --> src/lib.rs:2:7
      |
    2 |     x / y
      |       ^ no implementation for `i32 / f32`
      |
      = help: the trait `Div<f32>` is not implemented for `i32`

So that's what this change does. It changes this:

    error[E0277]: cannot multiply `f32` to `i32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`

To this:

    error[E0277]: cannot multiply `i32` by `f32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`

3 years agoRollup merge of #78056 - ssomers:btree_chop_up_1, r=dtolnay
Yuki Okushi [Wed, 21 Oct 2020 04:59:37 +0000 (13:59 +0900)]
Rollup merge of #78056 - ssomers:btree_chop_up_1, r=dtolnay

BTreeMap: split off most code of remove and split_off

Putting map.rs on a diet, in addition to #77851.
r? @dtolnay

3 years agoRollup merge of #78002 - estebank:issue-77598, r=oli-obk
Yuki Okushi [Wed, 21 Oct 2020 04:59:35 +0000 (13:59 +0900)]
Rollup merge of #78002 - estebank:issue-77598, r=oli-obk

Tweak "object unsafe" errors

CC #77598.

3 years agoRollup merge of #77726 - fusion-engineering-forks:static-pin, r=dtolnay
Yuki Okushi [Wed, 21 Oct 2020 04:59:29 +0000 (13:59 +0900)]
Rollup merge of #77726 - fusion-engineering-forks:static-pin, r=dtolnay

Add Pin::static_ref, static_mut.

This adds `Pin::static_ref` and `Pin::static_mut`, which convert a static reference to a pinned static reference.

Static references are effectively already pinned, as what they refer to has to live forever and can never be moved.

---

Context: I want to update the `sys` and `sys_common` mutexes/rwlocks/condvars to use `Pin<&self>` in their functions, instead of only warning in the unsafety comments that they may not be moved. That should make them a little bit less dangerous to use. Putting such an object in a `static` (e.g. through `sys_common::StaticMutex`) fulfills the requirements about never moving it, but right now there's no safe way to get a `Pin<&T>` to a `static`. This solves that.

3 years agoAdd test case for #77062
Wesley Wiser [Wed, 21 Oct 2020 00:55:37 +0000 (20:55 -0400)]
Add test case for #77062

Closes #77062

3 years agoCheck for exhaustion in SliceIndex for RangeInclusive
Josh Stone [Wed, 21 Oct 2020 00:18:08 +0000 (17:18 -0700)]
Check for exhaustion in SliceIndex for RangeInclusive

3 years agoIntroduce a temporary for discriminant value in MatchBranchSimplification
Tomasz Miąsko [Wed, 21 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Introduce a temporary for discriminant value in MatchBranchSimplification

The optimization introduces additional uses of the discriminant operand, but
does not ensure that it is still valid to evaluate it or that it still
evaluates to the same value.

Evaluate it once at original position, and store the result in a new temporary.

3 years agoSimplify assert terminator only if condition evaluates to expected value
Tomasz Miąsko [Wed, 21 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Simplify assert terminator only if condition evaluates to expected value

3 years agoDisable "optimization to avoid load of address" in InstCombine
Tomasz Miąsko [Wed, 21 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Disable "optimization to avoid load of address" in InstCombine