Commit Graph

219423 Commits

Author SHA1 Message Date
Michael Goulet
1c4603e3b0 Commit some tests for the new solver + lazy norm 2023-03-11 23:16:46 +00:00
bors
8a73f50d87 Auto merge of #109019 - matthiaskrgr:rollup-ihjntil, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #104363 (Make `unused_allocation` lint against `Box::new` too)
 - #106633 (Stabilize `nonzero_min_max`)
 - #106844 (allow negative numeric literals in `concat!`)
 - #108071 (Implement goal caching with the new solver)
 - #108542 (Force parentheses around `match` expression in binary expression)
 - #108690 (Place size limits on query keys and values)
 - #108708 (Prevent overflow through Arc::downgrade)
 - #108739 (Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time)
 - #108806 (Querify register_tools and post-expansion early lints)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-11 18:15:53 +00:00
bors
67e1681c1d Auto merge of #109015 - matthiaskrgr:rollup-xu2s31g, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #106276 (Fix `vec_deque::Drain` FIXME)
 - #107629 (rustdoc: sort deprecated items lower in search)
 - #108711 (Add note when matching token with nonterminal)
 - #108757 (rustdoc: Migrate `document_item_info` to Askama)
 - #108784 (rustdoc: Migrate sidebar rendering to Askama)
 - #108927 (Move __thread_local_inner to sys)
 - #108949 (Honor current target when checking conditional compilation values)
 - #108950 (Directly construct Inherited in typeck.)
 - #108988 (rustdoc: Don't crash on `crate` references in blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-11 14:45:14 +00:00
Matthias Krüger
df50001c7d
Rollup merge of #108806 - cjgillot:query-lints, r=davidtwco
Querify register_tools and post-expansion early lints

The 2 extra queries correspond to code that happen before and after macro expansion, and don't need the resolver to exist.
2023-03-11 15:43:15 +01:00
Matthias Krüger
d7372a1787
Rollup merge of #108739 - 823984418:patch-1, r=cjgillot
Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time

Here, at the same time, there are two `start_llbb` builder, this should be unexpected.
2023-03-11 15:43:15 +01:00
Matthias Krüger
5adaa711d4
Rollup merge of #108708 - noamtashma:issue-108706-fix, r=m-ou-se
Prevent overflow through Arc::downgrade

Fixes #108706
2023-03-11 15:43:14 +01:00
Matthias Krüger
1909d933d5
Rollup merge of #108690 - Zoxc:query-size-limits, r=cjgillot
Place size limits on query keys and values

This just prevents these from growing accidentally too large. I'm not sure if there's an easy way to also print the actual size too.
2023-03-11 15:43:14 +01:00
Matthias Krüger
9c38ae5653
Rollup merge of #108542 - bwmf2:expanded, r=wesleywiser
Force parentheses around `match` expression in binary expression

This attempts to solve https://github.com/rust-lang/rust/issues/98790.
2023-03-11 15:43:13 +01:00
Matthias Krüger
244ec84a82
Rollup merge of #108071 - compiler-errors:new-solver-caching, r=lcnr
Implement goal caching with the new solver

Maybe it's wrong, idk. Opening mostly for first impressions before I go to sleep.

r? ``@lcnr,`` cc ``@cjgillot``
2023-03-11 15:43:13 +01:00
Matthias Krüger
d47d4ad4b2
Rollup merge of #106844 - Ezrashaw:concat-negative-int-lit, r=dtolnay
allow negative numeric literals in `concat!`

Fixes #106837

While *technically* negative numeric literals are implemented as unary operations, users can reasonably expect that negative literals are treated the same as positive literals.
2023-03-11 15:43:12 +01:00
Matthias Krüger
ffc0b8a545
Rollup merge of #106633 - c410-f3r:stabilize-nonzero_bits, r=dtolnay
Stabilize `nonzero_min_max`

## Overall

Stabilizes `nonzero_min_max` to allow the "infallible" construction of ordinary minimum and maximum `NonZero*` instances.

The feature is fairly straightforward and already matured for some time in stable toolchains.

```rust
let _ = NonZeroU8::MIN;
let _ = NonZeroI32::MAX;
```

## History

* On 2022-01-25, implementation was [created](https://github.com/rust-lang/rust/pull/93293).

## Considerations

* This report is fruit of the inanition observed after two unsuccessful attempts at getting feedback.
* Other constant variants discussed at https://github.com/rust-lang/rust/issues/89065#issuecomment-923238190 are orthogonal to this feature.

Fixes https://github.com/rust-lang/rust/issues/89065
2023-03-11 15:43:12 +01:00
Matthias Krüger
fbc121fdfd
Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=Nilstrieb
Make `unused_allocation` lint against `Box::new` too

Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something 🤷

This means that code like the following will be linted against:
```rust
Box::new([1, 2, 3]).len();
f(&Box::new(1)); // where f : &i32 -> ()
```
The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against:
```rust
let boxed = Box::new([1, 2, 3]); // no lint
boxed.len();
```
2023-03-11 15:43:11 +01:00
Matthias Krüger
e12ba7300a
Rollup merge of #108988 - adrianheine:crate-reference-block, r=petrochenkov
rustdoc: Don't crash on `crate` references in blocks

This is a regression from #94857.
2023-03-11 12:55:45 +01:00
Matthias Krüger
8b67955104
Rollup merge of #108950 - cjgillot:inherit-less, r=compiler-errors
Directly construct Inherited in typeck.

Using `InheritedBuilder` + a closure does not seem necessary any more.

+ a few opportunistic simplifications to typeck entry point.
2023-03-11 12:55:44 +01:00
Matthias Krüger
d4754edc28
Rollup merge of #108949 - Urgau:check-cfg-target-json, r=oli-obk
Honor current target when checking conditional compilation values

This is fixed by simply using the currently registered target in the current session. We need to use it because of target json that are not by design included in the rustc list of targets.

Fixes https://github.com/rust-lang/rust/issues/108941
2023-03-11 12:55:44 +01:00
Matthias Krüger
5e52ada714
Rollup merge of #108927 - Ayush1325:pal-cleanup, r=workingjubilee
Move __thread_local_inner to sys

Move `__thread_local_inner` macro in `crate:🧵:local` to `crate::sys`. Initially, I was thinking about removing this macro completely, but I could not find a way to create the generic statics without macros, so in the end, I just moved to code around.

This probably will need a rebase once https://github.com/rust-lang/rust/pull/108917 is merged

r? ``@workingjubilee``
2023-03-11 12:55:43 +01:00
Matthias Krüger
25794194fa
Rollup merge of #108784 - clubby789:askama-sidebar, r=jsha,GuillaumeGomez
rustdoc: Migrate sidebar rendering to Askama

cc #108757

Renders the sidebar for documentation using an Askama template
2023-03-11 12:55:43 +01:00
Matthias Krüger
949c553100
Rollup merge of #108757 - clubby789:askama-move, r=notriddle,jsha,GuillaumeGomez
rustdoc: Migrate `document_item_info` to Askama

https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rustdoc.20allocations.20are.20slow

Hoping to piece-by-piece migrate things to template. Had a few failed attempts at more complex parts of the code, so this is just a start.
2023-03-11 12:55:42 +01:00
Matthias Krüger
ef84194744
Rollup merge of #108711 - Nilstrieb:nt-note, r=petrochenkov
Add note when matching token with nonterminal

The current error message is _really_ confusing. The implementation is slightly hacky, but not that much more hacky than all this nonterminal stuff..

r? ``@petrochenkov``
2023-03-11 12:55:42 +01:00
Matthias Krüger
8596751f3b
Rollup merge of #107629 - pitaj:rustdoc-search-deprecated, r=jsha
rustdoc: sort deprecated items lower in search

closes #98759

### Screenshots

`i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX`
![image](https://user-images.githubusercontent.com/803701/216725619-40afb7b0-e984-4a2e-ab5b-a95b24736b0e.png)
If just searching for `min`, the deprecated results show up far below other things:
![image](https://user-images.githubusercontent.com/803701/216725672-e4325d37-9bfe-47eb-a1fe-0e57092aa811.png)
one page later
![image](https://user-images.githubusercontent.com/803701/216725932-cd1c4a42-d527-44fb-a4ab-5a6d243659cc.png)

~~And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like `mem::uninitialized`:
![image](https://user-images.githubusercontent.com/803701/216726268-1657e77a-563f-45a0-85a7-3a0cf4d66d6f.png)~~

Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
2023-03-11 12:55:41 +01:00
Matthias Krüger
790d9f349b
Rollup merge of #106276 - Sp00ph:unify_slice_ranges, r=the8472
Fix `vec_deque::Drain` FIXME

In my original `VecDeque` rewrite, I didn't use `VecDeque::slice_ranges` in `Drain::as_slices`, even though that's basically the exact use case for `slice_ranges`. The reason for this was that a `VecDeque` wrapped in a `Drain` actually has its length set to `drain_start`, so that there's no potential use after free if you `mem::forget` the `Drain`. I modified `slice_ranges` to accept an explicit `len` parameter instead, which it now uses to bounds check the given range. This way, `Drain::as_slices` can use `slice_ranges` internally instead of having to basically just copy paste the `slice_ranges` code. Since `slice_ranges` is just an internal helper function, this shouldn't change the user facing behavior in any way.
2023-03-11 12:55:41 +01:00
bors
e350fe4e60 Auto merge of #109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #105798 (Relax ordering rules for `asm!` operands)
 - #105962 (Stabilize path_as_mut_os_str)
 - #106085 (use problem matchers for tidy CI)
 - #107711 (Stabilize movbe target feature)
 - #108017 (Add `--no-undefined-version` link flag and fix associated breakage)
 - #108891 (Remove an extraneous include)
 - #108902 (no more do while :<)
 - #108912 (Document tool lints)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-11 07:28:44 +00:00
bors
19c53768af Auto merge of #108998 - matthiaskrgr:rollup-sxbdulg, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #106921 (Add documentation about the memory layout of `Cell`)
 - #108828 (Emit alias-eq when equating numeric var and projection)
 - #108834 (Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type)
 - #108900 (fix(lexer): print whitespace warning for \x0c)
 - #108930 (feat: implement better error for manual impl of `Fn*` traits)
 - #108937 (improve readability of winnowing)
 - #108947 (Don't even try to combine consts with incompatible types)
 - #108976 (Update triagebot rust-analyzer team mention)
 - #108983 (Forbid `#[target_feature]` on safe default implementations)

Failed merges:

 - #108950 (Directly construct Inherited in typeck.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-11 04:17:59 +00:00
bors
6dfaa14366 Auto merge of #104527 - ferrocene:pa-more-licenses, r=pnkfelix
Add more license annotations

This PR updates the `.reuse/dep5` file to include more accurate licensing data for everything in the repository (*excluding* submodules and dependencies). Some decisions were made in this PR:

* The standard copyright attribution for files maintained by us is "The Rust Project Developers (see https://thanks.rust-lang.org)", to avoid having to maintain an in-tree `AUTHORS` file.
* For files that have specific licensing terms, we added the terms to the `.reuse/dep5` rather than adding SPDX comments in the files themselves.
* REUSE picks up any comment/text line with `Copyright` on it, so I had to sprinkle around `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` comments.

The rendered `COPYRIGHT` file is available at https://gist.github.com/pietroalbini/efb81103f69596d39758114f3f6a8688.

r? `@pnkfelix`
2023-03-11 01:17:23 +00:00
Michael Goulet
d21e4d8411 Actually cache goals 2023-03-10 23:49:42 +00:00
Michael Goulet
67698aa6ad Move some solver stuff to middle 2023-03-10 23:46:38 +00:00
clubby789
2f166d1a15 Render doc sidebar using Askama 2023-03-10 20:21:45 +00:00
clubby789
bb37b600b3 Migrate document_item_info to templates 2023-03-10 20:18:38 +00:00
Matthias Krüger
030ea0578f
Rollup merge of #108912 - clubby789:doc-tool-lints, r=Nilstrieb
Document tool lints

Add brief doc comments for the internal tool lints so a summary can be seen without needing to open source code
2023-03-10 21:15:46 +01:00
Matthias Krüger
5e449b32b5
Rollup merge of #108902 - lcnr:do-while-sus, r=davidtwco,Nilstrieb
no more do while :<
2023-03-10 21:15:46 +01:00
Matthias Krüger
4b784e49a2
Rollup merge of #108891 - kazutakahirata:master, r=cuviper
Remove an extraneous include

SymbolWrapper.cpp doesn't use std::optional or llvm::Optional, so this patch removes the extraneous include.  Note that llvm/ADT/Optional.h has been deprecated upstream.  This patch ensures that SymbolWrapper.cpp continues to compile even after the upcoming removal of Optional.h.
2023-03-10 21:15:45 +01:00
Matthias Krüger
342ca46517
Rollup merge of #108017 - chbaker0:fix-105967, r=chbaker0
Add `--no-undefined-version` link flag and fix associated breakage

LLVM upstream sets `--no-undefined-version` by default in lld: https://reviews.llvm.org/D135402.

Due to a bug in how version scripts are generated, this breaks the `dylib` output type for most crates. See https://github.com/rust-lang/rust/issues/105967#issuecomment-1428671533 for details.

This PR adds the flag to gcc flavor linkers in anticipation of this LLVM change rolling in, and patches `rustc` to not attempt to export `__rust_*` allocator symbols when they weren't generated.

Fixes #105967
2023-03-10 21:15:45 +01:00
Matthias Krüger
93316d7f28
Rollup merge of #107711 - calebzulawski:movbe, r=pnkfelix
Stabilize movbe target feature

Almost all "old" x86 target features are stable.  As far as I can tell, these are the last two unstable features in the `x86-64-v2` or `x86-64-v3` microarchitecture levels, so I'm not sure if it was an oversight or if they're still unstable for a reason (see #106323 for `f16c`).

Note that this only stabilizes the target features, and not the intrinsics.

cc ```@Amanieu```

r? ```@rust-lang/lang```
2023-03-10 21:15:44 +01:00
Matthias Krüger
b5de0089e1
Rollup merge of #106085 - fee1-dead-contrib:tidy-ci-matchers, r=pietroalbini
use problem matchers for tidy CI
2023-03-10 21:15:44 +01:00
Matthias Krüger
a69a9b3038
Rollup merge of #105962 - zertosh:stabilize_path_as_mut_os_str, r=dtolnay
Stabilize path_as_mut_os_str

Closes #105021

r? ```@dtolnay```
2023-03-10 21:15:43 +01:00
Matthias Krüger
cb0fb246d5
Rollup merge of #105798 - Amanieu:relax-asm, r=joshtriplett
Relax ordering rules for `asm!` operands

The `asm!` and `global_asm!` macros require their operands to appear strictly in the following order:
- Template strings
- Positional operands
- Named operands
- Explicit register operands
- `clobber_abi`
- `options`

This is overly strict and can be inconvienent when building complex `asm!` statements with macros. This PR relaxes the ordering requirements as follows:
- Template strings must still come before all other operands.
- Positional operands must still come before named and explicit register operands.
- Named and explicit register operands can be freely mixed.
- `options` and `clobber_abi` can appear in any position after the template strings.

r? ```````@joshtriplett```````
2023-03-10 21:15:42 +01:00
bors
ff4b772f80 Auto merge of #108974 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

cc `@m-ou-se` This sync also includes https://github.com/rust-lang/rust-clippy/pull/10275
2023-03-10 20:08:26 +00:00
Camille GILLOT
391ef47d8a Simplify typeck entry. 2023-03-10 19:22:58 +00:00
Camille GILLOT
83da9a89d8 Directly construct Inherited. 2023-03-10 19:22:55 +00:00
Peter Jaszkowiak
d2e4b59e60 rustdoc: sort deprecated items lower in search
serialize `q` (`itemPaths`) sparsely
overall 4% reduction in search index size
2023-03-10 12:20:38 -07:00
Matthias Krüger
f74bb35dad
Rollup merge of #108983 - LeSeulArtichaut:108646-target-feature-default-impl, r=cjgillot
Forbid `#[target_feature]` on safe default implementations

Fixes #108646.
2023-03-10 19:59:21 +01:00
Matthias Krüger
42ca383278
Rollup merge of #108976 - Veykril:patch-2, r=jyn514
Update triagebot rust-analyzer team mention

The working group got renamed
2023-03-10 19:59:21 +01:00
Matthias Krüger
145e6204bc
Rollup merge of #108947 - compiler-errors:ct-infer-no-shapeshifting, r=BoxyUwU
Don't even try to combine consts with incompatible types

~I left a more detailed explanation for why this fixes this issue in the UI test, but in general, we should not try to unify const infer vars and rigid consts if they have incompatible types. That's because we don't want something like a `ConstArgHasType` predicate to suddenly go from passing to failing, or vice versa, due to a shallow resolve.~

1. Use the `type_of` for a parameter in `try_eval_lit_or_param`, instead of the "expected" type from a `WithOptConstParam` def id.
2. Don't combine consts that have incompatible types.

Fixes #108781
2023-03-10 19:59:20 +01:00
Matthias Krüger
772b1ce745
Rollup merge of #108937 - lcnr:winnowing-enum, r=WaffleLapkin
improve readability of winnowing
2023-03-10 19:59:20 +01:00
Matthias Krüger
76994625f8
Rollup merge of #108930 - Ezrashaw:better-error-for-manual-fn-impl, r=petrochenkov
feat: implement better error for manual impl of `Fn*` traits

Fixes #39259

cc `@estebank` (you gave me some advice in the linked issue, would you like to review?)
2023-03-10 19:59:19 +01:00
Matthias Krüger
4ad32304c7
Rollup merge of #108900 - bvanjoi:issue-108275, r=petrochenkov
fix(lexer): print whitespace warning for \x0c

- close https://github.com/rust-lang/rust/issues/108275
- discussion: https://github.com/rust-lang/rust/pull/108403
2023-03-10 19:59:19 +01:00
Matthias Krüger
bee84733ad
Rollup merge of #108834 - compiler-errors:fn-ptr-fn-obl, r=spastorino
Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type

We never supported solving `for<'a> fn(&'a ()): Fn(&'a ())` -- I tried to add that support in #104929, but iirc `@lcnr` wanted to support this more generally by eagerly instantiating trait predicate binders with placeholders. That never happened due to blockers in the old solver, but we probably shouldn't ICE in any case.

On the bright side, this passes on the new solver :^)
2023-03-10 19:59:18 +01:00
Matthias Krüger
233ed35e84
Rollup merge of #108828 - compiler-errors:new-solver-alias-eq-on-num-var, r=lcnr
Emit alias-eq when equating numeric var and projection

This doesn't fix everything having to do with projections and infer vars, but it does fix a common case I saw in HIR typeck.

r? `@lcnr`
2023-03-10 19:59:18 +01:00
Matthias Krüger
b90277e37b
Rollup merge of #106921 - madsmtm:cell-memory-layout, r=dtolnay
Add documentation about the memory layout of `Cell`

https://github.com/rust-lang/rust/pull/101717 guaranteed the memory layout of `UnsafeCell<T>`.

This property (a guaranteed memory layout) can be useful to have on `Cell<T>` as well.

(Note that `Cell<u8>` [already doesn't trigger the `improper_ctypes` lint](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=34af59ef60b96d8a8bdaec1d52cb5420) since it is `#[repr(transparent)]`).

The concrete use-case is for the crate [`objc2`](https://github.com/madsmtm/objc2) to specify that `Cell<T>` is safe to use as an instance variable when `T` is.

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

---

I'm unsure if we should specify less, for example say that the `Cell` may have extra restrictions on when it may be accessed, or if that's implicit in the (deliberately minimal) way I've worded it here?
2023-03-10 19:59:17 +01:00
Ayush Singh
5828910ff4
Moved thread_local implementation to sys::common
This allows removing all the platform-dependent code from `library/std/src/thread/local.rs` and `library/std/src/thread/mod.rs`

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-03-10 23:25:32 +05:30