rust/src
bors 1f0a96862a Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk
Improve opaque type higher-ranked region error message under NLL

Currently, any higher-ranked region errors involving opaque types
fall back to a generic "higher-ranked subtype error" message when
run under NLL. This PR adds better error message handling for this
case, giving us the same kinds of error messages that we currently
get without NLL:

```
error: implementation of `MyTrait` is not general enough
  --> $DIR/opaque-hrtb.rs:12:13
   |
LL | fn foo() -> impl for<'a> MyTrait<&'a str> {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough
   |
   = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`...
   = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2`

error: aborting due to previous error
```

To accomplish this, several different refactoring needed to be made:

* We now have a dedicated `InstantiateOpaqueType` struct which
implements `TypeOp`. This is used to invoke `instantiate_opaque_types`
during MIR type checking.
* `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is
needed to report opaque type region errors.
* We no longer assume that all `TypeOp`s correspond to canonicalized
queries. This allows us to properly handle opaque type instantiation
(which does not occur in a query) as a `TypeOp`.
A new `ErrorInfo` associated type is used to determine what
additional information is used during higher-ranked region error
handling.
* The body of `try_extract_error_from_fulfill_cx`
has been moved out to a new function `try_extract_error_from_region_constraints`.
This allows us to re-use the same error reporting code between
canonicalized queries (which can extract region constraints directly
from a fresh `InferCtxt`) and opaque type handling (which needs to take
region constraints from the pre-existing `InferCtxt` that we use
throughout MIR borrow checking).
2022-02-09 09:41:48 +00:00
..
bootstrap Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
build_helper Hide failed command unless in verbose mode 2022-01-30 17:37:11 -05:00
ci Auto merge of #93719 - scottmcm:core-as-2021-everywhere, r=Mark-Simulacrum 2022-02-07 12:38:21 +00:00
doc Auto merge of #93561 - Amanieu:more-unwind-abi, r=nagisa 2022-02-08 03:20:05 +00:00
etc Auto merge of #93626 - wesleywiser:fix_hashmap_natvis, r=michaelwoerister 2022-02-08 10:05:05 +00:00
librustdoc Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis 2022-02-09 14:12:22 +09:00
llvm-project@fdc8f411ec Update llvm-project submodule 2022-02-05 21:00:23 +00:00
rustdoc-json-types Increase the format version of rustdoc-json-types 2022-01-20 22:14:02 +01:00
test Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk 2022-02-09 09:41:48 +00:00
tools Auto merge of #93795 - JohnTitor:rollup-n0dmsoo, r=JohnTitor 2022-02-09 06:54:16 +00:00
README.md
stage0.json bump bootstrap compiler 2022-01-28 15:01:04 +01:00
version bump version to 1.60.0 2022-01-07 10:04:15 +01:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.