Commit graph

160417 commits

Author SHA1 Message Date
pierwill
8df9248591 Remove PartialOrd and Ord from LocalDefId
Implement `Ord`, `PartialOrd` for SpanData
2021-12-22 10:50:57 -06:00
pierwill
155a4a87af Upgrade tracing-subscriber 2021-12-22 10:47:36 -06:00
Mara Bos
01217f6f4c Bless clippy test. 2021-12-22 17:25:44 +01:00
Mara Bos
22c4160c76 Bless clippy test. 2021-12-22 17:25:44 +01:00
pierwill
ea25b779eb 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
2021-12-22 10:07:44 -06:00
Vadim Petrochenkov
337ced2ef0 rustc_metadata: Merge get_ctor_def_id and get_ctor_kind
Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag
2021-12-22 11:05:54 +08:00
Guillaume Gomez
0d33f6dfa9 Move pattern matching outside of the loop 2021-12-21 23:13:45 +01:00
Oussama
88e40bc73d Add support for suggestion when using an expression 2021-12-21 22:00:14 +01:00
Oussama
5ad37b1a4b add suggestion for neg_multiply lint 2021-12-21 20:53:01 +01:00
Nicholas Nethercote
8217138f44 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.
2021-12-22 05:13:41 +11:00
Caleb Cartwright
63c2edefda rustc_builtin_macros: make asm mod public for rustfmt 2021-12-21 11:52:40 -06:00
Caleb Cartwright
7b8303d479 chore: cleanup unused imports 2021-12-21 10:55:39 -06:00
Caleb Cartwright
97c3e48834 refactor: encapsulate cfg_if parsing within parse mod 2021-12-21 10:55:39 -06:00
Caleb Cartwright
62987562e2 refactor: extract final rustc_parse touchpoint from macros.rs 2021-12-21 10:55:39 -06:00
Caleb Cartwright
c8cf454173 refactor: move lazy_static parsing to parse mod 2021-12-21 10:55:39 -06:00
Caleb Cartwright
9ce5470a8c refactor: move macro arg parsing to parse mod 2021-12-21 10:55:39 -06:00
Caleb Cartwright
40b73d8fee refactor: rename syntux mod to parse 2021-12-21 10:55:39 -06:00
fee1-dead
1ea4aa0036
Fixed a small typo in ui test comments 2021-12-22 00:25:50 +08:00
bors
e100ec5bc7 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)
2021-12-21 16:04:54 +00:00
bors
8ad3c1dd1d Auto merge of #92149 - fee1-dead:cache-fix, r=oli-obk
Fix bad caching of `~const Drop` bounds

Fixes #92111.
2021-12-21 12:49:10 +00:00
Vadim Petrochenkov
1324100800 resolve: Minor miscellaneous cleanups from #89059 2021-12-21 20:26:41 +08:00
Vadim Petrochenkov
046a682899 rustc_metadata: Switch crate data iteration from a callback to iterator
The iteration looks more conventional this way, and some allocations are avoided.
2021-12-21 19:46:19 +08:00
Mara Bos
ad6ef48dd9 Use panic() instead of panic!() in some places in core. 2021-12-21 10:39:00 +01:00
bors
3d57c61a9e 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
2021-12-21 09:01:25 +00:00
Matthias Krüger
ee45a532f3
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
2021-12-21 08:33:43 +01:00
Matthias Krüger
55b494445a
Rollup merge of #92129 - RalfJung:join-handle-docs, r=jyn514
JoinHandle docs: add missing 'the'
2021-12-21 08:33:42 +01:00
Matthias Krüger
b9c3243801
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`
2021-12-21 08:33:41 +01:00
Matthias Krüger
4d840a6e45
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>];
}
```
2021-12-21 08:33:40 +01:00
Matthias Krüger
790950a530
Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett
Suggest adding a `#[cfg(test)]` to to a test module

closes #88138
2021-12-21 08:33:39 +01:00
Matthias Krüger
af09d24ff6
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
2021-12-21 08:33:37 +01:00
Matthias Krüger
3009dd7c5a
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.
2021-12-21 08:33:37 +01:00
bors
87e8639d8d 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.
2021-12-21 05:42:10 +00:00
Deadbeef
aaaad5b46b
Fix bad caching of ~const Drop bounds 2021-12-21 13:25:43 +08:00
Michael Goulet
682a3428a3 Fixup tests for issue-86035 2021-12-20 19:53:31 -08:00
Michael Goulet
f83508592b Suggest glob-import if we need to import a trait, but it has no visible name 2021-12-20 19:50:15 -08:00
Michael Goulet
c327627a68 Bail if printing item named _ in try_print_visible_def_path 2021-12-20 19:50:15 -08:00
Michael Goulet
1f2cf1e9b7 Prefer visibility paths where items are not named _ 2021-12-20 19:50:15 -08:00
Michael Goulet
48dab5c960 Test for issue-86035 2021-12-20 19:50:06 -08:00
bors
46171fa96c Auto merge of #92126 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/92101
r? `@ghost`
2021-12-21 02:28:46 +00:00
Tomoaki Kawada
874514c7b4 kmc-solid: Add std::sys::solid::fs::File::read_buf
Catching up with commit 3b263ceb5c
2021-12-21 11:18:35 +09:00
bors
99b0799608 Auto merge of #92144 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum
Add tmandry to .mailmap
2021-12-20 23:19:14 +00:00
Tyler Mandry
d38f68e806
Add tmandry to .mailmap 2021-12-20 15:16:44 -08:00
bors
fea103d302 Auto merge of #8150 - flip1995:clippy_utils_test, r=xFrednet
Test clippy_utils in CI

r? `@xFrednet` Since you did the last refactor of the `str_utils` functions in #7873

changelog: Make sure tests in `clippy_utils` are passing by testing it in CI
2021-12-20 22:53:47 +00:00
Caleb Cartwright
0346bc74a7
Merge pull request #5140 from calebcartwright/subtree-sync-2021-12-19
Subtree sync
2021-12-20 16:40:50 -06:00
Ralf Jung
56b7d5fc49 better name for AdjustForForeignAbiError error variant in InterpError 2021-12-20 22:37:15 +01:00
Ralf Jung
a97f41fd69 don't ICE on variadic function calls 2021-12-20 22:37:14 +01:00
Ralf Jung
b815532674 try to fix ICE in fn_abi_of_instance 2021-12-20 22:37:14 +01:00
Ralf Jung
90d7dada69 also compare ArgAttributes 2021-12-20 22:37:14 +01:00
Ralf Jung
b5c7530fcf compare calling convention instead of call ABI 2021-12-20 22:37:14 +01:00
Ralf Jung
fcc5fd6135 const_eval machine: use original instance for replaced MIR bodies 2021-12-20 22:37:14 +01:00