Commit Graph

22347 Commits

Author SHA1 Message Date
Nicholas Nethercote
6a56c3a930 Use ThinVec in ast::Impl and related types. 2023-02-21 11:51:55 +11:00
Nicholas Nethercote
068db466e8 Use ThinVec in ast::WhereClause. 2023-02-21 11:51:55 +11:00
Nicholas Nethercote
dd7aff5cc5 Use ThinVec in ast::Generics and related types. 2023-02-21 11:51:55 +11:00
Nicholas Nethercote
06228d6e93 Upgrade thin-vec from 0.2.9 to 0.2.12.
Because 0.2.10 added supports for `ThinVec::splice`, and 0.2.12 is the
latest release.
2023-02-21 11:51:55 +11:00
Michael Goulet
2895731e5e Name placeholder in some region errors 2023-02-21 00:00:49 +00:00
Boxy
4f2001aab7 remove flag 2023-02-20 23:43:29 +00:00
b-naber
c9843d6144 remove cfg attributes 2023-02-20 22:00:30 +00:00
Matthias Krüger
ea7ca705e6
Rollup merge of #108276 - lcnr:opaque-tys, r=oli-obk
small `opaque_type_origin` cleanup

r? `@oli-obk`
2023-02-20 22:12:20 +01:00
Matthias Krüger
02842d4f69
Rollup merge of #108257 - fee1-dead-contrib:fixme-1, r=tmiasko
Remove old FIXME that no longer applies

it looks like Encodable was fallible at some point, but that was changed which means that this FIXME is no longer applicable
2023-02-20 22:12:19 +01:00
Matthias Krüger
7022ae4f8c
Rollup merge of #108255 - fee1-dead-contrib:fix-old-fixme, r=cjgillot
Remove old FIXMEs referring to #19596

Having an inner function that accepts a mutable reference seems to be the only way this can be expressed. Taking a mutable reference would call the same function with a new type &mut F which then causes the infinite recursion error in #19596.
2023-02-20 22:12:18 +01:00
Matthias Krüger
194d52cc18
Rollup merge of #108254 - Nathan-Fenner:nathanf/error-span-ref-trait-refine, r=WaffleLapkin
Refine error span for trait error into borrowed expression

Extends the error span refinement in #106477 to drill into borrowed expressions just like tuples/struct/enum literals. For example,

```rs
trait Fancy {}
trait Good {}
impl <'a, T> Fancy for &'a T where T: Good {}
impl <S> Good for Option<S> where S: Iterator {}

fn want_fancy<F>(f: F) where F: Fancy {}

fn example() {
    want_fancy(&Some(5));
//  (BEFORE)   ^^^^^^^^ `{integer}` is not an iterator
//  (AFTER)          ^  `{integer}` is not an iterator
}
```

Existing heuristics try to find the right part of the expression to "point at"; current heuristics look at e.g. struct constructors and tuples. This PR adds a new check for borrowed expressions when looking into a borrowed type.
2023-02-20 22:12:18 +01:00
Camille GILLOT
f02d6c45e1 Remove use_ecx. 2023-02-20 18:25:37 +00:00
Camille GILLOT
d0934f14c7 Merge if-let and match. 2023-02-20 18:25:37 +00:00
Camille GILLOT
4a75995fbd Move state fixup into a different method. 2023-02-20 18:25:37 +00:00
lcnr
f97a8f017d small opaque_type_origin cleanup 2023-02-20 18:00:57 +01:00
bors
8973049549 Auto merge of #108268 - matthiaskrgr:rollup-4tdvnx6, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #108124 (Document that CStr::as_ptr returns a type alias)
 - #108171 (Improve building compiler artifacts output)
 - #108200 (Use restricted Damerau-Levenshtein distance for diagnostics)
 - #108259 (remove FIXME that doesn't require fixing)
 - #108265 ("`const` generic" -> "const parameter")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-20 16:19:06 +00:00
Oli Scherer
0847b79ada Remove ResolverTree 2023-02-20 15:28:59 +00:00
Oli Scherer
2a47113efa Remove IntoDefIdTree 2023-02-20 15:28:59 +00:00
Oli Scherer
1ab14ea7c2 Remove some unnecessary tcx-passing 2023-02-20 15:28:59 +00:00
Oli Scherer
acbcfaaf7b Stop passing in values that one can also get from the tcx lazily 2023-02-20 15:28:59 +00:00
Oli Scherer
c3522d0637 Move the resolver into a query 2023-02-20 15:28:59 +00:00
Oli Scherer
37e2f4f487 Make configure_and_expand "infalllible" by just aborting the compilation if it fails instead of bubbling out an error 2023-02-20 15:28:59 +00:00
Oli Scherer
63c8d00090 Use tcx queries instead of passing the values to configure_and_expand. 2023-02-20 15:28:59 +00:00
Oli Scherer
1202fce40e Remove definitions field that is only needed for one method 2023-02-20 15:28:59 +00:00
Oli Scherer
4953d70e2f Stuff a TyCtxt into the Resolver 2023-02-20 15:28:59 +00:00
Oli Scherer
9fb91b8742 Remove a redundant function argument 2023-02-20 15:28:58 +00:00
Oli Scherer
8f132d8549 Run the resolver after TyCtxt construction 2023-02-20 15:28:58 +00:00
Oli Scherer
6924e3c374 Make untracked.source_span lockable so that resolution can still write to it when using TyCtxt 2023-02-20 15:28:58 +00:00
Oli Scherer
ade3dceb38 Make untracked.cstore lockable so that resolution can still write to it when using TyCtxt 2023-02-20 15:28:58 +00:00
Oli Scherer
054c76d658 Revert most of the custom place computation, it was unnecessary. 2023-02-20 14:56:44 +00:00
Oli Scherer
82f1e341a3 Remove commented out code 2023-02-20 14:11:38 +00:00
Oli Scherer
472059d854 Deduplicate some logic between dyn* and dyn 2023-02-20 14:11:38 +00:00
Ralf Jung
b2f58146b9 basic dyn* support for Miri 2023-02-20 15:08:05 +01:00
Matthias Krüger
e4dadd6416
Rollup merge of #108265 - lcnr:cg-error-msg, r=BoxyUwU
"`const` generic" -> "const parameter"
2023-02-20 14:32:56 +01:00
Matthias Krüger
133afeb6e3
Rollup merge of #108259 - fee1-dead-contrib:fixme-2, r=TaKO8Ki
remove FIXME that doesn't require fixing
2023-02-20 14:32:55 +01:00
Matthias Krüger
226ce31edd
Rollup merge of #108200 - jhpratt:restricted-damerau-levenshtein-distance, r=tmiasko
Use restricted Damerau-Levenshtein distance for diagnostics

This replaces the existing Levenshtein algorithm with the Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change (a transposition) instead of two (a deletion and insertion). More specifically, this is a _restricted_ implementation, in that "ca" to "abc" cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the middle of a transposition. I believe that errors like that are sufficiently rare that it's not worth taking into account.

This was first brought up [on IRLO](https://internals.rust-lang.org/t/18227) when it was noticed that the diagnostic for `prinltn!` (transposed L and T) was `print!` and not `println!`. Only a single existing UI test was effected, with the result being an objective improvement.

~~I have left the method name and various other references to the Levenshtein algorithm untouched, as the exact manner in which the edit distance is calculated should not be relevant to the caller.~~

r? ``@estebank``

``@rustbot`` label +A-diagnostics +C-enhancement
2023-02-20 14:32:55 +01:00
bors
267cd1d2c5 Auto merge of #107721 - megakorre:issue_105700, r=petrochenkov
create dummy placeholder crate to prevent compiler from panicing

This PR is to address the panic found in https://github.com/rust-lang/rust/issues/105700.

There are 2 separate things going on with this panic.
First the code could not generate a dummy response for crate fragment types when it hits the recursion limit.
This PR adds the method to the trait implementation for `DymmyResult` to be able to create a dummy crate node.
This stops the panic from happening.

The second thing that is not addressed (and maybe does not need addressing? 🤷🏻)
is that when you have multiple attributes it ends up treating attributes that follow another as being the result of expanding the former (maybe there is a better way to say that). So you end up hitting the recursion limit. Even though you would think there is no expansion happening here.

If you did not hit the recursion limit the compiler would output that `invalid_attribute` does not exists. But it currently exits before the resolution step when the recursion limit is reached here.
2023-02-20 13:23:47 +00:00
lcnr
2cbe583593 const generic -> const parameter in err msg 2023-02-20 12:58:11 +01:00
Oli Scherer
e8e227aec8 Prepare crate loader for LockGuard 2023-02-20 10:49:42 +00:00
Oli Scherer
d191de63f0 Prepare for adding a TyCtxt to Resolver 2023-02-20 10:38:48 +00:00
bors
e7eaed21d5 Auto merge of #107969 - b-naber:proj-relate-variance, r=lcnr
Use covariance on type relations of field projection types if possible

It's fine to use covariance here unless we're in a mutating context.

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

Supersedes https://github.com/rust-lang/rust/pull/105958

r? `@lcnr`
2023-02-20 09:25:51 +00:00
Patrik Kårlin
0fd2a70b90
create dummy placeholder crate to prevent compiler 2023-02-20 10:20:57 +01:00
Deadbeef
be599f3cbe remove FIXME that doesn't require fixing 2023-02-20 06:31:26 +00:00
Deadbeef
255eb217e9 Remove old FIXME that no longer applies
it looks like Encodable was fallible at some point, but that was changed
which means that this FIXME is no longer applicable
2023-02-20 06:26:28 +00:00
Deadbeef
6b36c3078a Remove old FIXMEs referring to #19596 2023-02-20 06:12:56 +00:00
Nathan Fenner
fbcca2aaf0 Refine error span for trait error into borrowed expression 2023-02-19 21:27:04 -08:00
Ben Kimock
0e05280d75 Add an InstCombine for redundant casts 2023-02-19 23:14:58 -05:00
bors
7b552967b8 Auto merge of #105961 - fmease:iat-type-directed-probing, r=jackh726
Type-directed probing for inherent associated types

When probing for inherent associated types (IATs), equate the Self-type found in the projection with the Self-type of the relevant inherent impl blocks and check if all predicates are satisfied.
Previously, we didn't look at the Self-type or at the bounds and just picked the first inherent impl block containing an associated type with the name we were searching for which is obviously incorrect.

Regarding the implementation, I basically copied what we do during method probing (`assemble_inherent_impl_probe`, `consider_probe`). Unfortunately, I had to duplicate a lot of the diagnostic code found in `rustc_hir_typeck::method::suggest` which we don't have access to in `rustc_hir_analysis`. Not sure if there is a simple way to unify the error handling. Note that in the future, `rustc_hir_analysis::astconv` might not actually be the place where we resolve inherent associated types (see https://github.com/rust-lang/rust/pull/103621#issuecomment-1304309565) but `rustc_hir_typeck` (?) in which case the duplication may naturally just disappear. While inherent associated *constants* are currently resolved during "method" probing, I did not find a straightforward way to incorporate IAT lookup into it as types and values (functions & constants) are two separate entities for which distinct code paths are taken.

Fixes #104251 (incl. https://github.com/rust-lang/rust/issues/104251#issuecomment-1338501171).
Fixes #105305.
Fixes #107468.

`@rustbot` label T-types F-inherent_associated_types
r? types
2023-02-20 00:37:20 +00:00
Jacob Pratt
ab4c0dd137
Add test for precise algorithm used 2023-02-19 22:59:22 +00:00
b-naber
0725d0ceee add some cfgs back 2023-02-19 22:24:18 +00:00
b-naber
aefc5ec110 remove cfgs 2023-02-19 22:16:22 +00:00
b-naber
2d2bccf751 rebase 2023-02-19 22:13:07 +00:00
b-naber
46bd77aa80 some conditional imports 2023-02-19 22:12:12 +00:00
b-naber
e2bf960fe1 sccs info 2023-02-19 22:12:12 +00:00
b-naber
960ebaf899 collect existentials and placeholders 2023-02-19 22:12:09 +00:00
b-naber
2f79f73821 collect region contexts during mir renumbering 2023-02-19 22:11:27 +00:00
b-naber
cb35a7b481 add BorrowckInferCtxt 2023-02-19 22:07:17 +00:00
León Orell Valerian Liehr
f2253dad24
Add some FIXMEs for follow-up PRs 2023-02-19 22:54:47 +01:00
León Orell Valerian Liehr
00b976a138
Collect fulfillment errors across impls 2023-02-19 22:54:08 +01:00
bors
21e5b941e0 Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726
Properly check for builtin derived code

Fixes #108122
2023-02-19 21:18:07 +00:00
bors
7aa413d592 Auto merge of #107921 - cjgillot:codegen-overflow-check, r=tmiasko
Make codegen choose whether to emit overflow checks

ConstProp and DataflowConstProp currently have a specific code path not to propagate constants when they overflow. This is meant to have the correct behaviour when inlining from a crate with overflow checks (like `core`) into a crate compiled without.

This PR shifts the behaviour change to the `Assert(Overflow*)` MIR terminators: if the crate is compiled without overflow checks, just skip emitting the assertions. This is already what happens with `OverflowNeg`.

This allows ConstProp and DataflowConstProp to transform `CheckedBinaryOp(Add, u8::MAX, 1)` into `const (0, true)`, and let codegen ignore the `true`.

 The interpreter is modified to conform to this behaviour.

Fixes #35310
2023-02-19 18:17:26 +00:00
León Orell Valerian Liehr
569ca2bad0
Deduplicate fresh_item_substs 2023-02-19 18:36:35 +01:00
León Orell Valerian Liehr
77ea90ec71
Fix substitution bug 2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
6065867a7e
Use InferCtxt::probe to properly detect ambiguous candidates 2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
3dc38fbc91
Switch from for-loop to filter_map 2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
b5e73bfe90
Groundwork for detecting ambiguous candidates
NB: Since we are using the same InferCtxt in each iteration,
we essentially *spoil* the inference variables and we only
ever get at most *one* applicable candidate (only the 1st candidate
has clean variables that can still unify correctly).
2023-02-19 18:35:35 +01:00
León Orell Valerian Liehr
cc65ebd0d2
Make use of ObligationCtxt 2023-02-19 18:35:34 +01:00
León Orell Valerian Liehr
aa7edf7073
Use the correct ParamEnv 2023-02-19 18:35:34 +01:00
León Orell Valerian Liehr
488d0c9efd
Type-directed probing for inherent associated types 2023-02-19 18:35:28 +01:00
Santiago Pastorino
5e763b6624
Document associated_item methods 2023-02-19 11:58:48 -03:00
Santiago Pastorino
45b0d9da6b
Make associated_items_for_impl_trait_in_trait handle impl traits on impls 2023-02-19 11:57:38 -03:00
Santiago Pastorino
b7dd609d9c
Add associated_item_for_impl_trait_in_trait query 2023-02-19 11:49:02 -03:00
Santiago Pastorino
4e703a2772
Add associated_items_for_impl_trait_in_trait query 2023-02-19 11:18:56 -03:00
Guillaume Gomez
d2aef58eb5
Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726
Fix RPITITs in default trait methods (by assuming projection predicates in param-env)

Instead of having special projection logic that allows us to turn `ProjectionTy(RPITIT, [Self#0, ...])` into `OpaqueTy(RPITIT, [Self#0, ...])`, we can instead augment the param-env of default trait method bodies to assume these as projection predicates. This should allow us to only project where we're allowed to!

In order to make this work without introducing a bunch of cycle errors, we additionally tweak the `OpaqueTypeExpander` used by `ParamEnv::with_reveal_all_normalized` to not normalize the right-hand side of projection predicates. This should be fine, because if we use the projection predicate to normalize some other projection type, we'll continue to normalize the opaque that it gets projected to.

This also makes it possible to support default trait methods with RPITITs in an associated-type based RPITIT lowering strategy without too much extra effort.

Fixes #107002
Alternative to #108142
2023-02-19 14:47:56 +01:00
Guillaume Gomez
bd63edc07a
Rollup merge of #108129 - GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov
Correctly handle links starting with whitespace

Part of https://github.com/rust-lang/rust/issues/107995.

I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^'

r? `@petrochenkov`
2023-02-19 14:47:55 +01:00
bors
eebdfb55fc Auto merge of #108228 - Dylan-DPC:rollup-i9t13qu, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #104659 (reflow the stack size story)
 - #106933 (Update documentation of select_nth_unstable and select_nth_unstable_by to state O(n^2) complexity)
 - #107783 (rustdoc: simplify DOM for `.item-table`)
 - #107951 (resolve: Fix doc links referring to other crates when documenting proc macro crates directly)
 - #108130 ("Basic usage" is redundant for there is just one example)
 - #108146 (rustdoc: hide `reference` methods in search index)
 - #108189 (Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-19 08:15:40 +00:00
Dylan DPC
c5d5c57666
Rollup merge of #108189 - compiler-errors:non_lifetime_binders-bound-stuff, r=jackh726
Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds

1. When assembling candidates for `for<T> T: Sized`, we can't ICE because the self-type is a bound type.
2. Fix an issue where, when canonicalizing in non-universe preserving mode, we don't actually set the universe for placeholders to the root even though we do the same for region vars.
3. Make `Placeholder("T")` format like `T` in error messages.

Fixes #108180
Fixes #108182

r? types
2023-02-19 13:03:42 +05:30
Dylan DPC
4a0f088f7c
Rollup merge of #107951 - petrochenkov:procmacdoc, r=jackh726
resolve: Fix doc links referring to other crates when documenting proc macro crates directly

Fixes https://github.com/rust-lang/rust/issues/107950
2023-02-19 13:03:41 +05:30
bors
73f40197ec Auto merge of #107772 - compiler-errors:dyn-star-backend-is-ptr, r=eholk
Make `dyn*`'s value backend type a pointer

One tweak on top of Ralf's commit should fix using `usize` as a `dyn*`-coercible type, and should fix when we're using various other pointer types when LLVM opaque pointers is disabled.

r? `@eholk` but feel free to reassign
cc https://github.com/rust-lang/rust/pull/107728#issuecomment-1421231823 `@RalfJung`
2023-02-19 05:35:03 +00:00
Jacob Pratt
20282c1b20
Reduce limit on macro_rules! diagnostic 2023-02-19 04:17:58 +00:00
Jacob Pratt
378c4ab9ab
Make public API, docs algorithm-agnostic 2023-02-19 04:11:10 +00:00
Jacob Pratt
ff052eec80
Use restricted Damerau-Levenshtein algorithm 2023-02-19 03:46:03 +00:00
bors
fcdbd1c07f Auto merge of #107867 - compiler-errors:new-solver-fn-trait-safety, r=lcnr
Check that built-in callable types validate their output type is `Sized` (in new solver)

Working on parity with old solver. Putting this up for consideration, it's not *really* needed or anything just yet. Maybe it's better to approach this from another direction (like always checking the item bounds when calling `consider_assumption`? we may need that for coinduction to be sound though?)

This basically implements #100096 for the new solver.
2023-02-19 02:42:10 +00:00
bors
f77f4d55bd Auto merge of #107542 - compiler-errors:param-envs-with-inference-vars-are-cursed, r=jackh726
Don't call `with_reveal_all_normalized` in const-eval when `param_env` has inference vars in it

**what:** This slightly shifts the order of operations from an existing hack:

5b6ed253c4/compiler/rustc_middle/src/ty/consts/kind.rs (L225-L230)

in order to avoid calling a tcx query (`TyCtxt::reveal_opaque_types_in_bounds`, via `ParamEnv::with_reveal_all_normalized`) when a param-env has inference variables in it.

**why:** This allows us to enable fingerprinting of query keys/values outside of incr-comp in deubg mode, to make sure we catch other places where we're passing infer vars and other bad things into query keys. Currently that (bbf33836b9) crashes because we introduce inference vars into a param-env in the blanket-impl finder in rustdoc 😓

5b6ed253c4/src/librustdoc/clean/blanket_impl.rs (L43)

See the CI failure here: https://github.com/rust-lang/rust/actions/runs/4058194838/jobs/6984834619
2023-02-18 23:43:42 +00:00
Guillaume Gomez
fd62036caa Correctly handle if a link starts with a whitespace 2023-02-18 23:24:58 +01:00
Camille GILLOT
9f6c1df872 Stop implementing _with_overflow intrinsics in codegen backends. 2023-02-18 22:06:29 +00:00
Camille GILLOT
7e795bdf03 Replace _with_overflow instrinsics in LowerIntrinsics. 2023-02-18 21:45:10 +00:00
Camille GILLOT
f79db59953 Adapt cg_clif. 2023-02-18 21:35:02 +00:00
Camille GILLOT
c1a0f8205c Rename checked_binop_checks_overflow. 2023-02-18 21:35:02 +00:00
Camille GILLOT
a5769193d1 Remove special case in rvalue codegen. 2023-02-18 21:35:02 +00:00
Camille GILLOT
e9c73ea502 Make name more explicit. 2023-02-18 21:35:02 +00:00
Camille GILLOT
4f13aa7f46 Comment codegen optimization. 2023-02-18 21:35:02 +00:00
Camille Gillot
328696ca17 Update compiler/rustc_middle/src/mir/syntax.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-02-18 21:35:02 +00:00
Camille GILLOT
fb1f7f747a Remove exception from MIR doc. 2023-02-18 21:35:02 +00:00
Camille GILLOT
085eaa7ee3 Adapt interpreter. 2023-02-18 21:35:02 +00:00
Camille GILLOT
7f36a3fcd7 Fix CTFE interpreter. 2023-02-18 21:35:02 +00:00
Camille GILLOT
4c93145b33 Remove outdated comment. 2023-02-18 21:35:02 +00:00
Camille GILLOT
7567f1f31d Adapt interpreter. 2023-02-18 21:35:02 +00:00
Camille GILLOT
1480b1c524 Correct comment. 2023-02-18 21:35:02 +00:00
Camille GILLOT
d0cc00f758 Add comment. 2023-02-18 21:35:02 +00:00
Camille GILLOT
e34caaf42d Remove overflow checks from ConstProp. 2023-02-18 21:35:02 +00:00
Camille GILLOT
4bd2ebc58b Do not codegen overflow check when not required. 2023-02-18 21:35:02 +00:00
Michael Goulet
d42a3fbd69 Assume we can normalize trait default method RPITITs in param-env instead 2023-02-18 20:36:39 +00:00
Michael Goulet
c13d5f1aeb Make sure test_type_match doesn't ICE with late-bound types 2023-02-18 20:16:51 +00:00
Michael Goulet
6f3706ea71 Pretty placeholders using their names 2023-02-18 19:49:40 +00:00
Michael Goulet
ec40b1a393 Collapse placeholders to root universe in canonicalizer if not preserving universes 2023-02-18 19:49:40 +00:00
Michael Goulet
f4a4a31479 Don't ICE on bound types in sized conditions 2023-02-18 19:49:40 +00:00
Michael Goulet
7f798c2b21 Emit the right types for vtable pointers when dropping dyn* 2023-02-18 19:47:34 +00:00
Michael Goulet
e82cc656c8 Make dyn* have the same scalar pair ABI as corresponding fat pointer 2023-02-18 19:47:34 +00:00
Michael Goulet
df52e2037a Use inttoptr to support usize as dyn* value, use pointercast to make sure pointers are compatible 2023-02-18 19:47:33 +00:00
Michael Goulet
6402c98621 Add consider_implied_clause 2023-02-18 19:45:02 +00:00
Michael Goulet
82b52056fe Check that built-in callable types validate their output type is Sized (in new solver) 2023-02-18 19:32:58 +00:00
Michael Goulet
be55ad53a1 Remove default trait RPITIT candidates 2023-02-18 19:25:07 +00:00
Ralf Jung
88e39ee314 make first component of dyn* use pointer layout+type, and adjust DynStar comment 2023-02-18 19:24:55 +00:00
y21
0610df9314 lint: don't suggest assume_init for uninhabited types 2023-02-18 19:05:44 +01:00
bors
53709aedba Auto merge of #108209 - petrochenkov:doclean, r=notriddle
rustdoc: Cleanup doc link extraction
2023-02-18 16:41:55 +00:00
Matthias Krüger
6c91efd6d7
Rollup merge of #108205 - tshepang:why-special-case, r=cjgillot
link to llvm changes that prompted the special cases
2023-02-18 13:26:48 +01:00
Matthias Krüger
d3d5163921
Rollup merge of #108186 - compiler-errors:closures-with-late-bound-types-r-bad, r=cjgillot
Deny non-lifetime bound vars in `for<..> ||` closure binders

Moves the check for illegal bound var types from astconv to resolve_bound_vars. If a binder is defined to have a type or const late-bound var that's not allowed, we'll resolve any usages to ty error or const error values, so we shouldn't ever see late-bound types or consts in places they aren't expected.

Fixes #108184
Fixes #108181
Fixes #108192
2023-02-18 13:26:47 +01:00
Matthias Krüger
7f9d9de82d
Rollup merge of #108162 - clubby789:issue-108155, r=Nilstrieb
Don't eagerly convert principal to string

Fixes #108155

~~I haven't yet been able to reproduce the ICE in a minimal example unfortunately.~~ Added a test
2023-02-18 13:26:47 +01:00
Matthias Krüger
d9c9040290
Rollup merge of #108046 - oli-obk:no_evaluating_fed_queries, r=cjgillot
Don't allow evaluating queries that were fed in a previous compiler run

r? `@cjgillot`

this code was already unreachable. Also we removed the no_hash + feeding restriction in https://github.com/rust-lang/rust/pull/105220.
2023-02-18 13:26:46 +01:00
Matthias Krüger
3035ccbcb9
Rollup merge of #108031 - jieyouxu:issue-108019, r=estebank
Don't recover lifetimes/labels containing emojis as character literals

Fixes #108019.

Note that at the time of this commit, `unic-emoji-char` seems to have data tables only up to Unicode 5.0, but Unicode is already newer than this.

A newer emoji such as `🥺` will not be recognized as an emoji but older emojis such as `🐱` will.

This PR leaves a couple of FIXMEs where `unic_emoji_char::is_emoji` is used.
2023-02-18 13:26:46 +01:00
Vadim Petrochenkov
97e73eea84 doc links: Filter away autolinks in both rustc and rustdoc 2023-02-18 15:15:57 +04:00
Vadim Petrochenkov
ccdb598d1b rustdoc: Cleanup broken link callbacks 2023-02-18 14:45:01 +04:00
Camille GILLOT
efb468866e Use the correct place for enum variants. 2023-02-18 10:11:53 +00:00
Camille GILLOT
7213eaa1c0 Flood aggregate assignments with Top. 2023-02-18 09:57:13 +00:00
Tshepang Mbambo
8ab795ef08 add a summary, in addition to the link 2023-02-18 11:09:40 +02:00
Tshepang Mbambo
225e01ee79 link to llvm changes that prompted the special cases 2023-02-18 09:59:41 +02:00
bors
6d819a4b8f Auto merge of #106476 - keith:ks/add-sanitizer-support-for-modern-ios-platforms, r=badboy
Add sanitizer support for modern iOS platforms

asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-18 05:58:41 +00:00
Michael Goulet
cec7835d7a Move late-bound arg type checks to resolve_bound_vars 2023-02-18 03:28:54 +00:00
bors
fabfd1fd93 Auto merge of #99679 - repnop:kernel-address-sanitizer, r=cuviper
Add `kernel-address` sanitizer support for freestanding targets

This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of `x86_64-unknown-none`, `riscv64{imac, gc}-unknown-none-elf`, and `aarch64-unknown-none` but there's likely other targets it can be added to. (`linux_kernel_base.rs`?) KASan uses the address sanitizer attributes but has the `CompileKernel` parameter set to `true` in the pass creation.
2023-02-18 03:05:11 +00:00
Michael Goulet
fded2e95ab Adjust tracking issue for non_lifetime_binders 2023-02-18 02:42:43 +00:00
bors
a9842c73bc Auto merge of #108112 - nnethercote:clarify-iterator-interners, r=oli-obk,compiler-errors
Clarify iterator interners

I found the iterator interners very confusing. This PR clarifies things.

r? `@compiler-errors`
2023-02-18 00:20:52 +00:00
bors
231bcd131d Auto merge of #105274 - saethlin:instcombine-mut-ref, r=cjgillot
Enable instcombine for mutable reborrows

`instcombine` used to contain this comment, which is no longer accurate because there it is fine to copy `&mut _` in MIR:
```rust
// The dereferenced place must have type `&_`, so that we don't copy `&mut _`.
```
So let's try replacing that check with something much more permissive...
2023-02-17 20:50:11 +00:00
Santiago Pastorino
833b9154ac
Make encode_attrs use opt_local_def_id_to_hir_id so we can feed it with None for definitions that have no HIR 2023-02-17 15:56:11 -03:00
Michael Goulet
90cf0cc6c2 Don't delay ReError bug during lexical region resolve 2023-02-17 18:26:22 +00:00
bors
9aa5c24b7d Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstrieb
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref

r? `@ghost`
2023-02-17 17:42:51 +00:00
clubby789
21bcd2ee9c Fix ICE on type alias in recursion 2023-02-17 16:20:38 +00:00
Oli Scherer
b4182d240a Don't allow evaluating queries that were fed in a previous compiler run 2023-02-17 16:16:01 +00:00
clubby789
eebd31c187 Don't eagerly convert principal to string 2023-02-17 14:44:58 +00:00
bors
f722b24eb9 Auto merge of #108159 - matthiaskrgr:rollup-5k2j7cx, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107592 (Default `repr(C)` enums to `c_int` size)
 - #107956 (Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`)
 - #108126 (fix a line, and do a consistency fix)
 - #108144 (Add compiler-errors to a few more triagebot groups)
 - #108149 (typo)
 - #108154 (`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes])

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-17 14:27:28 +00:00
Matthias Krüger
ae5473c969
Rollup merge of #108154 - scottmcm:start-block-cleanup, r=compiler-errors
`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]
2023-02-17 12:39:07 +01:00
Matthias Krüger
392b150011
Rollup merge of #108149 - tshepang:typo, r=Dylan-DPC
typo
2023-02-17 12:39:07 +01:00
Matthias Krüger
e53bd4c282
Rollup merge of #108126 - tshepang:nits, r=lcnr
fix a line, and do a consistency fix
2023-02-17 12:39:06 +01:00
Matthias Krüger
e0aa5613d8
Rollup merge of #107592 - workingjubilee:use-16-bit-enum-on-16-bit-targets, r=WaffleLapkin
Default `repr(C)` enums to `c_int` size

This is what ISO C strongly implies this is correct, and
many processor-specific ABIs imply or mandate this size, so
"everyone" (LLVM, gcc...) defaults to emitting enums this way.
However, this is by no means guaranteed by ISO C,
and the bare-metal Arm targets show it can be overridden,
which rustc supports via `c-enum-min-bits` in a target.json.

The override is a flag named `-fshort-enums` in clang and gcc,
but introducing a CLI flag is probably unnecessary for rustc.
This flag can be used by non-Arm microcontroller targets,
like AVR and MSP430, but it is not enabled for them by default.
Rust programmers who know the size of a target's enums
can use explicit reprs, which also lets them match C23 code.

This change is most relevant to 16-bit targets: AVR and MSP430.
Most of rustc's targets use 32-bit ints, but ILP64 does exist.
Regardless, rustc should now correctly handle enums for
both very small and very large targets.

Thanks to William for confirming MSP430 behavior,
and to Waffle for better style and no-core `size_of` asserts.

Fixes rust-lang/rust#107361
Fixes rust-lang/rust#77806
2023-02-17 12:39:05 +01:00
bors
f4f5fc3e5c Auto merge of #107965 - BoxyUwU:add_const_arg_has_type_predicate, r=compiler-errors
Add `Clause::ConstArgHasType`

Currently the way that we check that a const arg has the correct type for the const param it is an argument for is by setting the expected type of `typeck` on the anon const of the argument to be the const param's type.

In the future for a potential `min_generic_const_exprs` we will allow providing const arguments that do not have an associated anon const that can be typeck'd which will require us to actually check that  the const argument has the correct type. While it would potentially be possible to just call `eq` when creating substs this would not work if we support generics of the form `const N: T, T` (the const parameters type referencing generics declared after itself).

Additionally having `ConstArgHasType` will allow us to potentially make progress on removing the `ty` field of `Const` which may be desirable. Once progress has been made on this, `ConstArgHasType` will also be helpful in ensuring we do not make mistakes in trait/impl checking by declaring functions with the wrong const parameter types as the checks that the param env is compatible would catch it. (We have messed this up in the past, and with generic const parameter types these checks will get more complex)

There is a [document](https://hackmd.io/wuCS6CJBQ9-fWbwaW7nQRw?view) about the types of const generics that may provide some general information on this subject

---

This PR shouldn't have any impact on whether code compiles or not on stable, it primarily exists to make progress on unstable const generics features that are desirable.
2023-02-17 11:27:21 +00:00
Nicholas Nethercote
af32411f20 Avoid double-interning some BoundVariableKinds.
This function has this line twice:
```
let bound_vars = tcx.intern_bound_variable_kinds(&bound_vars);
```
The second occurrence is effectively a no-op, because the first
occurrence interned any that needed it.
2023-02-17 22:24:34 +11:00
Nicholas Nethercote
107f14d2ca Replace more mk_foo calls with infer_foo. 2023-02-17 22:24:34 +11:00
Nicholas Nethercote
2017aeff88 Use IntoIterator for mk_fn_sig.
This makes a lot of call sites nicer.
2023-02-17 22:24:34 +11:00
Nicholas Nethercote
c8237db3ee Clarify iterator interners.
There are two traits, `InternAs` and `InternIteratorElement`. I found
them confusing to use, particularly this:
```
pub fn mk_tup<I: InternAs<Ty<'tcx>, Ty<'tcx>>>(self, iter: I) -> I::Output {
    iter.intern_with(|ts| self.intern_tup(ts))
}
```
where I thought there might have been two levels of interning going on
(there isn't) due to the `intern_with`/`InternAs` + `intern_tup` naming.

And then I found the actual traits and impls themselves *very*
confusing.
- `InternAs` has a single impl, for iterators, with four type variables.
- `InternAs` is only implemented for iterators because it wouldn't
  really make sense to implement for any other type. And you can't
  really understand the trait without seeing that single impl, which is
  suspicious.
- `InternAs` is basically just a wrapper for `InternIteratorElement`
  which does all the actual work.
- Neither trait actually does any interning. They just have `Intern` in
  their name because they are used *by* interning code.
- There are no comments.

So this commit improves things.
- It removes `InternAs` completely. This makes the `mk_*` function
  signatures slightly more verbose -- two trait bounds instead of one --
  but much easier to read, because you only need to understand one trait
  instead of two.
- It renames `InternIteratorElement` as `CollectAndApply`. Likewise, it
  renames its method `intern_with` as `collect_and_apply`. These names
  describe better what's going on: we collect the iterator elements into
  a slice and then apply a function to the slice.
- It adds comments, making clear that all this is all there just to
  provide an optimized version of `f(&iter.collect::<Vec<_>>())`.

It took me a couple of attempts to come up with this commit. My initial
attempt kept `InternAs` around, but renamed things and added comments,
and I wasn't happy with it. I think this version is much better. The
resulting code is shorter, despite the addition of the comments.
2023-02-17 22:24:34 +11:00
Nicholas Nethercote
9d5cf0f0bf Remove the InternIteratorElement impl for &'a T.
`InternIteratorElement` is a trait used to intern values produces by
iterators. There are three impls, corresponding to iterators that
produce different types:
- One for `T`, which operates straightforwardly.
- One for `Result<T, E>`, which is fallible, and will fail early with an
  error result if any of the iterator elements are errors.
- One for `&'a T`, which clones the items as it iterates.

That last one is bad: it's extremely easy to use it without realizing
that it clones, which goes against Rust's normal "explicit is better"
approach to cloning.

So this commit just removes it. In practice, there weren't many use
sites. For all but one of them `into_iter()` could be used, which avoids
the need for cloning. And for the one remaining case `copied()` is
used.
2023-02-17 22:24:34 +11:00
Nicholas Nethercote
28184e7491 Clarify mk_fn_sig signature.
Giving the item type a name `T` avoids duplication.
2023-02-17 22:24:34 +11:00
Nicholas Nethercote
bcf0ec0191 Replace mk_foo calls with infer_foo where possible.
There are several `mk_foo`/`intern_foo` pairs, where the former takes an
iterator and the latter takes a slice. (This naming convention is bad,
but that's a fix for another PR.)

This commit changes several `mk_foo` occurrences into `intern_foo`,
avoiding the need for some `.iter()`/`.into_iter()` calls. Affected
cases:
- mk_type_list
- mk_tup
- mk_substs
- mk_const_list
2023-02-17 22:24:31 +11:00
Boxy
90c8d6bbe4 add predicate evaluation logic 2023-02-17 09:32:39 +00:00
Boxy
e919d7e348 Add Clause::ConstArgHasType variant 2023-02-17 09:30:33 +00:00
bors
b5c8c329a7 Auto merge of #108058 - Zoxc:query-ctxtx-byval, r=cjgillot
Pass `DepContext` and `QueryContext` by value when practical

This removes some indirections for a minor performance improvement.

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.8294s</td><td align="right">1.8255s</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2667s</td><td align="right">0.2669s</td><td align="right"> 0.07%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.0080s</td><td align="right">1.0063s</td><td align="right"> -0.17%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6335s</td><td align="right">1.6295s</td><td align="right"> -0.24%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.3633s</td><td align="right">6.3344s</td><td align="right"> -0.45%</td></tr><tr><td>Total</td><td align="right">11.1009s</td><td align="right">11.0627s</td><td align="right"> -0.34%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9980s</td><td align="right"> -0.20%</td></tr></table>
2023-02-17 08:23:53 +00:00
Scott McMurray
c946494c34 BasicBlock::new(0) -> START_BLOCK [no functional changes] 2023-02-16 21:33:19 -08:00
bors
9556b56dbd Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwU
Switch to `EarlyBinder` for `type_of` query

Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78.

Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`.

r? `@lcnr`
2023-02-17 04:45:15 +00:00
Tshepang Mbambo
ad8947c32b typo 2023-02-17 03:45:48 +02:00
bors
ea218392a4 Auto merge of #108145 - matthiaskrgr:rollup-bgadak1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104068 (rustdoc: Add PartialOrd trait to doc comment explanation)
 - #107489 (Implement partial support for non-lifetime binders)
 - #107905 (Pass arguments to `x` subcommands with `--`)
 - #108009 (Move some tests)
 - #108086 (wasm: Register the `relaxed-simd` target feature)
 - #108104 (don't into self)
 - #108133 (Small cleanups around `EarlyBinder`)
 - #108136 (Do not ICE on unmet trait alias impl bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-17 01:14:39 +00:00
Kyle Matsuda
f6c3469aa2 fix new usage of type_of 2023-02-16 17:05:59 -07:00
Kyle Matsuda
8e92849cbb changes from review 2023-02-16 17:05:59 -07:00
Kyle Matsuda
c183110cc2 remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
Kyle Matsuda
d822b97a27 change usages of type_of to bound_type_of 2023-02-16 17:01:52 -07:00
Matthias Krüger
ecdb7bcee8
Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_impl, r=compiler-errors
Do not ICE on unmet trait alias impl bounds

Fixes #108132

I've also added some documentation to the `impl_def_id` field of `DerivedObligationCause` to try and minimise the risk of such errors in future.

r? `@compiler-errors`
2023-02-17 00:19:37 +01:00
Matthias Krüger
e1e58fc1d3
Rollup merge of #108133 - kylematsuda:earlybinder-cleanups, r=compiler-errors
Small cleanups around `EarlyBinder`

Cleaning up a few things that were brought up by `@lcnr` in reviewing #106696:

- [make `issue33140_self_ty` query return `Option<EarlyBinder<Ty>>`](https://github.com/rust-lang/rust/pull/106696#discussion_r1067821423)
- [small style improvement](https://github.com/rust-lang/rust/pull/106696#discussion_r1067816772)
2023-02-17 00:19:37 +01:00
Matthias Krüger
9b2ee4192e
Rollup merge of #108104 - matthiaskrgr:into, r=compiler-errors
don't into self

don't into()-convert types to themselves
2023-02-17 00:19:36 +01:00
Matthias Krüger
1fac415997
Rollup merge of #108086 - alexcrichton:wasm-relaxed-simd-feature, r=eholk
wasm: Register the `relaxed-simd` target feature

This WebAssembly proposal is likely to reach stage 4 soon so this starts the support in Rust for the proposal by adding a target feature that can be enabled via attributes for the stdarch project to bind the intrinsics.
2023-02-17 00:19:36 +01:00
Matthias Krüger
089e8c03bc
Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillot
Implement partial support for non-lifetime binders

This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed.

Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged.

Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`)

cc rust-lang/types-team#81

r? `@ghost`
2023-02-17 00:19:34 +01:00
Jubilee Young
2edf6c8784 Default repr(C) enums to c_int size
This is what ISO C strongly implies this is correct, and
many processor-specific ABIs imply or mandate this size, so
"everyone" (LLVM, gcc...) defaults to emitting enums this way.
However, this is by no means guaranteed by ISO C,
and the bare-metal Arm targets show it can be overridden,
which rustc supports via `c-enum-min-bits` in a target.json.

The override is a flag named `-fshort-enums` in clang and gcc,
but introducing a CLI flag is probably unnecessary for rustc.
This flag can be used by non-Arm microcontroller targets,
like AVR and MSP430, but it is not enabled for them by default.
Rust programmers who know the size of a target's enums
can use explicit reprs, which also lets them match C23 code.

This change is most relevant to 16-bit targets: AVR and MSP430.
Most of rustc's targets use 32-bit ints, but ILP64 does exist.
Regardless, rustc should now correctly handle enums for
both very small and very large targets.

Thanks to William for confirming MSP430 behavior,
and to Waffle for better style and no-core size_of asserts.

Co-authored-by: William D. Jones <thor0505@comcast.net>
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-02-16 15:06:17 -08:00
Alan Egerton
55d449fe0a
Clarify DerivedObligationCause may hold alias id 2023-02-16 22:12:15 +00:00
Alan Egerton
a1468ae00d
Do not ICE on unmet trait alias impl bounds 2023-02-16 22:10:29 +00:00
bors
947b696ce0 Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillot
Factor query arena allocation out from query caches

This moves the logic for arena allocation out from the query caches into conditional code in the query system. The specialized arena caches are removed. A new `QuerySystem` type is added in `rustc_middle` which contains the arenas, providers and query caches.

Performance seems to be slightly regressed:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.8053s</td><td align="right">1.8109s</td><td align="right"> 0.31%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2600s</td><td align="right">0.2597s</td><td align="right"> -0.10%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9973s</td><td align="right">1.0006s</td><td align="right"> 0.34%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6048s</td><td align="right">1.6051s</td><td align="right"> 0.02%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.2992s</td><td align="right">6.3159s</td><td align="right"> 0.26%</td></tr><tr><td>Total</td><td align="right">10.9664s</td><td align="right">10.9922s</td><td align="right"> 0.23%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">1.0017s</td><td align="right"> 0.17%</td></tr></table>

Incremental performance is a bit worse:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check:initial</td><td align="right">2.2103s</td><td align="right">2.2247s</td><td align="right"> 0.65%</td></tr><tr><td>🟣 <b>hyper</b>:check:initial</td><td align="right">0.3335s</td><td align="right">0.3349s</td><td align="right"> 0.41%</td></tr><tr><td>🟣 <b>regex</b>:check:initial</td><td align="right">1.2597s</td><td align="right">1.2650s</td><td align="right"> 0.42%</td></tr><tr><td>🟣 <b>syn</b>:check:initial</td><td align="right">2.0521s</td><td align="right">2.0613s</td><td align="right"> 0.45%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:initial</td><td align="right">7.8275s</td><td align="right">7.8583s</td><td align="right"> 0.39%</td></tr><tr><td>Total</td><td align="right">13.6832s</td><td align="right">13.7442s</td><td align="right"> 0.45%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">1.0046s</td><td align="right"> 0.46%</td></tr></table>

It does seem like LLVM optimizers struggle a bit with the current state of the query system.

Based on top of https://github.com/rust-lang/rust/pull/107782 and https://github.com/rust-lang/rust/pull/107802.

r? `@cjgillot`
2023-02-16 22:10:10 +00:00
Michael Goulet
ff9c5db03c Tweak wording 2023-02-16 20:52:29 +00:00
Michael Goulet
3dd638fe6c Move call trait lang item malformed check to typeck 2023-02-16 20:37:33 +00:00
clubby789
90f642bb3d Properly check for builtin derives 2023-02-16 19:44:03 +00:00
bors
9a7cc6c32f Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106347 (More accurate spans for arg removal suggestion)
 - #108057 (Prevent some attributes from being merged with others on reexports)
 - #108090 (`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`)
 - #108092 (note issue for feature(packed_bundled_libs))
 - #108099 (use chars instead of strings where applicable)
 - #108115 (Do not ICE on unmet trait alias bounds)
 - #108125 (Add new people to the compiletest review rotation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-16 19:21:02 +00:00
Kyle Matsuda
382ade6a60 fix ugly skip_binder 2023-02-16 10:52:57 -07:00
Kyle Matsuda
d659c7c343 make issue33140_self_ty return Option<EarlyBinder<Ty>> 2023-02-16 10:52:57 -07:00
Matthias Krüger
a1a6588162 don't into self
don't into()-convert types to themselves
2023-02-16 18:30:25 +01:00
Tshepang Mbambo
f9972313ae fix some lines, and do a consistency fix 2023-02-16 18:58:08 +02:00
Matthias Krüger
d77b0221f8
Rollup merge of #108115 - eggyal:unmet_trait_alias_bound, r=compiler-errors
Do not ICE on unmet trait alias bounds

Rework of #108093 following feedback on that PR.

Fixes #108072

r? `@compiler-errors`
2023-02-16 17:51:26 +01:00
Matthias Krüger
09a2267e1d
Rollup merge of #108099 - matthiaskrgr:str_to_char, r=GuillaumeGomez
use chars instead of strings where applicable
2023-02-16 17:51:26 +01:00
Matthias Krüger
2dc21c0a10
Rollup merge of #108092 - BelovDV:fix-feature-description-pbl, r=petrochenkov
note issue for feature(packed_bundled_libs)

Add to feature (introduced in #105601) gate description number of issue created for it.

r? `@petrochenkov`
2023-02-16 17:51:25 +01:00
Matthias Krüger
64a4f70c17
Rollup merge of #108090 - WaffleLapkin:if_not_now_then_when…, r=oli-obk
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`

Resurrection of #108079
2023-02-16 17:51:25 +01:00
Matthias Krüger
f65c6e416c
Rollup merge of #106347 - estebank:removal-suggestion, r=TaKO8Ki
More accurate spans for arg removal suggestion

Partially address #106304.
2023-02-16 17:51:24 +01:00
bors
c5d1b3ea96 Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errors
Optimize `mk_region`

PR #107869 avoiding some interning under `mk_ty` by special-casing `Ty` variants with simple (integer) bodies. This PR does something similar for regions.

r? `@compiler-errors`
2023-02-16 16:11:54 +00:00
Maybe Waffle
5bf6a46032 Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
Maybe Waffle
8751fa1a9a if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
John Kåre Alsaker
caf29b2727 Remove parallel compiler fix 2023-02-16 14:55:05 +01:00
John Kåre Alsaker
1ae1eac7d2 Add some comments and use inline(always) on query_provided_to_value 2023-02-16 14:55:05 +01:00
John Kåre Alsaker
067bf2ac13 Move provider fields back to rustc_query_impl 2023-02-16 14:55:05 +01:00
John Kåre Alsaker
265e1e968d Use dropless arena when possible 2023-02-16 14:55:05 +01:00
John Kåre Alsaker
a51a20531d Factor query arena allocation out from query caches 2023-02-16 14:54:53 +01:00
Ben Kimock
1409cb59b2 Enable instcombine for mutable reborrows 2023-02-16 07:51:23 -05:00
Alan Egerton
540bd986aa
Do not ICE on unmet trait alias bounds 2023-02-16 11:18:08 +00:00
BelovDV
b488508c17 note issue for feature(packed_bundled_libs) 2023-02-16 14:09:55 +03:00
bors
af3c8b2726 Auto merge of #101841 - nnethercote:rm-save-analysis, r=Mark-Simulacrum
Remove save-analysis.

Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested.

Closes https://github.com/rust-lang/rust/issues/43606
2023-02-16 10:35:44 +00:00
bors
4b34c7b766 Auto merge of #108116 - Dylan-DPC:rollup-h3n2vxl, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #106372 (Use id-based thread parking on SOLID)
 - #108050 (Fix index out of bounds ICE in `point_at_expr_source_of_inferred_type`)
 - #108084 (Constify `RangeBounds`, `RangeX::contains` and `RangeX::is_empty` (where applicable).)
 - #108101 (don't clone types that are copy)
 - #108102 (simplify some refs)
 - #108103 (be nice and don't slice)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-16 07:15:13 +00:00
Dylan DPC
bb1e9846b2
Rollup merge of #108103 - matthiaskrgr:lice, r=compiler-errors
be nice and don't slice

These are already slices, no need to slice them again
2023-02-16 11:40:22 +05:30
Dylan DPC
7bde7b73f1
Rollup merge of #108102 - matthiaskrgr:ref, r=compiler-errors
simplify some refs
2023-02-16 11:40:21 +05:30