]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #85321 - cjgillot:mir-cycle, r=bjorn3
bors [Sun, 3 Apr 2022 07:53:10 +0000 (07:53 +0000)]
Auto merge of #85321 - cjgillot:mir-cycle, r=bjorn3

Use DefPathHash instead of HirId to break inlining cycles.

The `DefPathHash` is stable across incremental compilation sessions, so provides a total order on `LocalDefId`. Using it instead of `HirId` ensures the MIR inliner has the same behaviour for incremental and non-incremental compilation.

A downside is that the cycle tie break is not as predictable is with `HirId`.

2 years agoAuto merge of #88672 - camelid:inc-parser-sugg, r=davidtwco
bors [Sun, 3 Apr 2022 05:24:20 +0000 (05:24 +0000)]
Auto merge of #88672 - camelid:inc-parser-sugg, r=davidtwco

Suggest `i += 1` when we see `i++` or `++i`

Closes #83502 (for `i++` and `++i`; `--i` should be covered by #82987, and `i--`
is tricky to handle).

This is a continuation of #83536.

r? `@estebank`

2 years agoAuto merge of #95590 - GuillaumeGomez:multi-line-attr-handling-doctest, r=notriddle
bors [Sat, 2 Apr 2022 23:39:25 +0000 (23:39 +0000)]
Auto merge of #95590 - GuillaumeGomez:multi-line-attr-handling-doctest, r=notriddle

Fix multiline attributes handling in doctests

Fixes #55713.

I needed to have access to the `unclosed_delims` field in order to check that the attribute was completely parsed and didn't have missing parts, so I created a getter for it.

r? `@notriddle`

2 years agoLess manipulation of the callee_def_id.
Camille GILLOT [Sat, 2 Apr 2022 21:28:09 +0000 (23:28 +0200)]
Less manipulation of the callee_def_id.

2 years agoUse only local hash.
Camille GILLOT [Mon, 17 May 2021 19:07:42 +0000 (21:07 +0200)]
Use only local hash.

2 years agoUse DefPathHash instead of HirId to break cycles.
Camille GILLOT [Thu, 13 May 2021 07:28:56 +0000 (09:28 +0200)]
Use DefPathHash instead of HirId to break cycles.

2 years agoAuto merge of #95600 - Dylan-DPC:rollup-580y2ra, r=Dylan-DPC
bors [Sat, 2 Apr 2022 20:58:33 +0000 (20:58 +0000)]
Auto merge of #95600 - Dylan-DPC:rollup-580y2ra, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #95587 (Remove need for associated_type_bounds in std.)
 - #95589 (Include a header in .rlink files)
 - #95593 (diagnostics: add test case for bogus T:Sized suggestion)
 - #95597 (Refer to u8 by absolute path in expansion of thread_local)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #95597 - dtolnay:threadlocalu8, r=Dylan-DPC
Dylan DPC [Sat, 2 Apr 2022 20:38:22 +0000 (22:38 +0200)]
Rollup merge of #95597 - dtolnay:threadlocalu8, r=Dylan-DPC

Refer to u8 by absolute path in expansion of thread_local

The standard library's `thread_local!` macro previously referred to `u8` just as `u8`, resolving to whatever `u8` existed in the type namespace at the call site. This PR replaces those with `$crate::primitive::u8` which always refers to `std::primitive::u8` regardless of what's in scope at the call site. Unambiguously naming primitives inside macro-generated code is the reason that std::primitive was introduced in the first place.

<details>
<summary>Here is the error message prior to this PR ⬇️</summary>

```console
error[E0308]: mismatched types
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | |_^ expected struct `u8`, found integer
  |
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | | ^
  | | |
  | |_expected struct `u8`, found integer
  |   this expression has type `u8`
  |
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | |_^ expected `u8`, found struct `u8`
  |
  = note: expected raw pointer `*mut u8` (`u8`)
             found raw pointer `*mut u8` (struct `u8`)
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | |_^ expected `u8`, found struct `u8`
  |
  = note: expected fn pointer `unsafe extern "C" fn(*mut u8)`
                found fn item `unsafe extern "C" fn(*mut u8) {destroy}`
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | | ^
  | | |
  | |_expected struct `u8`, found integer
  |   expected due to this type
  |
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0369]: binary operation `==` cannot be applied to type `u8`
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | | ^
  | | |
  | |_u8
  |   {integer}
  |
note: an implementation of `PartialEq<_>` might be missing for `u8`
 --> src/main.rs:4:1
  |
4 | struct u8;
  | ^^^^^^^^^^ must implement `PartialEq<_>`
  = note: this error originates in the macro `$crate::assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `u8` with `#[derive(PartialEq)]`
  |
4 | #[derive(PartialEq)]
  |

error[E0277]: `u8` doesn't implement `Debug`
 --> src/main.rs:6:1
  |
6 | / std::thread_local! {
7 | |     pub static A: i32 = f();
8 | |     pub static B: i32 = const { 0 };
9 | | }
  | |_^ `u8` cannot be formatted using `{:?}`
  |
  = help: the trait `Debug` is not implemented for `u8`
  = note: add `#[derive(Debug)]` to `u8` or manually `impl Debug for u8`
  = note: this error originates in the macro `$crate::assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
```
</details>

2 years agoRollup merge of #95593 - notriddle:notriddle/size-of-in-const-context, r=compiler...
Dylan DPC [Sat, 2 Apr 2022 20:38:21 +0000 (22:38 +0200)]
Rollup merge of #95593 - notriddle:notriddle/size-of-in-const-context, r=compiler-errors

diagnostics: add test case for bogus T:Sized suggestion

Closes #69228

2 years agoRollup merge of #95589 - Kobzol:rlink-header, r=bjorn3
Dylan DPC [Sat, 2 Apr 2022 20:38:20 +0000 (22:38 +0200)]
Rollup merge of #95589 - Kobzol:rlink-header, r=bjorn3

Include a header in .rlink files

I couldn't find the right place where to put tests. Is there some location that tests `.rlink` creation and loading?
I only found `src/test/run-make-fulldeps/separate-link/Makefile`, but I'm not sure how to check the error message in the Makefile.

Fixes: https://github.com/rust-lang/rust/issues/95297
r? `@bjorn3`

2 years agoRollup merge of #95587 - m-ou-se:std-remove-associated-type-bounds, r=Dylan-DPC
Dylan DPC [Sat, 2 Apr 2022 20:38:19 +0000 (22:38 +0200)]
Rollup merge of #95587 - m-ou-se:std-remove-associated-type-bounds, r=Dylan-DPC

Remove need for associated_type_bounds in std.

2 years agoAdd test for multi-line attribute handling in doctests
Guillaume Gomez [Sat, 2 Apr 2022 15:05:27 +0000 (17:05 +0200)]
Add test for multi-line attribute handling in doctests

2 years agoFix doctest multi-line mod attributes handling
Guillaume Gomez [Sat, 2 Apr 2022 15:05:04 +0000 (17:05 +0200)]
Fix doctest multi-line mod attributes handling

2 years agoRefer to u8 by absolute path in expansion of thread_local
David Tolnay [Sat, 2 Apr 2022 18:12:39 +0000 (11:12 -0700)]
Refer to u8 by absolute path in expansion of thread_local

2 years agoAdd test of thread_local! breaking on redefined u8
David Tolnay [Sat, 2 Apr 2022 18:37:53 +0000 (11:37 -0700)]
Add test of thread_local! breaking on redefined u8

2 years agoAuto merge of #94911 - jackh726:gats_extended_2, r=compiler-errors
bors [Sat, 2 Apr 2022 18:34:26 +0000 (18:34 +0000)]
Auto merge of #94911 - jackh726:gats_extended_2, r=compiler-errors

Make GATs object safe under generic_associated_types_extended feature

Based on #94869

Let's say we have
```rust
trait StreamingIterator {
    type Item<'a> where Self: 'a;
}
```
And `dyn for<'a> StreamingIterator<Item<'a> = &'a i32>`.

If we ask `(dyn for<'a> StreamingIterator<Item<'a> = &'a i32>): StreamingIterator`, then we have to prove that `for<'x> (&'x i32): Sized`. So, we generate *new* bound vars to subst for the GAT generics.

Importantly, this doesn't fully verify that these are usable and sound.

r? `@nikomatsakis`

2 years agoMake GATs object safe under generic_associated_types_extended feature
Jack Huey [Sun, 13 Mar 2022 15:56:18 +0000 (11:56 -0400)]
Make GATs object safe under generic_associated_types_extended feature

2 years agodiagnostics: add test case for bogus T:Sized suggestion
Michael Howell [Sat, 2 Apr 2022 16:57:04 +0000 (09:57 -0700)]
diagnostics: add test case for bogus T:Sized suggestion

Closes #69228

2 years agoAuto merge of #95568 - GuillaumeGomez:fix-invalid-dom-generation, r=notriddle
bors [Sat, 2 Apr 2022 15:53:41 +0000 (15:53 +0000)]
Auto merge of #95568 - GuillaumeGomez:fix-invalid-dom-generation, r=notriddle

Fix invalid DOM generation

Fixes #64371.

r? `@notriddle`

2 years agoAddress review comments and add a test
Jakub Beránek [Sat, 2 Apr 2022 15:26:39 +0000 (17:26 +0200)]
Address review comments and add a test

2 years agoInclude a header in .rlink files to provide nicer error messages when a wrong file...
Jakub Beránek [Sat, 2 Apr 2022 14:50:08 +0000 (16:50 +0200)]
Include a header in .rlink files to provide nicer error messages when a wrong file is parsed as .rlink

2 years agoAuto merge of #95537 - GuillaumeGomez:type_of-doc, r=Dylan-DPC
bors [Sat, 2 Apr 2022 12:13:11 +0000 (12:13 +0000)]
Auto merge of #95537 - GuillaumeGomez:type_of-doc, r=Dylan-DPC

Improve TyCtxt::type_of documentation

r? `@oli-obk`

2 years agoImprove TyCtxt::type_of documentation
Guillaume Gomez [Thu, 31 Mar 2022 19:03:52 +0000 (21:03 +0200)]
Improve TyCtxt::type_of documentation

2 years agoAuto merge of #95571 - petrochenkov:nowrapident2, r=Aaron1011
bors [Sat, 2 Apr 2022 07:42:50 +0000 (07:42 +0000)]
Auto merge of #95571 - petrochenkov:nowrapident2, r=Aaron1011

ast_lowering: Stop wrapping `ident` matchers into groups

The lowered forms goes to metadata, for example during encoding of macro definitions.
This is a missing part of https://github.com/rust-lang/rust/pull/92472.

Fixes https://github.com/rust-lang/rust/issues/95569
r? `@Aaron1011`

2 years agoAuto merge of #95509 - nnethercote:simplify-MatcherPos-some-more, r=petrochenkov
bors [Sat, 2 Apr 2022 04:59:16 +0000 (04:59 +0000)]
Auto merge of #95509 - nnethercote:simplify-MatcherPos-some-more, r=petrochenkov

Simplify `MatcherPos` some more

A few more improvements.

r? `@petrochenkov`

2 years agoAuto merge of #95581 - Dylan-DPC:rollup-2suh5h1, r=Dylan-DPC
bors [Sat, 2 Apr 2022 02:35:03 +0000 (02:35 +0000)]
Auto merge of #95581 - Dylan-DPC:rollup-2suh5h1, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #95354 (Handle rustc_const_stable attribute in library feature collector)
 - #95373 (invalid_value lint: detect invalid initialization of arrays)
 - #95430 (Disable #[thread_local] support on i686-pc-windows-msvc)
 - #95544 (Add error message suggestion for missing noreturn in naked function)
 - #95556 (Implement provenance preserving methods on NonNull)
 - #95557 (Fix `thread_local!` macro to be compatible with `no_implicit_prelude`)
 - #95559 (small type system refactoring)
 - #95560 (convert more `DefId`s to `LocalDefId`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #95560 - lcnr:obligation-cause, r=oli-obk
Dylan DPC [Sat, 2 Apr 2022 01:34:27 +0000 (03:34 +0200)]
Rollup merge of #95560 - lcnr:obligation-cause, r=oli-obk

convert more `DefId`s to `LocalDefId`

2 years agoRollup merge of #95559 - lcnr:inferctxt-typeck, r=oli-obk
Dylan DPC [Sat, 2 Apr 2022 01:34:26 +0000 (03:34 +0200)]
Rollup merge of #95559 - lcnr:inferctxt-typeck, r=oli-obk

small type system refactoring

2 years agoRollup merge of #95557 - niluxv:issue-95533, r=dtolnay
Dylan DPC [Sat, 2 Apr 2022 01:34:25 +0000 (03:34 +0200)]
Rollup merge of #95557 - niluxv:issue-95533, r=dtolnay

Fix `thread_local!` macro to be compatible with `no_implicit_prelude`

Fixes issue  #95533.

2 years agoRollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay
Dylan DPC [Sat, 2 Apr 2022 01:34:24 +0000 (03:34 +0200)]
Rollup merge of #95556 - declanvk:nonnull-provenance, r=dtolnay

Implement provenance preserving methods on NonNull

### Description
 Add the `addr`, `with_addr`, `map_addr` methods to the `NonNull` type, and map the address type to `NonZeroUsize`.

 ### Motivation
 The `NonNull` type is useful for implementing pointer types which have  the 0-niche. It is currently possible to implement these provenance  preserving functions by calling `NonNull::as_ptr` and `new_unchecked`. The adding these methods makes it more ergonomic.

 ### Testing
 Added a unit test of a non-null tagged pointer type. This is based on some real code I have elsewhere, that currently routes the pointer through a `NonZeroUsize` and back out to produce a usable pointer. I wanted to produce an ideal version of the same tagged pointer struct that preserved pointer provenance.

### Related

Extension of APIs proposed in #95228 . I can also split this out into a separate tracking issue if that is better (though I may need some pointers on how to do that).

2 years agoRollup merge of #95544 - jam1garner:improve-naked-noreturn-diagnostic, r=tmiasko
Dylan DPC [Sat, 2 Apr 2022 01:34:23 +0000 (03:34 +0200)]
Rollup merge of #95544 - jam1garner:improve-naked-noreturn-diagnostic, r=tmiasko

Add error message suggestion for missing noreturn in naked function

I had to google the syntax for inline asm's `noreturn` option when I got this error earlier today, so I figured I'd save others the trouble and add the syntax/fix as a suggestion in the error.

2 years agoRollup merge of #95430 - ChrisDenton:disable-tls-i686-msvc, r=nagisa
Dylan DPC [Sat, 2 Apr 2022 01:34:22 +0000 (03:34 +0200)]
Rollup merge of #95430 - ChrisDenton:disable-tls-i686-msvc, r=nagisa

Disable #[thread_local] support on i686-pc-windows-msvc

Fixes #95429

2 years agoRollup merge of #95373 - RalfJung:invalid_value, r=davidtwco
Dylan DPC [Sat, 2 Apr 2022 01:34:21 +0000 (03:34 +0200)]
Rollup merge of #95373 - RalfJung:invalid_value, r=davidtwco

invalid_value lint: detect invalid initialization of arrays

2 years agoRollup merge of #95354 - dtolnay:rustc_const_stable, r=lcnr
Dylan DPC [Sat, 2 Apr 2022 01:34:21 +0000 (03:34 +0200)]
Rollup merge of #95354 - dtolnay:rustc_const_stable, r=lcnr

Handle rustc_const_stable attribute in library feature collector

The library feature collector in [compiler/rustc_passes/src/lib_features.rs](https://github.com/rust-lang/rust/blob/551b4fa395fa588d91cbecfb0cdfe1baa02670cf/compiler/rustc_passes/src/lib_features.rs) has only been looking at `#[stable(…)]`, `#[unstable(…)]`, and `#[rustc_const_unstable(…)]` attributes, while ignoring `#[rustc_const_stable(…)]`. The consequences of this were:

- When any const feature got stabilized (changing one or more `rustc_const_unstable` to `rustc_const_stable`), users who had previously enabled that unstable feature using `#![feature(…)]` would get told "unknown feature", rather than rustc's nicer "the feature … has been stable since … and no longer requires an attribute to enable".

    This can be seen in the way that https://github.com/rust-lang/rust/pull/93957#issuecomment-1079794660 failed after rebase:

    ```console
    error[E0635]: unknown feature `const_ptr_offset`
      --> $DIR/offset_from_ub.rs:1:35
       |
    LL | #![feature(const_ptr_offset_from, const_ptr_offset)]
       |                                   ^^^^^^^^^^^^^^^^
    ```

- We weren't enforcing that a particular feature is either stable everywhere or unstable everywhere, and that a feature that has been stabilized has the same stabilization version everywhere, both of which we enforce for the other stability attributes.

This PR updates the library feature collector to handle `rustc_const_stable`, and fixes places in the standard library and test suite where `rustc_const_stable` was being used in a way that does not meet the rules for a stability attribute.

2 years agoAuto merge of #95578 - RalfJung:miri, r=RalfJung
bors [Sat, 2 Apr 2022 00:05:43 +0000 (00:05 +0000)]
Auto merge of #95578 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoupdate Miri
Ralf Jung [Fri, 1 Apr 2022 23:48:12 +0000 (19:48 -0400)]
update Miri

2 years agoAuto merge of #94883 - cjgillot:flat-metadata, r=oli-obk
bors [Fri, 1 Apr 2022 21:16:41 +0000 (21:16 +0000)]
Auto merge of #94883 - cjgillot:flat-metadata, r=oli-obk

Encode even more metadata through tables instead of EntryKind

This should move us closer to getting rid of `EntryKind`.

2 years agoast_lowering: Stop wrapping `ident` matchers into groups
Vadim Petrochenkov [Fri, 1 Apr 2022 20:54:05 +0000 (23:54 +0300)]
ast_lowering: Stop wrapping `ident` matchers into groups

The lowered forms goes to metadata, for example during encoding of macro definitions

2 years agoFix invalid DOM generation
Guillaume Gomez [Fri, 1 Apr 2022 18:18:08 +0000 (20:18 +0200)]
Fix invalid DOM generation

2 years agoAuto merge of #95552 - matthiaskrgr:rollup-bxminn9, r=matthiaskrgr
bors [Fri, 1 Apr 2022 17:19:15 +0000 (17:19 +0000)]
Auto merge of #95552 - matthiaskrgr:rollup-bxminn9, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #95032 (Clean up, categorize and sort unstable features in std.)
 - #95260 (Better suggestions for `Fn`-family trait selection errors)
 - #95293 (suggest wrapping single-expr blocks in square brackets)
 - #95344 (Make `impl Debug for rustdoc::clean::Item` easier to read)
 - #95388 (interpret: make isize::MAX the limit for dynamic value sizes)
 - #95530 (rustdoc: do not show primitives and keywords as private)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoReword purpose description of noreturn in naked function
jam1garner [Fri, 1 Apr 2022 15:28:45 +0000 (11:28 -0400)]
Reword purpose description of noreturn in naked function

2 years agoAuto merge of #95558 - matthiaskrgr:rollup-vpmk7t8, r=matthiaskrgr
bors [Fri, 1 Apr 2022 14:57:45 +0000 (14:57 +0000)]
Auto merge of #95558 - matthiaskrgr:rollup-vpmk7t8, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #95475 (rustdoc: Only show associated consts from inherent impls in sidebar)
 - #95516 (ptr_metadata test: avoid ptr-to-int transmutes)
 - #95528 (skip slow int_log tests in Miri)
 - #95531 (expand: Do not count metavar declarations on RHS of `macro_rules`)
 - #95532 (make utf8_char_counts test faster in Miri)
 - #95546 (add notes about alignment-altering reallocations to Allocator docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoinvalid_value lint: detect invalid initialization of arrays
Ralf Jung [Sun, 27 Mar 2022 17:10:34 +0000 (13:10 -0400)]
invalid_value lint: detect invalid initialization of arrays

2 years agoupdate comment
lcnr [Fri, 1 Apr 2022 11:47:01 +0000 (13:47 +0200)]
update comment

2 years agoconvert more `DefId`s to `LocalDefId`
lcnr [Fri, 1 Apr 2022 11:38:43 +0000 (13:38 +0200)]
convert more `DefId`s to `LocalDefId`

2 years agoremove unused incorrect `EqUnifyValue` impl
lcnr [Fri, 1 Apr 2022 10:57:24 +0000 (12:57 +0200)]
remove unused incorrect `EqUnifyValue` impl

2 years agoremove `unify_key::replace_if_possible`
lcnr [Fri, 1 Apr 2022 10:41:35 +0000 (12:41 +0200)]
remove `unify_key::replace_if_possible`

2 years agoupdate comments
lcnr [Fri, 1 Apr 2022 10:08:57 +0000 (12:08 +0200)]
update comments

2 years agoRollup merge of #95546 - autumnontape:allocator-realloc-align-docs, r=Amanieu
Matthias Krüger [Fri, 1 Apr 2022 10:07:05 +0000 (12:07 +0200)]
Rollup merge of #95546 - autumnontape:allocator-realloc-align-docs, r=Amanieu

add notes about alignment-altering reallocations to Allocator docs

As I said in https://github.com/rust-lang/wg-allocators/issues/97, the fact that calls to `grow`, `grow_zeroed`, and `shrink` may request altered alignments is surprising and may be a pitfall for implementors of `Allocator` if it's left implicit. This pull request adds a note to the "Safety" section of each function's docs making it explicit.

2 years agoRollup merge of #95532 - RalfJung:utf8_char_counts, r=Dylan-DPC
Matthias Krüger [Fri, 1 Apr 2022 10:07:05 +0000 (12:07 +0200)]
Rollup merge of #95532 - RalfJung:utf8_char_counts, r=Dylan-DPC

make utf8_char_counts test faster in Miri

This currently takes >3min on GHA, so let's reduce the test size a bit more for Miri.

2 years agoRollup merge of #95531 - petrochenkov:metacount, r=nnethercote
Matthias Krüger [Fri, 1 Apr 2022 10:07:04 +0000 (12:07 +0200)]
Rollup merge of #95531 - petrochenkov:metacount, r=nnethercote

expand: Do not count metavar declarations on RHS of `macro_rules`

They are 0 by definition there.

Addresses https://github.com/rust-lang/rust/pull/95425#discussion_r837410476
r? ```@nnethercote```

2 years agoRollup merge of #95528 - RalfJung:miri-is-too-slow, r=scottmcm
Matthias Krüger [Fri, 1 Apr 2022 10:07:03 +0000 (12:07 +0200)]
Rollup merge of #95528 - RalfJung:miri-is-too-slow, r=scottmcm

skip slow int_log tests in Miri

Iterating over i16::MAX many things takes a long time in Miri, let's not do that.
I added https://github.com/rust-lang/miri/pull/2044 on the Miri side to still give us some test coverage.

2 years agoRollup merge of #95516 - RalfJung:ptrs-not-ints, r=dtolnay
Matthias Krüger [Fri, 1 Apr 2022 10:07:02 +0000 (12:07 +0200)]
Rollup merge of #95516 - RalfJung:ptrs-not-ints, r=dtolnay

ptr_metadata test: avoid ptr-to-int transmutes

Pointers can have provenance, integers don't, so transmuting pointers to integers creates "non-standard" values and it is unclear how well those can be supported (https://github.com/rust-lang/unsafe-code-guidelines/issues/286).

So for this test let's take the safer option and use a pointer type instead. That also makes Miri happy. :)

2 years agoRollup merge of #95475 - Jules-Bertholet:rustdoc-hide-assoc-consts-from-trait-impls...
Matthias Krüger [Fri, 1 Apr 2022 10:07:01 +0000 (12:07 +0200)]
Rollup merge of #95475 - Jules-Bertholet:rustdoc-hide-assoc-consts-from-trait-impls, r=jsha

rustdoc: Only show associated consts from inherent impls in sidebar

Resolves #95459

2 years agoFix `thread_local!` macro to be compatible with `no_implicit_prelude`
niluxv [Fri, 1 Apr 2022 08:38:41 +0000 (10:38 +0200)]
Fix `thread_local!` macro to be compatible with `no_implicit_prelude`

Fixes issue  #95533

2 years agoRemove need for associated_type_bounds in std.
Mara Bos [Fri, 1 Apr 2022 08:38:39 +0000 (10:38 +0200)]
Remove need for associated_type_bounds in std.

2 years agoImplement provenance preserving method on NonNull
Declan Kelly [Fri, 1 Apr 2022 07:19:10 +0000 (00:19 -0700)]
Implement provenance preserving method on NonNull

**Description**
 Add the `addr`, `with_addr, `map_addr` methods to the `NonNull` type,
 and map the address type to `NonZeroUsize`.

 **Motiviation**
 The `NonNull` type is useful for implementing pointer types which have
 the 0-niche. It is currently possible to implement these provenance
 preserving functions by calling `NonNull::as_ptr` and `new_unchecked`.
 The addition of these methods simply make it more ergonomic to use.

 **Testing**
 Added a unit test of a nonnull tagged pointer type. This is based on
 some real code I have elsewhere, that currently routes the pointer
 through a `NonZeroUsize` and back out to produce a usable pointer.

2 years agoRollup merge of #95530 - notriddle:notriddle/private-kw-prim, r=jsha
Matthias Krüger [Fri, 1 Apr 2022 04:59:45 +0000 (06:59 +0200)]
Rollup merge of #95530 - notriddle:notriddle/private-kw-prim, r=jsha

rustdoc: do not show primitives and keywords as private

Fixes this:

![image](https://user-images.githubusercontent.com/1593513/161102430-f1f0301e-3e7f-453f-9c0a-bc87a12b893d.png)

2 years agoRollup merge of #95388 - RalfJung:rust-val-limit, r=oli-obk
Matthias Krüger [Fri, 1 Apr 2022 04:59:44 +0000 (06:59 +0200)]
Rollup merge of #95388 - RalfJung:rust-val-limit, r=oli-obk

interpret: make isize::MAX the limit for dynamic value sizes

We are currently enforcing `data_layout.obj_size_bound()` as the maximal dynamic size of a Rust value (including for `size_of_val_raw`), but that does not match the docs.

In particular, Miri currently falsely says that this code has UB:
```rust
#![feature(layout_for_ptr)]
fn main() {
    let size = isize::MAX as usize;
    // Creating a raw slice of size isize::MAX and asking for its size is okay.
    let s = std::ptr::slice_from_raw_parts(1usize as *const u8, size);
    assert_eq!(size, unsafe { std::mem::size_of_val_raw(s) });
}
```

2 years agoRollup merge of #95344 - jyn514:better-debug-output, r=camelid
Matthias Krüger [Fri, 1 Apr 2022 04:59:43 +0000 (06:59 +0200)]
Rollup merge of #95344 - jyn514:better-debug-output, r=camelid

Make `impl Debug for rustdoc::clean::Item` easier to read

Before:

```
Item { name: Some("Send"), attrs: Attributes { doc_strings: [DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:15:1: 15:60 (#0), parent_module: None, doc: " Types that can be transferred across thread boundaries.", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:16:1: 16:4 (#0), parent_module: None, doc: "", kind: SugaredDoc, indent: 0 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:17:1: 17:78 (#0), parent_module: None, doc: " This trait is automatically implemented when the compiler determines it's", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:18:1: 18:17 (#0), parent_module: None, doc: " appropriate.", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:19:1: 19:4 (#0), parent_module: None, doc: "", kind: SugaredDoc, indent: 0 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:20:1: 20:70 (#0), parent_module: None, doc: " An example of a non-`Send` type is the reference-counting pointer", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:21:1: 21:85 (#0), parent_module: None, doc: " [`rc::Rc`][`Rc`]. If two threads attempt to clone [`Rc`]s that point to the same", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:22:1: 22:81 (#0), parent_module: None, doc: " reference-counted value, they might try to update the reference count at the", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:23:1: 23:83 (#0), parent_module: None, doc: " same time, which is [undefined behavior][ub] because [`Rc`] doesn't use atomic", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:24:1: 24:84 (#0), parent_module: None, doc: " operations. Its cousin [`sync::Arc`][arc] does use atomic operations (incurring", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:25:1: 25:39 (#0), parent_module: None, doc: " some overhead) and thus is `Send`.", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:26:1: 26:4 (#0), parent_module: None, doc: "", kind: SugaredDoc, indent: 0 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:27:1: 27:74 (#0), parent_module: None, doc: " See [the Nomicon](../../nomicon/send-and-sync.html) for more details.", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:28:1: 28:4 (#0), parent_module: None, doc: "", kind: SugaredDoc, indent: 0 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:29:1: 29:40 (#0), parent_module: None, doc: " [`Rc`]: ../../std/rc/struct.Rc.html", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:30:1: 30:42 (#0), parent_module: None, doc: " [arc]: ../../std/sync/struct.Arc.html", kind: SugaredDoc, indent: 1 }, DocFragment { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:31:1: 31:61 (#0), parent_module: None, doc: " [ub]: ../../reference/behavior-considered-undefined.html", kind: SugaredDoc, indent: 1 }], other_attrs: [Attribute { kind: Normal(AttrItem { path: Path { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:3: 32:9 (#0), segments: [PathSegment { ident: stable#0, id: NodeId(33577), args: None }], tokens: None }, args: Delimited(DelimSpan { open: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:9: 32:10 (#0), close: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:44: 32:45 (#0) }, Parenthesis, TokenStream([(Token(Token { kind: Ident("feature", false), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:10: 32:17 (#0) }), Alone), (Token(Token { kind: Eq, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:18: 32:19 (#0) }), Alone), (Token(Token { kind: Literal(Lit { kind: Str, symbol: "rust1", suffix: None }), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:20: 32:27 (#0) }), Joint), (Token(Token { kind: Comma, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:27: 32:28 (#0) }), Alone), (Token(Token { kind: Ident("since", false), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:29: 32:34 (#0) }), Alone), (Token(Token { kind: Eq, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:35: 32:36 (#0) }), Alone), (Token(Token { kind: Literal(Lit { kind: Str, symbol: "1.0.0", suffix: None }), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:37: 32:44 (#0) }), Alone)])), tokens: None }, None), id: AttrId(48), style: Outer, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:32:1: 32:46 (#0) }, Attribute { kind: Normal(AttrItem { path: Path { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:33:23: 33:44 (#0), segments: [PathSegment { ident: rustc_diagnostic_item#0, id: NodeId(33578), args: None }], tokens: None }, args: Eq(/rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:33:45: 33:46 (#0), Token { kind: Literal(Lit { kind: Str, symbol: "Send", suffix: None }), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:33:47: 33:53 (#0) }), tokens: None }, None), id: AttrId(49), style: Outer, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:33:23: 33:53 (#0) }, Attribute { kind: Normal(AttrItem { path: Path { span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:34:3: 34:25 (#0), segments: [PathSegment { ident: rustc_on_unimplemented#0, id: NodeId(33580), args: None }], tokens: None }, args: Delimited(DelimSpan { open: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:34:25: 34:26 (#0), close: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:37:1: 37:2 (#0) }, Parenthesis, TokenStream([(Token(Token { kind: Ident("message", false), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:35:5: 35:12 (#0) }), Alone), (Token(Token { kind: Eq, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:35:13: 35:14 (#0) }), Alone), (Token(Token { kind: Literal(Lit { kind: Str, symbol: "`{Self}` cannot be sent between threads safely", suffix: None }), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:35:15: 35:63 (#0) }), Joint), (Token(Token { kind: Comma, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:35:63: 35:64 (#0) }), Alone), (Token(Token { kind: Ident("label", false), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:36:5: 36:10 (#0) }), Alone), (Token(Token { kind: Eq, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:36:11: 36:12 (#0) }), Alone), (Token(Token { kind: Literal(Lit { kind: Str, symbol: "`{Self}` cannot be sent between threads safely", suffix: None }), span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:36:13: 36:61 (#0) }), Alone)])), tokens: None }, None), id: AttrId(50), style: Outer, span: /rustc/37b55c8a0cafdb60b9168da34f904acc70157df8/library/core/src/marker.rs:34:1: 37:3 (#0) }] }, visibility: Public, kind: TraitItem(Trait { unsafety: Unsafe, items: [], generics: Generics { params: [], where_predicates: [] }, bounds: [], is_auto: true }), def_id: DefId(DefId(2:3027 ~ core[7f4a]::marker::Send)), cfg: None }
```

After:

```
Item { name: Some("Send"), visibility: Public, def_id: DefId(DefId(2:3027 ~ core[7f4a]::marker::Send)), kind: Trait, docs: "Types that can be transferred across thread boundaries.\n\nThis trait is automatically implemented when the compiler determines it's\nappropriate.\n\nAn example of a non-`Send` type is the reference-counting pointer\n[`rc::Rc`][`Rc`]. If two threads attempt to clone [`Rc`]s that point to the same\nreference-counted value, they might try to update the reference count at the\nsame time, which is [undefined behavior][ub] because [`Rc`] doesn't use atomic\noperations. Its cousin [`sync::Arc`][arc] does use atomic operations (incurring\nsome overhead) and thus is `Send`.\n\nSee [the Nomicon](../../nomicon/send-and-sync.html) for more details.\n\n[`Rc`]: ../../std/rc/struct.Rc.html\n[arc]: ../../std/sync/struct.Arc.html\n[ub]: ../../reference/behavior-considered-undefined.html" }
```

The previous output is still present if you really want it for some reason by using `{:#?}` instead of `{:?}`.

r? `@camelid`

2 years agoRollup merge of #95293 - compiler-errors:braces, r=davidtwco
Matthias Krüger [Fri, 1 Apr 2022 04:59:42 +0000 (06:59 +0200)]
Rollup merge of #95293 - compiler-errors:braces, r=davidtwco

suggest wrapping single-expr blocks in square brackets

Suggests a fix in cases like:

```diff
- const A: [i32; 1] = { 1 };

+ const A: [i32; 1] = [ 1 ];
                      ^   ^
```

Also edit the message for the same suggestion in the parser (e.g. `{ 1, 2 }`).

Fixes #95289

2 years agoRollup merge of #95260 - compiler-errors:fn, r=davidtwco
Matthias Krüger [Fri, 1 Apr 2022 04:59:41 +0000 (06:59 +0200)]
Rollup merge of #95260 - compiler-errors:fn, r=davidtwco

Better suggestions for `Fn`-family trait selection errors

1. Suppress suggestions to add `std::ops::Fn{,Mut,Once}` bounds when a type already implements `Fn{,Mut,Once}`
2. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but the arguments vary (either by number or by actual arguments)
3. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but not the right one (e.g. implements `FnMut`, but `Fn` is required).

Fixes #95147

2 years agoRollup merge of #95032 - m-ou-se:std-features, r=yaahc
Matthias Krüger [Fri, 1 Apr 2022 04:59:40 +0000 (06:59 +0200)]
Rollup merge of #95032 - m-ou-se:std-features, r=yaahc

Clean up, categorize and sort unstable features in std.

2 years agoadd notes about alignment-altering reallocs to Allocator docs
Autumn [Thu, 31 Mar 2022 23:13:19 +0000 (16:13 -0700)]
add notes about alignment-altering reallocs to Allocator docs

2 years agoAdd error message suggestion for missing noreturn in naked function
jam1garner [Thu, 31 Mar 2022 22:14:01 +0000 (18:14 -0400)]
Add error message suggestion for missing noreturn in naked function

2 years agoFix feature name of stable parts of strict_provenance
David Tolnay [Thu, 31 Mar 2022 19:46:30 +0000 (12:46 -0700)]
Fix feature name of stable parts of strict_provenance

2 years agoAdjust MaybeUninit feature names to avoid changing unstable one
David Tolnay [Thu, 31 Mar 2022 19:04:14 +0000 (12:04 -0700)]
Adjust MaybeUninit feature names to avoid changing unstable one

2 years agoAdjust feature names that disagree on const stabilization version
David Tolnay [Sun, 27 Mar 2022 02:43:11 +0000 (19:43 -0700)]
Adjust feature names that disagree on const stabilization version

2 years agoHandle rustc_const_stable attribute in library feature collector
David Tolnay [Sun, 27 Mar 2022 02:20:36 +0000 (19:20 -0700)]
Handle rustc_const_stable attribute in library feature collector

2 years agoAuto merge of #95526 - Dylan-DPC:rollup-0ikl5l5, r=Dylan-DPC
bors [Thu, 31 Mar 2022 17:45:26 +0000 (17:45 +0000)]
Auto merge of #95526 - Dylan-DPC:rollup-0ikl5l5, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #91416 (Specialize infinite-type "insert some indirection" suggestion for Option)
 - #95384 (Update target_has_atomic documentation for stabilization)
 - #95517 (small rustc_borrowck cleanup)
 - #95520 (Fix typos in core::ptr docs)
 - #95523 (remove unused field from `infcx`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agomake utf8_char_counts test faster in Miri
Ralf Jung [Thu, 31 Mar 2022 17:10:53 +0000 (13:10 -0400)]
make utf8_char_counts test faster in Miri

2 years agoCategorize and sort unstable features in std.
Mara Bos [Thu, 17 Mar 2022 10:05:32 +0000 (11:05 +0100)]
Categorize and sort unstable features in std.

2 years agoMerge impl_constness and is_const_fn_raw.
Camille GILLOT [Sun, 13 Mar 2022 10:12:50 +0000 (11:12 +0100)]
Merge impl_constness and is_const_fn_raw.

2 years agorustdoc: do not show primitives and keywords as private
Michael Howell [Thu, 31 Mar 2022 15:56:41 +0000 (08:56 -0700)]
rustdoc: do not show primitives and keywords as private

2 years agoCreate trait_def table.
Camille GILLOT [Thu, 10 Mar 2022 18:07:27 +0000 (19:07 +0100)]
Create trait_def table.

2 years agoStore fn constness in impl_constness.
Camille GILLOT [Wed, 9 Mar 2022 23:37:42 +0000 (00:37 +0100)]
Store fn constness in impl_constness.

2 years agoexpand: Do not count metavar declarations on RHS of `macro_rules`
Vadim Petrochenkov [Thu, 31 Mar 2022 15:56:40 +0000 (18:56 +0300)]
expand: Do not count metavar declarations on RHS of `macro_rules`

They are 0 by definition there.

2 years agoIntroduce repr_options table.
Camille GILLOT [Thu, 3 Mar 2022 16:51:47 +0000 (17:51 +0100)]
Introduce repr_options table.

2 years agoskip slow int_log tests in Miri
Ralf Jung [Thu, 31 Mar 2022 14:44:29 +0000 (10:44 -0400)]
skip slow int_log tests in Miri

2 years agoRollup merge of #95523 - lcnr:yeet-unused-field, r=oli-obk
Dylan DPC [Thu, 31 Mar 2022 15:29:56 +0000 (17:29 +0200)]
Rollup merge of #95523 - lcnr:yeet-unused-field, r=oli-obk

remove unused field from `infcx`

r? `@oli-obk` did we stop needing that for opaque types?

2 years agoRollup merge of #95520 - rust-lang:ptrtypo, r=lcnr
Dylan DPC [Thu, 31 Mar 2022 15:29:55 +0000 (17:29 +0200)]
Rollup merge of #95520 - rust-lang:ptrtypo, r=lcnr

Fix typos in core::ptr docs

2 years agoRollup merge of #95517 - lcnr:rustc_borrowck-misc, r=jackh726
Dylan DPC [Thu, 31 Mar 2022 15:29:54 +0000 (17:29 +0200)]
Rollup merge of #95517 - lcnr:rustc_borrowck-misc, r=jackh726

small rustc_borrowck cleanup

r? `@jackh726` because of the second commit, seems like that comment was missed in #91243

2 years agoRollup merge of #95384 - ehuss:doc-target_has_atomic-stabilized, r=Dylan-DPC
Dylan DPC [Thu, 31 Mar 2022 15:29:53 +0000 (17:29 +0200)]
Rollup merge of #95384 - ehuss:doc-target_has_atomic-stabilized, r=Dylan-DPC

Update target_has_atomic documentation for stabilization

`cfg(target_has_atomic)` was stabilized in #93824, but this small note in the docs was not updated at the time.

2 years agoRollup merge of #91416 - compiler-errors:infinite-ty-option-box, r=estebank
Dylan DPC [Thu, 31 Mar 2022 15:29:52 +0000 (17:29 +0200)]
Rollup merge of #91416 - compiler-errors:infinite-ty-option-box, r=estebank

Specialize infinite-type "insert some indirection" suggestion for Option

Suggest `Option<Box<_>>` instead of `Box<Option<_>>` for infinitely-recursive members of a struct.

Not sure if I can get the span of the generic subty of the Option so I can make this a `+++`-style suggestion. The current output is a tiny bit less fancy looking than the original suggestion.

Should I limit the specialization to just `Option<Box<TheOuterStruct>>`? Because right now it applies to all `Option` members in the struct that are returned by `Representability::SelfRecursive`.

Fixes #91402

r? `@estebank`
(since you wrote the original suggestion and are definitely most familiar with it!)

2 years agoAuto merge of #90204 - cjgillot:owner-pull, r=michaelwoerister
bors [Thu, 31 Mar 2022 15:20:59 +0000 (15:20 +0000)]
Auto merge of #90204 - cjgillot:owner-pull, r=michaelwoerister

Make lowering pull-based

~Based on https://github.com/rust-lang/rust/pull/90451~
Part of https://github.com/rust-lang/rust/pull/88186

The current lowering code visits all the item-likes in the AST in order, and lowers them one by one.
This PR changes it to index the AST and then proceed to lowering on-demand. This is closer to the logic of query-based lowering.

2 years agoremove unused field from `infcx`
lcnr [Thu, 31 Mar 2022 14:52:47 +0000 (16:52 +0200)]
remove unused field from `infcx`

2 years agoaddress comments, add test for shadowed Box type
Michael Goulet [Fri, 18 Feb 2022 03:49:45 +0000 (19:49 -0800)]
address comments, add test for shadowed Box type

2 years agoSpecialize suggestion for Option<T>
Michael Goulet [Wed, 1 Dec 2021 05:30:05 +0000 (21:30 -0800)]
Specialize suggestion for Option<T>

2 years agoFix typos in core::ptr docs
bstrie [Thu, 31 Mar 2022 13:56:36 +0000 (09:56 -0400)]
Fix typos in core::ptr docs

2 years agoupdate comment
lcnr [Thu, 31 Mar 2022 13:41:52 +0000 (15:41 +0200)]
update comment

2 years agoptr_metadata test: avoid ptr-to-int transmutes
Ralf Jung [Thu, 31 Mar 2022 13:32:30 +0000 (09:32 -0400)]
ptr_metadata test: avoid ptr-to-int transmutes

2 years agotest const size_of_val_raw on big value
Ralf Jung [Wed, 30 Mar 2022 02:34:37 +0000 (22:34 -0400)]
test const size_of_val_raw on big value

2 years agocatch overflow in slice size computation
Ralf Jung [Mon, 28 Mar 2022 00:02:11 +0000 (20:02 -0400)]
catch overflow in slice size computation

2 years agoaudit check_mul uses in interpret
Ralf Jung [Sun, 27 Mar 2022 23:49:52 +0000 (19:49 -0400)]
audit check_mul uses in interpret

2 years agointerpret: make isize::MAX the limit for dynamic value sizes
Ralf Jung [Sun, 27 Mar 2022 23:34:16 +0000 (19:34 -0400)]
interpret: make isize::MAX the limit for dynamic value sizes

2 years agoAuto merge of #95511 - Dylan-DPC:rollup-4n880fd, r=Dylan-DPC
bors [Thu, 31 Mar 2022 12:55:13 +0000 (12:55 +0000)]
Auto merge of #95511 - Dylan-DPC:rollup-4n880fd, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95445 (Don't build the full compiler before running unit tests)
 - #95470 (Fix last rustdoc-gui spurious test)
 - #95478 (Add note to the move size diagnostic)
 - #95495 (Remove unneeded `to_string` call)
 - #95505 (Fix library/std compilation on openbsd.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRecord item-likes in ItemLowerer.
Camille GILLOT [Thu, 15 Jul 2021 15:41:48 +0000 (17:41 +0200)]
Record item-likes in ItemLowerer.

2 years agoCreate a new LoweringContext for each item-like.
Camille GILLOT [Thu, 15 Jul 2021 14:40:41 +0000 (16:40 +0200)]
Create a new LoweringContext for each item-like.

2 years agoMake lowering pull-based.
Camille GILLOT [Wed, 14 Jul 2021 23:18:39 +0000 (01:18 +0200)]
Make lowering pull-based.

2 years agoImplement with_parent_item_lifetime_defs on ItemLowerer.
Camille GILLOT [Wed, 14 Jul 2021 18:28:56 +0000 (20:28 +0200)]
Implement with_parent_item_lifetime_defs on ItemLowerer.