Commit Graph

22280 Commits

Author SHA1 Message Date
Matthias Krüger
d39fc2111b
Rollup merge of #108323 - tshepang:translatable-hir-analysis, r=compiler-errors
hir-analysis: make one diagnostic translatable
2023-02-21 23:02:02 +01:00
Matthias Krüger
82dc2ebfe3
Rollup merge of #108322 - cjgillot:clean-const-prop, r=oli-obk
Clean ConstProp

Small simplifications from the time when there that pass output lints.
2023-02-21 23:02:01 +01:00
Matthias Krüger
ae01430078
Rollup merge of #108295 - compiler-errors:wtf-is-this, r=cjgillot
Use DefKind to give more item kind information during BindingObligation note

The current label says "required by a bound in this". When I see that label, my immediate impression is "this... **what**?". It feels like it was cut short.

Alternative to this would be saying "in this item", but adding the item kind is strictly more informational and adds very little overhead to the existing error presentation.
2023-02-21 23:02:00 +01:00
Matthias Krüger
8a5843f07f
Rollup merge of #108202 - compiler-errors:non_lifetime_binders-type-match-ice, r=davidtwco
Make sure `test_type_match` doesn't ICE with late-bound types

Fixes #108190 (in a kind of hacky way, anyways doesn't really matter)
2023-02-21 23:01:59 +01:00
Matthias Krüger
314fe4d170
Rollup merge of #104239 - b-naber:sccs-info, r=jackh726
Better debug logs for borrowck constraint graph

It's really cumbersome to work with `RegionVar`s when trying to debug borrowck code or when trying to understand how the borrowchecker works. This PR collects some region information (behind `cfg(debug_assertions)`) for created `RegionVar`s (NLL region vars, this PR doesn't touch canonicalization) and prints the nodes and edges of the strongly connected constraints graph using representatives that use that region information (either lifetime names, locations in MIR or spans).
2023-02-21 23:01:58 +01:00
b-naber
8252a6eddf address review 2023-02-21 21:54:53 +00:00
John Kåre Alsaker
056c5b3b57 Make query keys Copy 2023-02-21 22:15:46 +01:00
Tshepang Mbambo
b483816d88 hir-analysis: make one diagnostic translatable 2023-02-21 22:27:16 +02:00
bors
246eae2fab Auto merge of #108307 - jedisct1:z-link-flags, r=wesleywiser
Linker: use -z <params> instead of -z<params>

The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers.

In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax.

In `linker.rs`, both syntaxes are also used inconsistently.

The Go compiler used to have the same issue, but fixed it:

38607c5538
2023-02-21 18:53:34 +00:00
bors
f4c7596ac3 Auto merge of #108311 - oli-obk:invert_defines, r=lcnr
Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers

r? `@lcnr`

pulled out of https://github.com/rust-lang/rust/pull/107891 as it is the uncontroversial part
2023-02-21 15:48:40 +00:00
Oli Scherer
88a7b6803b Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers 2023-02-21 14:50:51 +00:00
Frank Denis
8e250c3c64 Linker: use -z <params> instead of -z<params>
The GNU linker accepts -z<params>, but this is undocumented, and
not supported by other linkers.

In particular, `zig cc`, when used as the C compiler/linker
(e.g. when using `cargo-zigbuild`), will not accept this
undocumented syntax.

In `linker.rs`, both syntaxes are also used inconsistently.

The Go compiler used to have the same issue, but fixed it:

38607c5538
2023-02-21 14:52:20 +01:00
clubby789
0b9a3e29d4 Fix overlapping spans in removing extra arguments 2023-02-21 13:13:09 +00:00
bors
3200982b76 Auto merge of #108138 - compiler-errors:malformed-fn-trait, r=TaKO8Ki
Move `Fn*` traits malformedness protections to typeck

I found it strange that we were doing a custom well-formedness check just for the `Fn*` traits' `call_*` fn items. My understanding from the git history is that this is just to avoid ICEs later on in typeck.

Well, that well-formedness check isn't even implemented correctly for `FnOnce::call_once`, or `FnMut::call_mut` for that matter. Instead, this PR just makes the typeck checks more robust, and leaves it up to the call-site to report errors when lang items are implemented in funny ways.

This coincidentally fixes another ICE where a the `Add` lang item is implemented with a `add` item that's a const instead of a method.
2023-02-21 12:59:11 +00:00
bors
bda32a4023 Auto merge of #108301 - Dylan-DPC:rollup-70zpkt0, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #108000 (lint: don't suggest MaybeUninit::assume_init for uninhabited types)
 - #108105 (Explain the default panic hook better)
 - #108141 (Add rpitit queries)
 - #108272 (docs: wrong naming convention in struct keyword doc)
 - #108285 (remove unstable `pick_stable_methods_before_any_unstable` flag)
 - #108289 (Name placeholder in some region errors)
 - #108290 (Add a test for default trait method with RPITITs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-21 09:51:03 +00:00
Dylan DPC
270f45e172
Rollup merge of #108289 - compiler-errors:name-placeholder, r=petrochenkov
Name placeholder in some region errors

Also don't print `ReVar` or `ReLateBound` as debug... these error messages are super uncommon anyways, but in the case they do trigger, let's be slightly more helpful.
2023-02-21 14:20:01 +05:30
Dylan DPC
6a21237bb8
Rollup merge of #108285 - BoxyUwU:remove_pick_stable_before_unstable_flag, r=oli-obk
remove unstable `pick_stable_methods_before_any_unstable` flag

This flag was only added in #90329 in case there was any issue with the impl so that it would be easy to tell nightly users to use the flag to disable the new logic to fix their code. It's now been enabled for two years and also I can't find any issues corresponding to this new functionality? This flag made it way harder to understand how this code works so it would be nice to remove it and simplify what's going on.

cc `@nbdd0121`

r? `@oli-obk`
2023-02-21 14:20:00 +05:30
Dylan DPC
076e627023
Rollup merge of #108141 - spastorino:add_rpitit_queries, r=compiler-errors
Add rpitit queries

This is part of the changes we are making to lower RPITITs as an associated type. The rest of the stuff will follow under a `-Z` flag.

I still need to add comments to the code, explain stuff and also I'd need to avoid encoding in metadata when rpitit queries return `&[]`

r? `@compiler-errors`
2023-02-21 14:19:59 +05:30
Dylan DPC
4dea3a295f
Rollup merge of #108000 - y21:no-zero-init-for-uninhabited, r=jackh726
lint: don't suggest MaybeUninit::assume_init for uninhabited types

Creating a zeroed uninhabited type such as `!` or an empty enum with `mem::zeroed()` (or transmuting `()` to `!`) currently triggers this lint:
```rs
warning: the type `!` does not permit zero-initialization
 --> test.rs:5:23
  |
5 |         let _val: ! = mem::zeroed();
  |                       ^^^^^^^^^^^^^
  |                       |
  |                       this code causes undefined behavior when executed
  |                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
  |
  = note: the `!` type has no valid value
```
The `MaybeUninit` suggestion in the help message seems confusing/useless for uninhabited types, as such a type cannot be fully initialized in the first place (as the note implies).
This PR limits this help message to inhabited types which can be initialized
2023-02-21 14:19:58 +05:30
Oli Scherer
decfb4d123 Use a lock-free datastructure for source_span 2023-02-21 08:38:24 +00:00
Oli Scherer
a04e78730e Use source_span query instead of passing the untracked vec around 2023-02-21 08:29:55 +00:00
Oli Scherer
a6b381a11b Remove unused Debug impl 2023-02-21 08:13:50 +00:00
bors
3fee48c161 Auto merge of #104754 - nnethercote:more-ThinVec-in-ast, r=the8472
Use `ThinVec` more in the AST

r? `@ghost`
2023-02-21 07:02:57 +00:00
Michael Goulet
a58682d7cc Specify what 'this' actually is 2023-02-21 05:21:07 +00:00
bors
f715e430aa Auto merge of #107728 - RalfJung:miri-dyn-star, r=RalfJung,oli-obk
Miri: basic dyn* support

As usual I am very unsure about the dynamic dispatch stuff, but it passes even the `Pin<&mut dyn* Trait>` test so that is something.

TBH I think it was a mistake to make `dyn Trait` and `dyn* Trait` part of the same `TyKind` variant. Almost everywhere in Miri this lead to the wrong default behavior, resulting in strange ICEs instead of nice "unimplemented" messages. The two types describe pretty different runtime data layout after all.

Strangely I did not need to do the equivalent of [this diff](https://github.com/rust-lang/rust/pull/106532#discussion_r1087095963) in Miri. Maybe that is because the unsizing logic matches on `ty::Dynamic(.., ty::Dyn)` already? In `unsized_info` I don't think the `target_dyn_kind` can be `DynStar`, since then it wouldn't be unsized!

r? `@oli-obk` Cc `@eholk` (dyn-star) https://github.com/rust-lang/rust/issues/102425
2023-02-21 04:22:23 +00:00
Michael Goulet
729cd55688 Associated type bounds in some places in the compiler 2023-02-21 03:49:22 +00:00
bors
2deff71719 Auto merge of #105462 - oli-obk:feeding_full, r=cjgillot,petrochenkov
give the resolver access to TyCtxt

The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR.

Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes.

### PRs split out of this one and leading up to it:

* https://github.com/rust-lang/rust/pull/105423
* https://github.com/rust-lang/rust/pull/105357
* https://github.com/rust-lang/rust/pull/105603
* https://github.com/rust-lang/rust/pull/106776
* https://github.com/rust-lang/rust/pull/106810
* https://github.com/rust-lang/rust/pull/106812
* https://github.com/rust-lang/rust/pull/108032
2023-02-21 01:19:25 +00:00
Nicholas Nethercote
7e855d5f31 Use ThinVec in a few more AST types. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
549f1c60af Use ThinVec in ast::ExprKind::Match. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
912b825002 Use ThinVec in ast::PatKind::Struct. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
1807027248 Use ThinVec in ast::AngleBracketedArgs. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
b14b7ba5dd Use ThinVec in ast::Block. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
4143b101f9 Use ThinVec in various AST types.
This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
2023-02-21 11:51:56 +11:00
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