]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRustdoc: use `is_doc_hidden` method on more places
Jakub Beránek [Thu, 23 Dec 2021 10:31:05 +0000 (11:31 +0100)]
Rustdoc: use `is_doc_hidden` method on more places

2 years agoAuto merge of #92167 - pierwill:chalk-update, r=jackh726
bors [Thu, 23 Dec 2021 08:59:55 +0000 (08:59 +0000)]
Auto merge of #92167 - pierwill:chalk-update, r=jackh726

Update chalk to 0.75.0

- Compute flags in `intern_ty`
- Remove `tracing-serde` from `PERMITTED_DEPENDENCIES`
- Bump `tracing-tree` to 0.2.0
- Bump `tracing-subscriber` to 0.3.3

2 years agoRemove useless `#[global_allocator]` from rustc and rustdoc.
Nicholas Nethercote [Thu, 23 Dec 2021 04:47:32 +0000 (15:47 +1100)]
Remove useless `#[global_allocator]` from rustc and rustdoc.

This was added in #83152, which has several errors in its comments.

This commit also fix up the comments, which are quite wrong and
misleading.

2 years agoAuto merge of #92155 - m-ou-se:panic-fn, r=eddyb
bors [Thu, 23 Dec 2021 05:17:47 +0000 (05:17 +0000)]
Auto merge of #92155 - m-ou-se:panic-fn, r=eddyb

Use panic() instead of panic!() in some places in core.

See https://github.com/rust-lang/rust/pull/92068 and https://github.com/rust-lang/rust/pull/92140.

This avoids the `panic!()` macro in a few potentially hot paths. This becomes more relevant when switching `core` to Rust 2021, as it'll avoid format_args!() and save some compilation time. (It doesn't make a huge difference, but still.) (Also the errors in const panic become slightly nicer.)

2 years agoRemove VCVARS_BAT
Eric Huss [Thu, 23 Dec 2021 03:18:06 +0000 (19:18 -0800)]
Remove VCVARS_BAT

2 years agoAuto merge of #92216 - matthiaskrgr:rollup-luplvuc, r=matthiaskrgr
bors [Thu, 23 Dec 2021 01:47:08 +0000 (01:47 +0000)]
Auto merge of #92216 - matthiaskrgr:rollup-luplvuc, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #88858 (Allow reverse iteration of lowercase'd/uppercase'd chars)
 - #91544 (Fix duplicate derive clone suggestion)
 - #92026 (Add some JSDoc comments to rustdoc JS)
 - #92117 (kmc-solid: Add `std::sys::solid::fs::File::read_buf`)
 - #92139 (Change Backtrace::enabled atomic from SeqCst to Relaxed)
 - #92146 (Don't emit shared files when scraping examples from dependencies in Rustdoc)
 - #92208 (Quote bat script command line)

Failed merges:

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

2 years agoRollup merge of #92208 - ChrisDenton:win-bat-cmd, r=dtolnay
Matthias Krüger [Wed, 22 Dec 2021 23:28:56 +0000 (00:28 +0100)]
Rollup merge of #92208 - ChrisDenton:win-bat-cmd, r=dtolnay

Quote bat script command line

Fixes #91991

[`CreateProcessW`](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#parameters) should only be used to run exe files but it does have some (undocumented) special handling for files with `.bat` and `.cmd` extensions. Essentially those magic extensions will cause the parameters to be automatically rewritten. Example pseudo Rust code (note that `CreateProcess` starts with an optional application name followed by the application arguments):
```rust
// These arguments...
CreateProcess(None, `@"foo.bat` "hello world""`@,` ...);
// ...are rewritten as
CreateProcess(Some(r"C:\Windows\System32\cmd.exe"), `@""foo.bat` "hello world"""`@,` ...);
```

However, when setting the first parameter (the application name) as we now do, it will omit the extra level of quotes around the arguments:

```rust
// These arguments...
CreateProcess(Some("foo.bat"), `@"foo.bat` "hello world""`@,` ...);
// ...are rewritten as
CreateProcess(Some(r"C:\Windows\System32\cmd.exe"), `@"foo.bat` "hello world""`@,` ...);
```

This means the arguments won't be passed to the script as intended.

Note that running batch files this way is undocumented but people have relied on this so we probably shouldn't break it.

2 years agoRollup merge of #92146 - willcrichton:example-analyzer, r=jyn514
Matthias Krüger [Wed, 22 Dec 2021 23:28:55 +0000 (00:28 +0100)]
Rollup merge of #92146 - willcrichton:example-analyzer, r=jyn514

Don't emit shared files when scraping examples from dependencies in Rustdoc

This PR fixes #91605. The issue is that `Context::init` gets called when scraping dependencies. By default, just calling `init` calls into `write_shared` and `build_index` which register the scraped crate into a list that later gets used for the Rustdoc sidebar. The fix is to ensure that `write_shared` is not called when scraping.

r? `@jyn514`

2 years agoRollup merge of #92139 - dtolnay:backtrace, r=m-ou-se
Matthias Krüger [Wed, 22 Dec 2021 23:28:54 +0000 (00:28 +0100)]
Rollup merge of #92139 - dtolnay:backtrace, r=m-ou-se

Change Backtrace::enabled atomic from SeqCst to Relaxed

This atomic is not synchronizing anything outside of its own value, so we don't need the `Acquire`/`Release` guarantee that all memory operations prior to the store are visible after the subsequent load, nor the `SeqCst` guarantee of all threads seeing all of the sequentially consistent operations in the same order.

Using `Relaxed` reduces the overhead of `Backtrace::capture()` in the case that backtraces are not enabled.

## Benchmark

```rust
#![feature(backtrace)]

use std::backtrace::Backtrace;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
use std::time::Instant;

fn main() {
    let begin = Instant::now();
    let mut threads = Vec::new();
    for _ in 0..64 {
        threads.push(thread::spawn(|| {
            for _ in 0..10_000_000 {
                let _ = Backtrace::capture();
                static LOL: AtomicUsize = AtomicUsize::new(0);
                LOL.store(1, Ordering::Release);
            }
        }));
    }
    for thread in threads {
        let _ = thread.join();
    }
    println!("{:?}", begin.elapsed());
}
```

**Before:** 6.73 seconds
**After:** 5.18 seconds

2 years agoRollup merge of #92117 - solid-rs:fix-kmc-solid-read-buf, r=yaahc
Matthias Krüger [Wed, 22 Dec 2021 23:28:53 +0000 (00:28 +0100)]
Rollup merge of #92117 - solid-rs:fix-kmc-solid-read-buf, r=yaahc

kmc-solid: Add `std::sys::solid::fs::File::read_buf`

This PR adds `std::sys::solid::fs::File::read_buf` to catch up with the changes introduced by #81156 and fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets..

2 years agoRollup merge of #92026 - jsha:jsdoc-search, r=GuillaumeGomez
Matthias Krüger [Wed, 22 Dec 2021 23:28:52 +0000 (00:28 +0100)]
Rollup merge of #92026 - jsha:jsdoc-search, r=GuillaumeGomez

Add some JSDoc comments to rustdoc JS

This follows the Closure Compiler dialect of JSDoc, so we can use it to do some basic type checking. We don't plan to compile with Closure Compiler, just use it to check types. See https://github.com/google/closure-compiler/wiki/ for details.

To try checking the annotations, run:

```
npm i -g google-closure-compiler
google-closure-compiler -W VERBOSE build/x86_64-unknown-linux-gnu/doc/{search-index1.59.0.js,crates1.59.0.js} src/librustdoc/html/static/js/{search.js,main.js,storage.js} --externs src/librustdoc/html/static/js/externs.js >/dev/null
```

You'll see some warnings that "String continuations are not recommended". I'm not addressing those right now.

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/doc.20format.20for.20JS/near/265209466).

r? `@GuillaumeGomez`

2 years agoRollup merge of #91544 - rukai:91492, r=wesleywiser
Matthias Krüger [Wed, 22 Dec 2021 23:28:51 +0000 (00:28 +0100)]
Rollup merge of #91544 - rukai:91492, r=wesleywiser

Fix duplicate derive clone suggestion

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

The addition of:
```rust
derives.sort();
derives.dedup();
```
is what actually solves the problem.
The rest is just cleanup.

I want to improve the diagnostic message to provide the suggestion as a proper diff but ran into some problems, so I'll attempt that again in a follow up PR.

2 years agoRollup merge of #88858 - spektom:to_lower_upper_rev, r=dtolnay
Matthias Krüger [Wed, 22 Dec 2021 23:28:51 +0000 (00:28 +0100)]
Rollup merge of #88858 - spektom:to_lower_upper_rev, r=dtolnay

Allow reverse iteration of lowercase'd/uppercase'd chars

The PR implements `DoubleEndedIterator` trait for `ToLowercase` and `ToUppercase`.

This enables reverse iteration of lowercase/uppercase variants of character sequences.
One of use cases:  determining whether a char sequence is a suffix of another one.

Example:

```rust
fn endswith_ignore_case(s1: &str, s2: &str) -> bool {
    for eob in s1
        .chars()
        .flat_map(|c| c.to_lowercase())
        .rev()
        .zip_longest(s2.chars().flat_map(|c| c.to_lowercase()).rev())
    {
        match eob {
            EitherOrBoth::Both(c1, c2) => {
                if c1 != c2 {
                    return false;
                }
            }
            EitherOrBoth::Left(_) => return true,
            EitherOrBoth::Right(_) => return false,
        }
    }
    true
}
```

2 years agoAuto merge of #90408 - pierwill:untrack-localdefid-90317, r=cjgillot
bors [Wed, 22 Dec 2021 22:33:11 +0000 (22:33 +0000)]
Auto merge of #90408 - pierwill:untrack-localdefid-90317, r=cjgillot

Remove `PartialOrd`, `Ord` from `LocalDefId`

Part of work on https://github.com/rust-lang/rust/issues/90317.

2 years agoAdd some JSDoc comments to rustdoc JS
Jacob Hoffman-Andrews [Fri, 17 Dec 2021 05:17:22 +0000 (21:17 -0800)]
Add some JSDoc comments to rustdoc JS

This follows the Closure Compiler dialect of JSDoc, so we
can use it to do some basic type checking. We don't plan to
compile with Closure Compiler, just use it to check types. See
https://github.com/google/closure-compiler/wiki/ for details.

2 years agoStore a `DefId` instead of an `AdtDef` in `AggregateKind::Adt`
Aaron Hill [Wed, 22 Dec 2021 19:35:17 +0000 (14:35 -0500)]
Store a `DefId` instead of an `AdtDef` in `AggregateKind::Adt`

The `AggregateKind` enum ends up in the final mir `Body`. Currently,
any changes to `AdtDef` (regardless of how significant they are)
will legitimately cause the overall result of `optimized_mir` to change,
invalidating any codegen re-use involving that mir.

This will get worse once we start hashing the `Span` inside `FieldDef`
(which is itself contained in `AdtDef`).

To try to reduce these kinds of invalidations, this commit changes
`AggregateKind::Adt` to store just the `DefId`, instead of the full
`AdtDef`. This allows the result of `optimized_mir` to be unchanged
if the `AdtDef` changes in a way that doesn't actually affect any
of the MIR we build.

2 years agoAuto merge of #92201 - ChrisDenton:fix-tests, r=Mark-Simulacrum
bors [Wed, 22 Dec 2021 19:21:25 +0000 (19:21 +0000)]
Auto merge of #92201 - ChrisDenton:fix-tests, r=Mark-Simulacrum

Fix failing tests

Fixes tests that have been failing in CI.

I hope it's ok but I've temporarily commented out some of the Windows resolver tests. I actually have a bigger fix for that test code as part of another PR. I could separate it out and patch as necessary but I'd prefer not to rush into that if possible.

r? `@Mark-Simulacrum`

2 years agoUpdate stability attribute for double ended case mapping iterators
David Tolnay [Wed, 22 Dec 2021 18:49:51 +0000 (10:49 -0800)]
Update stability attribute for double ended case mapping iterators

2 years agoFix tests
Chris Denton [Wed, 22 Dec 2021 18:31:36 +0000 (18:31 +0000)]
Fix tests

2 years agorustc `VecGraph`: require the index type to implement Ord
pierwill [Tue, 7 Dec 2021 18:29:13 +0000 (12:29 -0600)]
rustc `VecGraph`: require the index type to implement Ord

2 years agoRequire Ord for rustc_index::SparseBitSet::last_set_in
pierwill [Tue, 7 Dec 2021 17:03:53 +0000 (11:03 -0600)]
Require Ord for rustc_index::SparseBitSet::last_set_in

2 years agoRemove `PartialOrd` and `Ord` from `LocalDefId`
pierwill [Sat, 30 Oct 2021 15:11:50 +0000 (10:11 -0500)]
Remove `PartialOrd` and `Ord` from `LocalDefId`

Implement `Ord`, `PartialOrd` for SpanData

2 years agoUpgrade `tracing-subscriber`
pierwill [Wed, 22 Dec 2021 16:14:06 +0000 (10:14 -0600)]
Upgrade `tracing-subscriber`

2 years agoBless clippy test.
Mara Bos [Wed, 22 Dec 2021 16:25:44 +0000 (17:25 +0100)]
Bless clippy test.

2 years agoUpdate chalk to 0.75.0
pierwill [Tue, 21 Dec 2021 17:00:30 +0000 (11:00 -0600)]
Update chalk to 0.75.0

- Compute flags in `intern_ty`
- Remove tracing-serde from PERMITTED_DEPENDENCIES
- Disable `tracing-full` feature in `chalk-solve`
- Bump tracing-tree to 0.2.0

2 years agorustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind`
Vadim Petrochenkov [Tue, 21 Dec 2021 09:41:02 +0000 (17:41 +0800)]
rustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind`

Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag

2 years agoMove pattern matching outside of the loop
Guillaume Gomez [Tue, 21 Dec 2021 21:17:17 +0000 (22:17 +0100)]
Move pattern matching outside of the loop

2 years agoRawVec: don't recompute capacity after allocating.
Nicholas Nethercote [Tue, 21 Dec 2021 18:13:41 +0000 (05:13 +1100)]
RawVec: don't recompute capacity after allocating.

Currently it sets the capacity to `ptr.len() / mem::size_of::<T>()`
after any buffer allocation/reallocation. This would be useful if
allocators ever returned a `NonNull<[u8]>` with a size larger than
requested. But this never happens, so it's not useful.

Removing this slightly reduces the size of generated LLVM IR, and
slightly speeds up the hot path of `RawVec` growth.

2 years agorustc_builtin_macros: make asm mod public for rustfmt
Caleb Cartwright [Tue, 21 Dec 2021 04:05:17 +0000 (22:05 -0600)]
rustc_builtin_macros: make asm mod public for rustfmt

2 years agoFixed a small typo in ui test comments
fee1-dead [Tue, 21 Dec 2021 16:25:50 +0000 (00:25 +0800)]
Fixed a small typo in ui test comments

2 years agoAuto merge of #92095 - vacuus:master, r=jyn514
bors [Tue, 21 Dec 2021 16:04:54 +0000 (16:04 +0000)]
Auto merge of #92095 - vacuus:master, r=jyn514

rustdoc: Remove 'need_backline' field from `DocFragment`

Fixes [#92084](https://github.com/rust-lang/rust/issues/92084)

2 years agoAuto merge of #92149 - fee1-dead:cache-fix, r=oli-obk
bors [Tue, 21 Dec 2021 12:49:10 +0000 (12:49 +0000)]
Auto merge of #92149 - fee1-dead:cache-fix, r=oli-obk

Fix bad caching of `~const Drop` bounds

Fixes #92111.

2 years agoresolve: Minor miscellaneous cleanups from #89059
Vadim Petrochenkov [Tue, 21 Dec 2021 12:11:36 +0000 (20:11 +0800)]
resolve: Minor miscellaneous cleanups from #89059

2 years agorustc_metadata: Switch crate data iteration from a callback to iterator
Vadim Petrochenkov [Tue, 21 Dec 2021 11:40:11 +0000 (19:40 +0800)]
rustc_metadata: Switch crate data iteration from a callback to iterator

The iteration looks more conventional this way, and some allocations are avoided.

2 years agoUse panic() instead of panic!() in some places in core.
Mara Bos [Tue, 21 Dec 2021 09:39:00 +0000 (10:39 +0100)]
Use panic() instead of panic!() in some places in core.

2 years agoAuto merge of #92152 - matthiaskrgr:rollup-nmskpw6, r=matthiaskrgr
bors [Tue, 21 Dec 2021 09:01:25 +0000 (09:01 +0000)]
Auto merge of #92152 - matthiaskrgr:rollup-nmskpw6, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90345 (Stabilise entry_insert)
 - #91412 (Improve suggestions for importing out-of-scope traits reexported as `_`)
 - #91770 (Suggest adding a `#[cfg(test)]` to to a test module)
 - #91823 (Make `PTR::as_ref` and similar methods `const`.)
 - #92127 (Move duplicates removal when generating results instead of when displaying them)
 - #92129 (JoinHandle docs: add missing 'the')
 - #92131 (Sync rustc_codegen_cranelift)

Failed merges:

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

2 years agoRollup merge of #92131 - bjorn3:sync_cg_clif-2021-12-20, r=bjorn3
Matthias Krüger [Tue, 21 Dec 2021 07:33:43 +0000 (08:33 +0100)]
Rollup merge of #92131 - bjorn3:sync_cg_clif-2021-12-20, r=bjorn3

Sync rustc_codegen_cranelift

The main highlight this sync is improved support for inline assembly. Thanks `@nbdd0121!` Inline assembly is still disabled by default for builds in the main rust repo though. Cranelift will now also be built from the crates.io releases rather than the git repo. Git repos are incompatible with vendoring.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

2 years agoRollup merge of #92129 - RalfJung:join-handle-docs, r=jyn514
Matthias Krüger [Tue, 21 Dec 2021 07:33:42 +0000 (08:33 +0100)]
Rollup merge of #92129 - RalfJung:join-handle-docs, r=jyn514

JoinHandle docs: add missing 'the'

2 years agoRollup merge of #92127 - GuillaumeGomez:search-results-duplicate-removal, r=jsha
Matthias Krüger [Tue, 21 Dec 2021 07:33:41 +0000 (08:33 +0100)]
Rollup merge of #92127 - GuillaumeGomez:search-results-duplicate-removal, r=jsha

Move duplicates removal when generating results instead of when displaying them

Currently, we store 200 results per tab and then display them. However, it was possible to have duplicates which is why we have this check. However, instead of doing it when displaying the results, it's much better instead to do it even before to simplify the display part a bit.

r? `@jsha`

2 years agoRollup merge of #91823 - woppopo:const_ptr_as_ref, r=lcnr
Matthias Krüger [Tue, 21 Dec 2021 07:33:40 +0000 (08:33 +0100)]
Rollup merge of #91823 - woppopo:const_ptr_as_ref, r=lcnr

Make `PTR::as_ref` and similar methods `const`.

Tracking issue: #91822
Feature gate: `#![feature(const_ptr_as_ref)]`

```rust
// core::ptr
impl<T: ?Sized> *const T {
    pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>;
    pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>;
}

impl<T: ?Sized> *mut T {
    pub const unsafe fn as_ref<'a>(self) -> Option<&'a T>;
    pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_mut<'a>(self) -> Option<&'a mut T>;
    pub const unsafe fn as_uninit_mut<'a>(self) -> Option<&'a mut MaybeUninit<T>>
    where
        T: Sized;
    pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]>;
    pub const unsafe fn as_uninit_slice_mut<'a>(self) -> Option<&'a mut [MaybeUninit<T>]>;
}

impl<T: Sized> NonNull<T> {
    pub const unsafe fn as_uninit_ref<'a>(&self) -> &'a MaybeUninit<T>;
    pub const unsafe fn as_uninit_mut<'a>(&mut self) -> &'a mut MaybeUninit<T>;
}

impl<T: ?Sized> NonNull<T> {
    pub const unsafe fn as_ref<'a>(&self) -> &'a T;
    pub const unsafe fn as_mut<'a>(&mut self) -> &'a mut T;
    pub const unsafe fn as_uninit_slice<'a>(&self) -> &'a [MaybeUninit<T>];
    pub const unsafe fn as_uninit_slice_mut<'a>(&self) -> &'a mut [MaybeUninit<T>];
}
```

2 years agoRollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett
Matthias Krüger [Tue, 21 Dec 2021 07:33:39 +0000 (08:33 +0100)]
Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett

Suggest adding a `#[cfg(test)]` to to a test module

closes #88138

2 years agoRollup merge of #91412 - compiler-errors:issue-86035, r=oli-obk
Matthias Krüger [Tue, 21 Dec 2021 07:33:37 +0000 (08:33 +0100)]
Rollup merge of #91412 - compiler-errors:issue-86035, r=oli-obk

Improve suggestions for importing out-of-scope traits reexported as `_`

1. Fix up the `parent_map` query to prefer visible parents that _don't_ export items with the name `_`.
    * I'm not sure if I modified this query properly. Not sure if we want to check for other idents than `kw::Underscore`.
    * This also has the side-effect of not doing BFS on any modules re-exported as `_`, but I think that's desirable here too (or else we get suggestions for paths like `a::_::b` like in [this doctest example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d9505ea45bb80adf40bb991298f952be)).
2. Bail in `try_print_visible_def_path` if the `def_id` is re-exported as `_`, which will fall back to printing the def-id's real (definition) path.
    * Side-effect of this is that we print paths that are not actually public, but it seems we already sometimes suggest `use`ing paths that are private anyways. See [this doctest example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bad513ed3241f8ff87579eed8046ad10) for demonstration of current behavior.
3. Suggest a glob-import (for example `my_library::prelude::*`) if the trait in question is only pub-exported as `_`, as a fallback.
    ```
    use foo::bar::prelude::*; // trait MyTrait
    ```
    * I think this is good fallback behavior to suggest instead of doing nothing. Thanks to the original issue filer for suggesting this.

I was somewhat opinionated about behaviors in this PR, and I'm totally open to limiting the impact of my changes or only landing parts of this. Happy to receive feedback if there are better ways to the same end.

Fixes #86035

2 years agoRollup merge of #90345 - passcod:entry-insert, r=dtolnay
Matthias Krüger [Tue, 21 Dec 2021 07:33:37 +0000 (08:33 +0100)]
Rollup merge of #90345 - passcod:entry-insert, r=dtolnay

Stabilise entry_insert

This stabilises `HashMap:Entry::insert_entry` etc. Tracking issue #65225. It will need an FCP.

This was implemented in #64656 two years ago.

This PR includes the rename and change discussed in https://github.com/rust-lang/rust/issues/65225#issuecomment-910652430, happy to split if needed.

2 years agoAuto merge of #91903 - tmiasko:bit-set-hash, r=jackh726
bors [Tue, 21 Dec 2021 05:42:10 +0000 (05:42 +0000)]
Auto merge of #91903 - tmiasko:bit-set-hash, r=jackh726

Implement StableHash for BitSet and BitMatrix via Hash

This fixes an issue where bit sets / bit matrices the same word
content but a different domain size would receive the same hash.

2 years agoFix bad caching of `~const Drop` bounds
Deadbeef [Tue, 21 Dec 2021 05:23:59 +0000 (13:23 +0800)]
Fix bad caching of `~const Drop` bounds

2 years agoFixup tests for issue-86035
Michael Goulet [Wed, 1 Dec 2021 02:27:04 +0000 (18:27 -0800)]
Fixup tests for issue-86035

2 years agoSuggest glob-import if we need to import a trait, but it has no visible name
Michael Goulet [Wed, 1 Dec 2021 01:20:38 +0000 (17:20 -0800)]
Suggest glob-import if we need to import a trait, but it has no visible name

2 years agoBail if printing item named `_` in `try_print_visible_def_path`
Michael Goulet [Wed, 1 Dec 2021 01:19:37 +0000 (17:19 -0800)]
Bail if printing item named `_` in `try_print_visible_def_path`

2 years agoPrefer visibility paths where items are not named `_`
Michael Goulet [Wed, 1 Dec 2021 01:18:48 +0000 (17:18 -0800)]
Prefer visibility paths where items are not named `_`

2 years agoTest for issue-86035
Michael Goulet [Wed, 1 Dec 2021 01:53:39 +0000 (17:53 -0800)]
Test for issue-86035

2 years agoAuto merge of #92126 - RalfJung:miri, r=RalfJung
bors [Tue, 21 Dec 2021 02:28:46 +0000 (02:28 +0000)]
Auto merge of #92126 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/92101
r? `@ghost`

2 years agokmc-solid: Add `std::sys::solid::fs::File::read_buf`
Tomoaki Kawada [Mon, 20 Dec 2021 05:20:48 +0000 (14:20 +0900)]
kmc-solid: Add `std::sys::solid::fs::File::read_buf`

Catching up with commit 3b263ceb5cb89b6d53b5a03b47ec447c3a7f7765

2 years agoAuto merge of #92144 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum
bors [Mon, 20 Dec 2021 23:19:14 +0000 (23:19 +0000)]
Auto merge of #92144 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum

Add tmandry to .mailmap

2 years agoAdd tmandry to .mailmap
Tyler Mandry [Mon, 20 Dec 2021 23:16:44 +0000 (15:16 -0800)]
Add tmandry to .mailmap

2 years agobetter name for AdjustForForeignAbiError error variant in InterpError
Ralf Jung [Sat, 11 Dec 2021 23:45:03 +0000 (18:45 -0500)]
better name for AdjustForForeignAbiError error variant in InterpError

2 years agodon't ICE on variadic function calls
Ralf Jung [Mon, 6 Dec 2021 22:58:24 +0000 (17:58 -0500)]
don't ICE on variadic function calls

2 years agotry to fix ICE in fn_abi_of_instance
Ralf Jung [Sun, 5 Dec 2021 02:53:01 +0000 (21:53 -0500)]
try to fix ICE in fn_abi_of_instance

2 years agoalso compare ArgAttributes
Ralf Jung [Fri, 3 Dec 2021 02:32:10 +0000 (21:32 -0500)]
also compare ArgAttributes

2 years agocompare calling convention instead of call ABI
Ralf Jung [Thu, 2 Dec 2021 02:37:23 +0000 (21:37 -0500)]
compare calling convention instead of call ABI

2 years agoconst_eval machine: use original instance for replaced MIR bodies
Ralf Jung [Tue, 30 Nov 2021 03:02:17 +0000 (22:02 -0500)]
const_eval machine: use original instance for replaced MIR bodies

2 years agoCTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility
Ralf Jung [Mon, 29 Nov 2021 00:35:50 +0000 (19:35 -0500)]
CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility

2 years agoBump insert_entry stabilization to Rust 1.59
David Tolnay [Mon, 20 Dec 2021 21:14:06 +0000 (13:14 -0800)]
Bump insert_entry stabilization to Rust 1.59

2 years agoChange Backtrace::enabled atomic from SeqCst to Relaxed
David Tolnay [Mon, 20 Dec 2021 20:34:10 +0000 (12:34 -0800)]
Change Backtrace::enabled atomic from SeqCst to Relaxed

2 years agoAdd `#[inline]` modifier to `TypeId::of`
AngelicosPhosphoros [Mon, 20 Dec 2021 19:59:03 +0000 (22:59 +0300)]
Add `#[inline]` modifier to `TypeId::of`

It was already inlined but it happened only in 4th InlinerPass on my testcase.
With `#[inline]` modifier it happens on 2nd pass.

Closes #74362

2 years agoimpl RefUnwindSafe for Once
David Tolnay [Mon, 20 Dec 2021 19:49:47 +0000 (11:49 -0800)]
impl RefUnwindSafe for Once

2 years agoMerge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20
bjorn3 [Mon, 20 Dec 2021 17:56:35 +0000 (18:56 +0100)]
Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20

2 years agoFix taking address of truly unsized type field of unsized adt
bjorn3 [Mon, 20 Dec 2021 17:49:43 +0000 (18:49 +0100)]
Fix taking address of truly unsized type field of unsized adt

2 years agoUse hash_stable for hashing str
Jakub Beránek [Mon, 20 Dec 2021 17:46:34 +0000 (18:46 +0100)]
Use hash_stable for hashing str

2 years agoJoinHandle docs: add missing 'the'
Ralf Jung [Mon, 20 Dec 2021 17:30:29 +0000 (18:30 +0100)]
JoinHandle docs: add missing 'the'

2 years agoRustup to rustc 1.59.0-nightly (e95e084a1 2021-12-19)
bjorn3 [Mon, 20 Dec 2021 17:21:55 +0000 (18:21 +0100)]
Rustup to rustc 1.59.0-nightly (e95e084a1 2021-12-19)

2 years agoSync from rust 84f962a89bac3948ed116f1ad04c2f4793fb69ea
bjorn3 [Mon, 20 Dec 2021 17:12:18 +0000 (18:12 +0100)]
Sync from rust 84f962a89bac3948ed116f1ad04c2f4793fb69ea

2 years agoMove duplicates removal when generating results instead of when displaying them
Guillaume Gomez [Mon, 20 Dec 2021 17:01:04 +0000 (18:01 +0100)]
Move duplicates removal when generating results instead of when displaying them

2 years agoupdate Miri
Ralf Jung [Mon, 20 Dec 2021 16:02:29 +0000 (17:02 +0100)]
update Miri

2 years agoAuto merge of #92108 - r00ster91:patch-6, r=jyn514
bors [Mon, 20 Dec 2021 14:53:48 +0000 (14:53 +0000)]
Auto merge of #92108 - r00ster91:patch-6, r=jyn514

paniced -> panicked

2 years agoLoad new pass manager plugins only if the new pm is actually used
Axel Cohen [Mon, 20 Dec 2021 13:50:03 +0000 (14:50 +0100)]
Load new pass manager plugins only if the new pm is actually used

2 years agorustc_codegen_llvm: move should_use_new_llvm_pass_manager function to llvm_util
Axel Cohen [Mon, 20 Dec 2021 13:49:04 +0000 (14:49 +0100)]
rustc_codegen_llvm: move should_use_new_llvm_pass_manager function to llvm_util

2 years agodisable test with self-referential generator on Miri
Ralf Jung [Mon, 20 Dec 2021 11:33:55 +0000 (12:33 +0100)]
disable test with self-referential generator on Miri

2 years agoAuto merge of #91924 - Aaron1011:serialize-adt-def, r=michaelwoerister
bors [Mon, 20 Dec 2021 10:35:48 +0000 (10:35 +0000)]
Auto merge of #91924 - Aaron1011:serialize-adt-def, r=michaelwoerister

Fully serialize AdtDef

This avoids needing to invoke the `adt_def` query during
the decoding of another query's result.

Split out from https://github.com/rust-lang/rust/pull/91919
See https://github.com/rust-lang/rust/issues/91696#issuecomment-993043710

2 years agoAuto merge of #92041 - Aaron1011:remove-speculative-evaluation, r=jackh726
bors [Mon, 20 Dec 2021 07:30:16 +0000 (07:30 +0000)]
Auto merge of #92041 - Aaron1011:remove-speculative-evaluation, r=jackh726

Remove 'speculative evaluation' of predicates

Performing 'speculative evaluation' introduces caching bugs that
cannot be fixed without invasive changes to projection.

Hopefully, we can win back most of the performance lost by
re-adding 'cache completion'

Fixes #90662

2 years agoAuto merge of #91900 - pitaj:fix-91714, r=jyn514
bors [Mon, 20 Dec 2021 04:21:12 +0000 (04:21 +0000)]
Auto merge of #91900 - pitaj:fix-91714, r=jyn514

rustdoc: make `--passes` and `--no-defaults` have no effect

Fixes #91714

One potential issue is that currently there is no stable way to achieve `--document-hidden-items`. This affects test `issue-15347`.

I also had to modify the tests `issue-42875` and `no-compiler-export`. Regardless of combinations of `--document-hidden-items` and `--document-private-items`, I was unable to get these to pass without the modifications. I left behind a comment noting the change.

2 years agoadd test files
SparrowLii [Mon, 20 Dec 2021 02:39:02 +0000 (10:39 +0800)]
add test files

2 years agoFix the error of checking `base_expr` twice in type_changing_struct_update
SparrowLii [Mon, 20 Dec 2021 02:21:07 +0000 (10:21 +0800)]
Fix the error of checking `base_expr` twice in type_changing_struct_update

2 years agoAuto merge of #91844 - nnethercote:rm-ObligationCauseData-2, r=Mark-Simulacrum
bors [Mon, 20 Dec 2021 00:40:58 +0000 (00:40 +0000)]
Auto merge of #91844 - nnethercote:rm-ObligationCauseData-2, r=Mark-Simulacrum

Eliminate `ObligationCauseData`

This makes `Obligation` two words bigger, but avoids allocating a lot of the time.

I previously tried this in #73983 and it didn't help much, but local timings look more promising now.

r? `@ghost`

2 years agoRemove 'need_backline' field of `DocFragment`
Roc Yu [Mon, 20 Dec 2021 00:38:59 +0000 (19:38 -0500)]
Remove 'need_backline' field of `DocFragment`

2 years agoOmit check of a successive line in loop
vacuus [Sun, 19 Dec 2021 02:54:59 +0000 (21:54 -0500)]
Omit check of a successive line in loop

I think that s == "" is the only edge case (as it makes iter.next() return None the first time). The early return is necessary so that the last character of 'out' isn't popped if s == "" && !frag.need_backline

2 years agoEliminate `ObligationCauseData`.
Nicholas Nethercote [Thu, 11 Nov 2021 01:01:12 +0000 (12:01 +1100)]
Eliminate `ObligationCauseData`.

This makes `Obligation` two words bigger, but avoids allocating a lot of
the time.

I previously tried this in #73983 and it didn't help much, but local
timings look more promising now.

2 years agoBackport LLVM changes to disable deferred inlining
Simonas Kazlauskas [Sun, 19 Dec 2021 21:49:03 +0000 (23:49 +0200)]
Backport LLVM changes to disable deferred inlining

2 years agopaniced -> panicked
r00ster [Sun, 19 Dec 2021 20:08:19 +0000 (21:08 +0100)]
paniced -> panicked

2 years agoAuto merge of #92106 - matthiaskrgr:rollup-zw6t1mu, r=matthiaskrgr
bors [Sun, 19 Dec 2021 17:14:12 +0000 (17:14 +0000)]
Auto merge of #92106 - matthiaskrgr:rollup-zw6t1mu, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #91791 (Fix an ICE when lowering a float with missing exponent magnitude)
 - #91878 (Remove `in_band_lifetimes` from `rustc_infer`)
 - #91895 (Remove `in_band_lifetimes` for `rustc_monomorphize`)
 - #92029 (Explicitly set no ELF flags for .rustc section)

Failed merges:

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

2 years agoRollup merge of #92029 - nikic:section-flags-fix, r=davidtwco
Matthias Krüger [Sun, 19 Dec 2021 16:38:35 +0000 (17:38 +0100)]
Rollup merge of #92029 - nikic:section-flags-fix, r=davidtwco

Explicitly set no ELF flags for .rustc section

For a data section, the object crate will set the SHF_ALLOC by default, which is exactly what we don't want. Explicitly set sh_flags to zero to avoid this.

I checked with `objdump -h` that this produces the right flags for ELF.

Fixes #92013.

2 years agoRollup merge of #91895 - pitaj:91867-monomorphize, r=Aaron1011
Matthias Krüger [Sun, 19 Dec 2021 16:38:34 +0000 (17:38 +0100)]
Rollup merge of #91895 - pitaj:91867-monomorphize, r=Aaron1011

Remove `in_band_lifetimes` for `rustc_monomorphize`

#91867

2 years agoRollup merge of #91878 - LegionMammal978:less-inband-infer, r=Aaron1011
Matthias Krüger [Sun, 19 Dec 2021 16:38:33 +0000 (17:38 +0100)]
Rollup merge of #91878 - LegionMammal978:less-inband-infer, r=Aaron1011

Remove `in_band_lifetimes` from `rustc_infer`

See #91867 for more information.

This crate actually had a typo `'ctx` in one of its functions:
```diff
-pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
+pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
```
Also, I wasn't entirely sure about the lifetimes in `suggest_new_region_bound`:
```diff
 pub fn suggest_new_region_bound(
-    tcx: TyCtxt<'tcx>,
+    tcx: TyCtxt<'_>,
     err: &mut DiagnosticBuilder<'_>,
     fn_returns: Vec<&rustc_hir::Ty<'_>>,
```
Should all of those lifetimes really be distinct?

2 years agoRollup merge of #91791 - terrarier2111:fix-float-ice, r=nagisa
Matthias Krüger [Sun, 19 Dec 2021 16:38:33 +0000 (17:38 +0100)]
Rollup merge of #91791 - terrarier2111:fix-float-ice, r=nagisa

Fix an ICE when lowering a float with missing exponent magnitude

This fixes: https://github.com/rust-lang/rust/issues/91434

2 years agoAuto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr
bors [Sun, 19 Dec 2021 12:36:56 +0000 (12:36 +0000)]
Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
 - #91984 (Remove `in_band_lifetimes` from `rustc_middle`)
 - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
 - #92042 (Enable `#[thread_local]` for all windows-msvc targets)
 - #92071 (Update example code for Vec::splice to change the length)
 - #92077 (rustdoc: Remove unused `collapsed` field)
 - #92081 (rustdoc: Remove unnecessary `need_backline` function)

Failed merges:

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

2 years agoFix an ICE when lowering a float with missing exponent magnitude
threadexception [Sat, 11 Dec 2021 14:42:25 +0000 (15:42 +0100)]
Fix an ICE when lowering a float with missing exponent magnitude

Co-authored-by: Simonas Kazlauskas <github@kazlauskas.me>
2 years agoRollup merge of #92081 - jyn514:need-backline, r=GuillaumeGomez
Matthias Krüger [Sun, 19 Dec 2021 09:45:56 +0000 (10:45 +0100)]
Rollup merge of #92081 - jyn514:need-backline, r=GuillaumeGomez

rustdoc: Remove unnecessary `need_backline` function

r? `@GuillaumeGomez`

2 years agoRollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomez
Matthias Krüger [Sun, 19 Dec 2021 09:45:55 +0000 (10:45 +0100)]
Rollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomez

rustdoc: Remove unused `collapsed` field

`render/context` always runs after `run_global_context`, so it was always set to `true`.

This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was
removed ages ago, and the ability to configure passes is about to be removed.

Found while reviewing https://github.com/rust-lang/rust/pull/91305.

2 years agoRollup merge of #92071 - ajtribick:patch-1, r=the8472
Matthias Krüger [Sun, 19 Dec 2021 09:45:54 +0000 (10:45 +0100)]
Rollup merge of #92071 - ajtribick:patch-1, r=the8472

Update example code for Vec::splice to change the length

The current example for `Vec::splice` illustrates the replacement of a section of length 2 with a new section of length 2. This isn't a particularly interesting case for splice, and makes it look a bit like a shorthand for the kind of manipulations that could be done with a mutable slice.

In order to provide a stronger example, this updates the example to use different lengths for the source and destination regions, and uses a slice from the middle of the vector to illustrate that this does not necessarily have to be at the beginning or the end.

Resolves #92067

2 years agoRollup merge of #92042 - ChrisDenton:msvc-static-tls, r=nagisa
Matthias Krüger [Sun, 19 Dec 2021 09:45:53 +0000 (10:45 +0100)]
Rollup merge of #92042 - ChrisDenton:msvc-static-tls, r=nagisa

Enable `#[thread_local]` for all windows-msvc targets

As it stands, `#[thread_local]` is enabled haphazardly for msvc. It seems all 64-bit targets have it enabled, but not 32-bit targets unless they're also UWP targets (perhaps because UWP was added more recently?). So this PR simply enables it for 32-bit targets as well. I can't think of a reason not to and I've confirmed by running tests locally which pass.

See also #91659

2 years agoRollup merge of #92028 - petrochenkov:psimd, r=Mark-Simulacrum
Matthias Krüger [Sun, 19 Dec 2021 09:45:52 +0000 (10:45 +0100)]
Rollup merge of #92028 - petrochenkov:psimd, r=Mark-Simulacrum

Sync portable-simd to fix libcore build for AVX-512 enabled targets

Fixes https://github.com/rust-lang/rust/pull/91484#issuecomment-989933534
cc ``@workingjubilee``