summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/liballoc/rc.rs24
-rw-r--r--src/liballoc/sync.rs24
-rw-r--r--src/libcore/str/mod.rs4
-rw-r--r--src/libcore/sync/atomic.rs2
-rw-r--r--src/librustc/infer/error_reporting/mod.rs15
-rw-r--r--src/librustc/infer/error_reporting/note.rs20
-rw-r--r--src/librustc/ty/print/pretty.rs3
-rw-r--r--src/librustc_codegen_llvm/back/write.rs13
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs3
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs (renamed from src/librustc_mir/borrow_check/conflict_errors.rs)38
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs (renamed from src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs)5
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/find_use.rs (renamed from src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs)0
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/mod.rs (renamed from src/librustc_mir/borrow_check/error_reporting.rs)18
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/move_errors.rs (renamed from src/librustc_mir/borrow_check/move_errors.rs)2
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs (renamed from src/librustc_mir/borrow_check/mutability_errors.rs)6
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs (renamed from src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs)10
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/region_errors.rs (renamed from src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs)35
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/region_name.rs (renamed from src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs)16
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/var_name.rs (renamed from src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs)0
-rw-r--r--src/librustc_mir/borrow_check/mod.rs7
-rw-r--r--src/librustc_mir/borrow_check/nll/mod.rs10
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/mod.rs93
-rw-r--r--src/librustc_parse/parser/module.rs4
-rw-r--r--src/librustc_target/spec/wasm32_base.rs3
-rw-r--r--src/librustc_typeck/check/demand.rs16
-rw-r--r--src/librustc_typeck/check/expr.rs18
-rw-r--r--src/librustc_typeck/check/pat.rs21
-rw-r--r--src/libsyntax_pos/symbol.rs6
-rw-r--r--src/rustllvm/PassWrapper.cpp43
-rw-r--r--src/test/codegen/gdb_debug_script_load.rs2
-rw-r--r--src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr20
-rw-r--r--src/test/ui/c-variadic/variadic-ffi-4.stderr10
-rw-r--r--src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr20
-rw-r--r--src/test/ui/issues/issue-16683.stderr10
-rw-r--r--src/test/ui/issues/issue-17758.stderr10
-rw-r--r--src/test/ui/issues/issue-20831-debruijn.stderr16
-rw-r--r--src/test/ui/issues/issue-52213.stderr10
-rw-r--r--src/test/ui/issues/issue-55796.stderr20
-rw-r--r--src/test/ui/issues/issue-65634-raw-ident-suggestion.rs22
-rw-r--r--src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr22
-rw-r--r--src/test/ui/issues/issue-66702-break-outside-loop-val.rs7
-rw-r--r--src/test/ui/issues/issue-66702-break-outside-loop-val.stderr11
-rw-r--r--src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs21
-rw-r--r--src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr22
-rw-r--r--src/test/ui/nll/issue-55394.stderr10
-rw-r--r--src/test/ui/nll/normalization-bounds-error.stderr10
-rw-r--r--src/test/ui/nll/type-alias-free-regions.stderr40
-rw-r--r--src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr10
-rw-r--r--src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr10
-rw-r--r--src/test/ui/object-lifetime/object-lifetime-default-elision.stderr20
-rw-r--r--src/test/ui/parser/raw/raw-literal-keywords.rs4
-rw-r--r--src/test/ui/parser/raw/raw-literal-keywords.stderr4
-rw-r--r--src/test/ui/regions/region-object-lifetime-in-coercion.stderr20
-rw-r--r--src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr20
-rw-r--r--src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr10
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-2.stderr10
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-4.stderr10
-rw-r--r--src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr10
-rw-r--r--src/test/ui/regions/regions-creating-enums4.stderr20
-rw-r--r--src/test/ui/regions/regions-escape-method.stderr10
-rw-r--r--src/test/ui/regions/regions-escape-via-trait-or-not.stderr10
-rw-r--r--src/test/ui/regions/regions-nested-fns.stderr15
-rw-r--r--src/test/ui/regions/regions-normalize-in-where-clause-list.stderr13
-rw-r--r--src/test/ui/regions/regions-ret-borrowed-1.stderr10
-rw-r--r--src/test/ui/regions/regions-ret-borrowed.stderr10
-rw-r--r--src/test/ui/regions/regions-trait-object-subtyping.stderr10
-rw-r--r--src/test/ui/reject-specialized-drops-8142.stderr10
-rw-r--r--src/test/ui/suggestions/raw-name-use-suggestion.rs2
-rw-r--r--src/test/ui/suggestions/raw-name-use-suggestion.stderr2
-rw-r--r--src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr10
-rw-r--r--src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr10
71 files changed, 663 insertions, 339 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 2254cde..1ff1c3c 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -1648,10 +1648,8 @@ impl<T> Weak<T> {
1648 1648
1649 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`. 1649 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
1650 /// 1650 ///
1651 /// It is up to the caller to ensure that the object is still alive when accessing it through 1651 /// The pointer is valid only if there are some strong references. The pointer may be dangling
1652 /// the pointer. 1652 /// or even [`null`] otherwise.
1653 ///
1654 /// The pointer may be [`null`] or be dangling in case the object has already been destroyed.
1655 /// 1653 ///
1656 /// # Examples 1654 /// # Examples
1657 /// 1655 ///
@@ -1731,14 +1729,18 @@ impl<T> Weak<T> {
1731 /// This can be used to safely get a strong reference (by calling [`upgrade`] 1729 /// This can be used to safely get a strong reference (by calling [`upgrade`]
1732 /// later) or to deallocate the weak count by dropping the `Weak<T>`. 1730 /// later) or to deallocate the weak count by dropping the `Weak<T>`.
1733 /// 1731 ///
1734 /// It takes ownership of one weak count. In case a [`null`] is passed, a dangling [`Weak`] is 1732 /// It takes ownership of one weak count (with the exception of pointers created by [`new`],
1735 /// returned. 1733 /// as these don't have any corresponding weak count).
1736 /// 1734 ///
1737 /// # Safety 1735 /// # Safety
1738 /// 1736 ///
1739 /// The pointer must represent one valid weak count. In other words, it must point to `T` which 1737 /// The pointer must have originated from the [`into_raw`] (or [`as_raw`], provided there was
1740 /// is or *was* managed by an [`Rc`] and the weak count of that [`Rc`] must not have reached 1738 /// a corresponding [`forget`] on the `Weak<T>`) and must still own its potential weak reference
1741 /// 0. It is allowed for the strong count to be 0. 1739 /// count.
1740 ///
1741 /// It is allowed for the strong count to be 0 at the time of calling this, but the weak count
1742 /// must be non-zero or the pointer must have originated from a dangling `Weak<T>` (one created
1743 /// by [`new`]).
1742 /// 1744 ///
1743 /// # Examples 1745 /// # Examples
1744 /// 1746 ///
@@ -1763,11 +1765,13 @@ impl<T> Weak<T> {
1763 /// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none()); 1765 /// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
1764 /// ``` 1766 /// ```
1765 /// 1767 ///
1766 /// [`null`]: ../../std/ptr/fn.null.html
1767 /// [`into_raw`]: struct.Weak.html#method.into_raw 1768 /// [`into_raw`]: struct.Weak.html#method.into_raw
1768 /// [`upgrade`]: struct.Weak.html#method.upgrade 1769 /// [`upgrade`]: struct.Weak.html#method.upgrade
1769 /// [`Rc`]: struct.Rc.html 1770 /// [`Rc`]: struct.Rc.html
1770 /// [`Weak`]: struct.Weak.html 1771 /// [`Weak`]: struct.Weak.html
1772 /// [`as_raw`]: struct.Weak.html#method.as_raw
1773 /// [`new`]: struct.Weak.html#method.new
1774 /// [`forget`]: ../../std/mem/fn.forget.html
1771 #[unstable(feature = "weak_into_raw", issue = "60728")] 1775 #[unstable(feature = "weak_into_raw", issue = "60728")]
1772 pub unsafe fn from_raw(ptr: *const T) -> Self { 1776 pub unsafe fn from_raw(ptr: *const T) -> Self {
1773 if ptr.is_null() { 1777 if ptr.is_null() {
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs
index 7bf2ff1..19b0086 100644
--- a/src/liballoc/sync.rs
+++ b/src/liballoc/sync.rs
@@ -1324,10 +1324,8 @@ impl<T> Weak<T> {
1324 1324
1325 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`. 1325 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
1326 /// 1326 ///
1327 /// It is up to the caller to ensure that the object is still alive when accessing it through 1327 /// The pointer is valid only if there are some strong references. The pointer may be dangling
1328 /// the pointer. 1328 /// or even [`null`] otherwise.
1329 ///
1330 /// The pointer may be [`null`] or be dangling in case the object has already been destroyed.
1331 /// 1329 ///
1332 /// # Examples 1330 /// # Examples
1333 /// 1331 ///
@@ -1408,14 +1406,18 @@ impl<T> Weak<T> {
1408 /// This can be used to safely get a strong reference (by calling [`upgrade`] 1406 /// This can be used to safely get a strong reference (by calling [`upgrade`]
1409 /// later) or to deallocate the weak count by dropping the `Weak<T>`. 1407 /// later) or to deallocate the weak count by dropping the `Weak<T>`.
1410 /// 1408 ///
1411 /// It takes ownership of one weak count. In case a [`null`] is passed, a dangling [`Weak`] is 1409 /// It takes ownership of one weak count (with the exception of pointers created by [`new`],
1412 /// returned. 1410 /// as these don't have any corresponding weak count).
1413 /// 1411 ///
1414 /// # Safety 1412 /// # Safety
1415 /// 1413 ///
1416 /// The pointer must represent one valid weak count. In other words, it must point to `T` which 1414 /// The pointer must have originated from the [`into_raw`] (or [`as_raw'], provided there was
1417 /// is or *was* managed by an [`Arc`] and the weak count of that [`Arc`] must not have reached 1415 /// a corresponding [`forget`] on the `Weak<T>`) and must still own its potential weak reference
1418 /// 0. It is allowed for the strong count to be 0. 1416 /// count.
1417 ///
1418 /// It is allowed for the strong count to be 0 at the time of calling this, but the weak count
1419 /// must be non-zero or the pointer must have originated from a dangling `Weak<T>` (one created
1420 /// by [`new`]).
1419 /// 1421 ///
1420 /// # Examples 1422 /// # Examples
1421 /// 1423 ///
@@ -1440,11 +1442,13 @@ impl<T> Weak<T> {
1440 /// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none()); 1442 /// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
1441 /// ``` 1443 /// ```
1442 /// 1444 ///
1443 /// [`null`]: ../../std/ptr/fn.null.html 1445 /// [`as_raw`]: struct.Weak.html#method.as_raw
1446 /// [`new`]: struct.Weak.html#method.new
1444 /// [`into_raw`]: struct.Weak.html#method.into_raw 1447 /// [`into_raw`]: struct.Weak.html#method.into_raw
1445 /// [`upgrade`]: struct.Weak.html#method.upgrade 1448 /// [`upgrade`]: struct.Weak.html#method.upgrade
1446 /// [`Weak`]: struct.Weak.html 1449 /// [`Weak`]: struct.Weak.html
1447 /// [`Arc`]: struct.Arc.html 1450 /// [`Arc`]: struct.Arc.html
1451 /// [`forget`]: ../../std/mem/fn.forget.html
1448 #[unstable(feature = "weak_into_raw", issue = "60728")] 1452 #[unstable(feature = "weak_into_raw", issue = "60728")]
1449 pub unsafe fn from_raw(ptr: *const T) -> Self { 1453 pub unsafe fn from_raw(ptr: *const T) -> Self {
1450 if ptr.is_null() { 1454 if ptr.is_null() {
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 25b7eec..b2a420f 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -3371,8 +3371,8 @@ impl str {
3371 /// An iterator over the disjoint matches of a pattern within the given string 3371 /// An iterator over the disjoint matches of a pattern within the given string
3372 /// slice. 3372 /// slice.
3373 /// 3373 ///
3374 /// The pattern can be any type that implements the Pattern trait. Notable 3374 /// The pattern can be a `&str`, [`char`], or a closure that determines if
3375 /// examples are `&str`, [`char`], and closures that determines the split. 3375 /// a character matches.
3376 /// 3376 ///
3377 /// # Iterator behavior 3377 /// # Iterator behavior
3378 /// 3378 ///
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index 251d49d..6e1aac0 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -27,7 +27,7 @@
27//! 27//!
28//! Atomic variables are safe to share between threads (they implement [`Sync`]) 28//! Atomic variables are safe to share between threads (they implement [`Sync`])
29//! but they do not themselves provide the mechanism for sharing and follow the 29//! but they do not themselves provide the mechanism for sharing and follow the
30//! [threading model](../../../std/thread/index.html#the-threading-model) of rust. 30//! [threading model](../../../std/thread/index.html#the-threading-model) of Rust.
31//! The most common way to share an atomic variable is to put it into an [`Arc`][arc] (an 31//! The most common way to share an atomic variable is to put it into an [`Arc`][arc] (an
32//! atomically-reference-counted shared pointer). 32//! atomically-reference-counted shared pointer).
33//! 33//!
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index 5a940f2..58c1498 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -1809,12 +1809,17 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1809 sub_region, 1809 sub_region,
1810 "...", 1810 "...",
1811 ); 1811 );
1812 err.note(&format!( 1812 err.span_note(sup_trace.cause.span, &format!(
1813 "...so that the {}:\nexpected {}\n found {}", 1813 "...so that the {}",
1814 sup_trace.cause.as_requirement_str(), 1814 sup_trace.cause.as_requirement_str()
1815 sup_expected.content(),
1816 sup_found.content()
1817 )); 1815 ));
1816
1817 err.note_expected_found(
1818 &"",
1819 sup_expected,
1820 &"",
1821 sup_found
1822 );
1818 err.emit(); 1823 err.emit();
1819 return; 1824 return;
1820 } 1825 }
diff --git a/src/librustc/infer/error_reporting/note.rs b/src/librustc/infer/error_reporting/note.rs
index c1f840a..4b93373 100644
--- a/src/librustc/infer/error_reporting/note.rs
+++ b/src/librustc/infer/error_reporting/note.rs
@@ -13,12 +13,20 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13 match *origin { 13 match *origin {
14 infer::Subtype(ref trace) => { 14 infer::Subtype(ref trace) => {
15 if let Some((expected, found)) = self.values_str(&trace.values) { 15 if let Some((expected, found)) = self.values_str(&trace.values) {
16 let expected = expected.content(); 16 err.span_note(
17 let found = found.content(); 17 trace.cause.span,
18 err.note(&format!("...so that the {}:\nexpected {}\n found {}", 18 &format!(
19 trace.cause.as_requirement_str(), 19 "...so that the {}",
20 expected, 20 trace.cause.as_requirement_str()
21 found)); 21 )
22 );
23
24 err.note_expected_found(
25 &"",
26 expected,
27 &"",
28 found
29 );
22 } else { 30 } else {
23 // FIXME: this really should be handled at some earlier stage. Our 31 // FIXME: this really should be handled at some earlier stage. Our
24 // handling of region checking when type errors are present is 32 // handling of region checking when type errors are present is
diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs
index fff2f06..745f7d0 100644
--- a/src/librustc/ty/print/pretty.rs
+++ b/src/librustc/ty/print/pretty.rs
@@ -1282,6 +1282,9 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
1282 if !self.empty_path { 1282 if !self.empty_path {
1283 write!(self, "::")?; 1283 write!(self, "::")?;
1284 } 1284 }
1285 if ast::Ident::from_str(&name).is_raw_guess() {
1286 write!(self, "r#")?;
1287 }
1285 write!(self, "{}", name)?; 1288 write!(self, "{}", name)?;
1286 1289
1287 // FIXME(eddyb) this will print e.g. `{{closure}}#3`, but it 1290 // FIXME(eddyb) this will print e.g. `{{closure}}#3`, but it
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 48bbc13..a05ba9c 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -588,14 +588,11 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<LlvmCodegenBackend>,
588 cursor.position() as size_t 588 cursor.position() as size_t
589 } 589 }
590 590
591 with_codegen(tm, llmod, config.no_builtins, |cpm| { 591 let result =
592 let result = 592 llvm::LLVMRustPrintModule(llmod, out_c.as_ptr(), demangle_callback);
593 llvm::LLVMRustPrintModule(cpm, llmod, out_c.as_ptr(), demangle_callback); 593 result.into_result().map_err(|()| {
594 llvm::LLVMDisposePassManager(cpm); 594 let msg = format!("failed to write LLVM IR to {}", out.display());
595 result.into_result().map_err(|()| { 595 llvm_err(diag_handler, &msg)
596 let msg = format!("failed to write LLVM IR to {}", out.display());
597 llvm_err(diag_handler, &msg)
598 })
599 })?; 596 })?;
600 } 597 }
601 598
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index fd31e65..5362d18 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1727,8 +1727,7 @@ extern "C" {
1727 Output: *const c_char, 1727 Output: *const c_char,
1728 FileType: FileType) 1728 FileType: FileType)
1729 -> LLVMRustResult; 1729 -> LLVMRustResult;
1730 pub fn LLVMRustPrintModule(PM: &PassManager<'a>, 1730 pub fn LLVMRustPrintModule(M: &'a Module,
1731 M: &'a Module,
1732 Output: *const c_char, 1731 Output: *const c_char,
1733 Demangle: extern fn(*const c_char, 1732 Demangle: extern fn(*const c_char,
1734 size_t, 1733 size_t,
diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
index b1e327c..d14957b 100644
--- a/src/librustc_mir/borrow_check/conflict_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
@@ -14,18 +14,22 @@ use rustc_errors::{Applicability, DiagnosticBuilder};
14use syntax_pos::Span; 14use syntax_pos::Span;
15use syntax::source_map::DesugaringKind; 15use syntax::source_map::DesugaringKind;
16 16
17use super::nll::explain_borrow::BorrowExplanation;
18use super::nll::region_infer::{RegionName, RegionNameSource};
19use super::prefixes::IsPrefixOf;
20use super::WriteKind;
21use super::borrow_set::BorrowData;
22use super::MirBorrowckCtxt;
23use super::{InitializationRequiringAction, PrefixSet};
24use super::error_reporting::{IncludingDowncast, UseSpans};
25use crate::dataflow::drop_flag_effects; 17use crate::dataflow::drop_flag_effects;
26use crate::dataflow::indexes::{MovePathIndex, MoveOutIndex}; 18use crate::dataflow::indexes::{MovePathIndex, MoveOutIndex};
27use crate::util::borrowck_errors; 19use crate::util::borrowck_errors;
28 20
21use crate::borrow_check::{
22 prefixes::IsPrefixOf,
23 WriteKind,
24 borrow_set::BorrowData,
25 MirBorrowckCtxt, InitializationRequiringAction, PrefixSet
26};
27
28use super::{
29 IncludingDowncast, UseSpans, RegionName, RegionNameSource,
30 explain_borrow::BorrowExplanation,
31};
32
29#[derive(Debug)] 33#[derive(Debug)]
30struct MoveSite { 34struct MoveSite {
31 /// Index of the "move out" that we found. The `MoveData` can 35 /// Index of the "move out" that we found. The `MoveData` can
@@ -46,7 +50,7 @@ enum StorageDeadOrDrop<'tcx> {
46} 50}
47 51
48impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { 52impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
49 pub(super) fn report_use_of_moved_or_uninitialized( 53 pub(in crate::borrow_check) fn report_use_of_moved_or_uninitialized(
50 &mut self, 54 &mut self,
51 location: Location, 55 location: Location,
52 desired_action: InitializationRequiringAction, 56 desired_action: InitializationRequiringAction,
@@ -269,7 +273,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
269 } 273 }
270 } 274 }
271 275
272 pub(super) fn report_move_out_while_borrowed( 276 pub(in crate::borrow_check) fn report_move_out_while_borrowed(
273 &mut self, 277 &mut self,
274 location: Location, 278 location: Location,
275 (place, span): (&Place<'tcx>, Span), 279 (place, span): (&Place<'tcx>, Span),
@@ -326,7 +330,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
326 err.buffer(&mut self.errors_buffer); 330 err.buffer(&mut self.errors_buffer);
327 } 331 }
328 332
329 pub(super) fn report_use_while_mutably_borrowed( 333 pub(in crate::borrow_check) fn report_use_while_mutably_borrowed(
330 &mut self, 334 &mut self,
331 location: Location, 335 location: Location,
332 (place, _span): (&Place<'tcx>, Span), 336 (place, _span): (&Place<'tcx>, Span),
@@ -368,7 +372,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
368 err 372 err
369 } 373 }
370 374
371 pub(super) fn report_conflicting_borrow( 375 pub(in crate::borrow_check) fn report_conflicting_borrow(
372 &mut self, 376 &mut self,
373 location: Location, 377 location: Location,
374 (place, span): (&Place<'tcx>, Span), 378 (place, span): (&Place<'tcx>, Span),
@@ -614,7 +618,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
614 /// 618 ///
615 /// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as 619 /// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
616 /// > mutable (via `a.u.s.b`) [E0502] 620 /// > mutable (via `a.u.s.b`) [E0502]
617 pub(super) fn describe_place_for_conflicting_borrow( 621 pub(in crate::borrow_check) fn describe_place_for_conflicting_borrow(
618 &self, 622 &self,
619 first_borrowed_place: &Place<'tcx>, 623 first_borrowed_place: &Place<'tcx>,
620 second_borrowed_place: &Place<'tcx>, 624 second_borrowed_place: &Place<'tcx>,
@@ -722,7 +726,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
722 /// short a lifetime. (But sometimes it is more useful to report 726 /// short a lifetime. (But sometimes it is more useful to report
723 /// it as a more direct conflict between the execution of a 727 /// it as a more direct conflict between the execution of a
724 /// `Drop::drop` with an aliasing borrow.) 728 /// `Drop::drop` with an aliasing borrow.)
725 pub(super) fn report_borrowed_value_does_not_live_long_enough( 729 pub(in crate::borrow_check) fn report_borrowed_value_does_not_live_long_enough(
726 &mut self, 730 &mut self,
727 location: Location, 731 location: Location,
728 borrow: &BorrowData<'tcx>, 732 borrow: &BorrowData<'tcx>,
@@ -1478,7 +1482,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1478 result 1482 result
1479 } 1483 }
1480 1484
1481 pub(super) fn report_illegal_mutation_of_borrowed( 1485 pub(in crate::borrow_check) fn report_illegal_mutation_of_borrowed(
1482 &mut self, 1486 &mut self,
1483 location: Location, 1487 location: Location,
1484 (place, span): (&Place<'tcx>, Span), 1488 (place, span): (&Place<'tcx>, Span),
@@ -1537,7 +1541,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1537 /// assigned; `err_place` is a place providing a reason why 1541 /// assigned; `err_place` is a place providing a reason why
1538 /// `place` is not mutable (e.g., the non-`mut` local `x` in an 1542 /// `place` is not mutable (e.g., the non-`mut` local `x` in an
1539 /// assignment to `x.f`). 1543 /// assignment to `x.f`).
1540 pub(super) fn report_illegal_reassignment( 1544 pub(in crate::borrow_check) fn report_illegal_reassignment(
1541 &mut self, 1545 &mut self,
1542 _location: Location, 1546 _location: Location,
1543 (place, span): (&Place<'tcx>, Span), 1547 (place, span): (&Place<'tcx>, Span),
@@ -2080,7 +2084,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
2080impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { 2084impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
2081 /// Annotate the provided diagnostic with information about borrow from the fn signature that 2085 /// Annotate the provided diagnostic with information about borrow from the fn signature that
2082 /// helps explain. 2086 /// helps explain.
2083 pub(super) fn emit( 2087 pub(in crate::borrow_check) fn emit(
2084 &self, 2088 &self,
2085 cx: &mut MirBorrowckCtxt<'_, 'tcx>, 2089 cx: &mut MirBorrowckCtxt<'_, 'tcx>,
2086 diag: &mut DiagnosticBuilder<'_>, 2090 diag: &mut DiagnosticBuilder<'_>,
diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs
index 43aabac..67c3c36 100644
--- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs
@@ -1,8 +1,7 @@
1use std::collections::VecDeque; 1use std::collections::VecDeque;
2 2
3use crate::borrow_check::borrow_set::BorrowData; 3use crate::borrow_check::borrow_set::BorrowData;
4use crate::borrow_check::error_reporting::UseSpans; 4use crate::borrow_check::nll::region_infer::Cause;
5use crate::borrow_check::nll::region_infer::{Cause, RegionName};
6use crate::borrow_check::nll::ConstraintDescription; 5use crate::borrow_check::nll::ConstraintDescription;
7use crate::borrow_check::{MirBorrowckCtxt, WriteKind}; 6use crate::borrow_check::{MirBorrowckCtxt, WriteKind};
8use rustc::mir::{ 7use rustc::mir::{
@@ -17,7 +16,7 @@ use rustc_errors::DiagnosticBuilder;
17use syntax_pos::Span; 16use syntax_pos::Span;
18use syntax_pos::symbol::Symbol; 17use syntax_pos::symbol::Symbol;
19 18
20mod find_use; 19use super::{UseSpans, find_use, RegionName};
21 20
22#[derive(Debug)] 21#[derive(Debug)]
23pub(in crate::borrow_check) enum BorrowExplanation { 22pub(in crate::borrow_check) enum BorrowExplanation {
diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/diagnostics/find_use.rs
index 7ab0692..7ab0692 100644
--- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/find_use.rs
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/diagnostics/mod.rs
index 9953d28..1a76265 100644
--- a/src/librustc_mir/borrow_check/error_reporting.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/mod.rs
@@ -1,3 +1,5 @@
1//! Borrow checker diagnostics.
2
1use rustc::hir; 3use rustc::hir;
2use rustc::hir::def::Namespace; 4use rustc::hir::def::Namespace;
3use rustc::hir::def_id::DefId; 5use rustc::hir::def_id::DefId;
@@ -17,6 +19,22 @@ use super::borrow_set::BorrowData;
17use super::MirBorrowckCtxt; 19use super::MirBorrowckCtxt;
18use crate::dataflow::move_paths::{InitLocation, LookupResult}; 20use crate::dataflow::move_paths::{InitLocation, LookupResult};
19 21
22mod find_use;
23mod var_name;
24mod region_name;
25mod outlives_suggestion;
26
27mod conflict_errors;
28mod move_errors;
29mod mutability_errors;
30mod region_errors;
31mod explain_borrow;
32
33crate use mutability_errors::AccessKind;
34crate use region_name::{RegionName, RegionNameSource, RegionErrorNamingCtx};
35crate use region_errors::{ErrorReportingCtx, ErrorConstraintInfo};
36crate use outlives_suggestion::OutlivesSuggestionBuilder;
37
20pub(super) struct IncludingDowncast(pub(super) bool); 38pub(super) struct IncludingDowncast(pub(super) bool);
21 39
22impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { 40impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs
index fd77976..938836d 100644
--- a/src/librustc_mir/borrow_check/move_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs
@@ -5,7 +5,7 @@ use syntax_pos::Span;
5 5
6use crate::borrow_check::MirBorrowckCtxt; 6use crate::borrow_check::MirBorrowckCtxt;
7use crate::borrow_check::prefixes::PrefixSet; 7use crate::borrow_check::prefixes::PrefixSet;
8use crate::borrow_check::error_reporting::UseSpans; 8use crate::borrow_check::diagnostics::UseSpans;
9use crate::dataflow::move_paths::{ 9use crate::dataflow::move_paths::{
10 IllegalMoveOrigin, IllegalMoveOriginKind, 10 IllegalMoveOrigin, IllegalMoveOriginKind,
11 LookupResult, MoveError, MovePathIndex, 11 LookupResult, MoveError, MovePathIndex,
diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
index 98a7b10..6449ae3 100644
--- a/src/librustc_mir/borrow_check/mutability_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
@@ -8,18 +8,18 @@ use syntax_pos::Span;
8use syntax_pos::symbol::kw; 8use syntax_pos::symbol::kw;
9 9
10use crate::borrow_check::MirBorrowckCtxt; 10use crate::borrow_check::MirBorrowckCtxt;
11use crate::borrow_check::error_reporting::BorrowedContentSource; 11use crate::borrow_check::diagnostics::BorrowedContentSource;
12use crate::util::collect_writes::FindAssignments; 12use crate::util::collect_writes::FindAssignments;
13use rustc_errors::Applicability; 13use rustc_errors::Applicability;
14 14
15#[derive(Copy, Clone, Debug, Eq, PartialEq)] 15#[derive(Copy, Clone, Debug, Eq, PartialEq)]
16pub(super) enum AccessKind { 16pub(crate) enum AccessKind {
17 MutableBorrow, 17 MutableBorrow,
18 Mutate, 18 Mutate,
19} 19}
20 20
21impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { 21impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
22 pub(super) fn report_mutability_error( 22 pub(crate) fn report_mutability_error(
23 &mut self, 23 &mut self,
24 access_place: &Place<'tcx>, 24 access_place: &Place<'tcx>,
25 span: Span, 25 span: Span,
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs b/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs
index 938059c..7aecada 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs
@@ -13,12 +13,10 @@ use syntax_pos::symbol::Symbol;
13 13
14use smallvec::SmallVec; 14use smallvec::SmallVec;
15 15
16use crate::borrow_check::nll::region_infer::{ 16use crate::borrow_check::nll::region_infer::RegionInferenceContext;
17 error_reporting::{ 17
18 region_name::{RegionName, RegionNameSource}, 18use super::{
19 ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx, 19 RegionName, RegionNameSource, ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx,
20 },
21 RegionInferenceContext,
22}; 20};
23 21
24/// The different things we could suggest. 22/// The different things we could suggest.
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
index 5e79a2f..66f0330 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
@@ -19,14 +19,7 @@ use syntax::symbol::kw;
19use syntax_pos::Span; 19use syntax_pos::Span;
20use syntax_pos::symbol::Symbol; 20use syntax_pos::symbol::Symbol;
21 21
22use self::outlives_suggestion::OutlivesSuggestionBuilder; 22use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource, RegionErrorNamingCtx};
23
24pub mod outlives_suggestion;
25
26mod region_name;
27mod var_name;
28
29crate use self::region_name::{RegionName, RegionNameSource, RegionErrorNamingCtx};
30 23
31impl ConstraintDescription for ConstraintCategory { 24impl ConstraintDescription for ConstraintCategory {
32 fn description(&self) -> &'static str { 25 fn description(&self) -> &'static str {
@@ -61,36 +54,36 @@ enum Trace {
61/// Various pieces of state used when reporting borrow checker errors. 54/// Various pieces of state used when reporting borrow checker errors.
62pub struct ErrorReportingCtx<'a, 'b, 'tcx> { 55pub struct ErrorReportingCtx<'a, 'b, 'tcx> {
63 /// The region inference context used for borrow chekcing this MIR body. 56 /// The region inference context used for borrow chekcing this MIR body.
64 region_infcx: &'b RegionInferenceContext<'tcx>, 57 pub(super) region_infcx: &'b RegionInferenceContext<'tcx>,
65 58
66 /// The inference context used for type checking. 59 /// The inference context used for type checking.
67 infcx: &'b InferCtxt<'a, 'tcx>, 60 pub(super) infcx: &'b InferCtxt<'a, 'tcx>,
68 61
69 /// The MIR def we are reporting errors on. 62 /// The MIR def we are reporting errors on.
70 mir_def_id: DefId, 63 pub(super) mir_def_id: DefId,
71 64
72 /// The MIR body we are reporting errors on (for convenience). 65 /// The MIR body we are reporting errors on (for convenience).
73 body: &'b Body<'tcx>, 66 pub(super) body: &'b Body<'tcx>,
74 67
75 /// User variable names for MIR locals (where applicable). 68 /// User variable names for MIR locals (where applicable).
76 local_names: &'b IndexVec<Local, Option<Symbol>>, 69 pub(super) local_names: &'b IndexVec<Local, Option<Symbol>>,
77 70
78 /// Any upvars for the MIR body we have kept track of during borrow checking. 71 /// Any upvars for the MIR body we have kept track of during borrow checking.
79 upvars: &'b [Upvar], 72 pub(super) upvars: &'b [Upvar],
80} 73}
81 74
82/// Information about the various region constraints involved in a borrow checker error. 75/// Information about the various region constraints involved in a borrow checker error.
83#[derive(Clone, Debug)] 76#[derive(Clone, Debug)]
84pub struct ErrorConstraintInfo { 77pub struct ErrorConstraintInfo {
85 // fr: outlived_fr 78 // fr: outlived_fr
86 fr: RegionVid, 79 pub(super) fr: RegionVid,
87 fr_is_local: bool, 80 pub(super) fr_is_local: bool,
88 outlived_fr: RegionVid, 81 pub(super) outlived_fr: RegionVid,
89 outlived_fr_is_local: bool, 82 pub(super) outlived_fr_is_local: bool,
90 83
91 // Category and span for best blame constraint 84 // Category and span for best blame constraint
92 category: ConstraintCategory, 85 pub(super) category: ConstraintCategory,
93 span: Span, 86 pub(super) span: Span,
94} 87}
95 88
96impl<'tcx> RegionInferenceContext<'tcx> { 89impl<'tcx> RegionInferenceContext<'tcx> {
@@ -368,7 +361,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
368 /// ``` 361 /// ```
369 /// 362 ///
370 /// Here we would be invoked with `fr = 'a` and `outlived_fr = `'b`. 363 /// Here we would be invoked with `fr = 'a` and `outlived_fr = `'b`.
371 pub(super) fn report_error<'a>( 364 pub(in crate::borrow_check) fn report_error<'a>(
372 &'a self, 365 &'a self,
373 body: &Body<'tcx>, 366 body: &Body<'tcx>,
374 local_names: &IndexVec<Local, Option<Symbol>>, 367 local_names: &IndexVec<Local, Option<Symbol>>,
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
index 0f5d1c5..e2e7596 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
@@ -1,12 +1,5 @@
1use std::fmt::{self, Display}; 1use std::fmt::{self, Display};
2 2
3use crate::borrow_check::nll::region_infer::{
4 RegionInferenceContext,
5 error_reporting::ErrorReportingCtx,
6};
7use crate::borrow_check::nll::universal_regions::DefiningTy;
8use crate::borrow_check::nll::ToRegionVid;
9use crate::borrow_check::Upvar;
10use rustc::hir; 3use rustc::hir;
11use rustc::hir::def::{Res, DefKind}; 4use rustc::hir::def::{Res, DefKind};
12use rustc::hir::def_id::DefId; 5use rustc::hir::def_id::DefId;
@@ -21,6 +14,15 @@ use syntax::symbol::kw;
21use rustc_data_structures::fx::FxHashMap; 14use rustc_data_structures::fx::FxHashMap;
22use syntax_pos::{Span, symbol::Symbol, DUMMY_SP}; 15use syntax_pos::{Span, symbol::Symbol, DUMMY_SP};
23 16
17use crate::borrow_check::{
18 nll::region_infer::RegionInferenceContext,
19 nll::universal_regions::DefiningTy,
20 nll::ToRegionVid,
21 Upvar,
22};
23
24use super::region_errors::ErrorReportingCtx;
25
24/// A name for a particular region used in emitting diagnostics. This name could be a generated 26/// A name for a particular region used in emitting diagnostics. This name could be a generated
25/// name like `'1`, a name used by the user like `'a`, or a name like `'static`. 27/// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
26#[derive(Debug, Clone)] 28#[derive(Debug, Clone)]
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/diagnostics/var_name.rs
index 1ac44c4..1ac44c4 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/var_name.rs
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index bacff0b..a1932b5 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -46,17 +46,14 @@ use self::flows::Flows;
46use self::location::LocationTable; 46use self::location::LocationTable;
47use self::prefixes::PrefixSet; 47use self::prefixes::PrefixSet;
48use self::MutateMode::{JustWrite, WriteAndRead}; 48use self::MutateMode::{JustWrite, WriteAndRead};
49use self::mutability_errors::AccessKind; 49use self::diagnostics::AccessKind;
50 50
51use self::path_utils::*; 51use self::path_utils::*;
52 52
53crate mod borrow_set; 53crate mod borrow_set;
54mod error_reporting; 54mod diagnostics;
55mod flows; 55mod flows;
56mod location; 56mod location;
57mod conflict_errors;
58mod move_errors;
59mod mutability_errors;
60mod path_utils; 57mod path_utils;
61crate mod place_ext; 58crate mod place_ext;
62crate mod places_conflict; 59crate mod places_conflict;
diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs
index 16182fe..b936320 100644
--- a/src/librustc_mir/borrow_check/nll/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/mod.rs
@@ -32,17 +32,17 @@ use crate::util as mir_util;
32use crate::util::pretty; 32use crate::util::pretty;
33 33
34mod constraint_generation; 34mod constraint_generation;
35pub mod explain_borrow;
36mod facts; 35mod facts;
37mod invalidation; 36mod invalidation;
38crate mod region_infer;
39mod renumber; 37mod renumber;
40crate mod type_check;
41mod universal_regions;
42 38
43mod constraints;
44mod member_constraints; 39mod member_constraints;
45 40
41crate mod constraints;
42crate mod universal_regions;
43crate mod type_check;
44crate mod region_infer;
45
46use self::facts::AllFacts; 46use self::facts::AllFacts;
47use self::region_infer::RegionInferenceContext; 47use self::region_infer::RegionInferenceContext;
48use self::universal_regions::UniversalRegions; 48use self::universal_regions::UniversalRegions;
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
index bd9e97e..85031d6 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
@@ -1,21 +1,5 @@
1use std::rc::Rc; 1use std::rc::Rc;
2 2
3use crate::borrow_check::nll::{
4 constraints::{
5 graph::NormalConstraintGraph,
6 ConstraintSccIndex,
7 OutlivesConstraint,
8 OutlivesConstraintSet,
9 },
10 member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
11 region_infer::values::{
12 PlaceholderIndices, RegionElement, ToElementIndex
13 },
14 region_infer::error_reporting::outlives_suggestion::OutlivesSuggestionBuilder,
15 type_check::{free_region_relations::UniversalRegionRelations, Locations},
16};
17use crate::borrow_check::Upvar;
18
19use rustc::hir::def_id::DefId; 3use rustc::hir::def_id::DefId;
20use rustc::infer::canonical::QueryOutlivesConstraint; 4use rustc::infer::canonical::QueryOutlivesConstraint;
21use rustc::infer::opaque_types; 5use rustc::infer::opaque_types;
@@ -38,13 +22,31 @@ use rustc_errors::{Diagnostic, DiagnosticBuilder};
38use syntax_pos::Span; 22use syntax_pos::Span;
39use syntax_pos::symbol::Symbol; 23use syntax_pos::symbol::Symbol;
40 24
41crate use self::error_reporting::{RegionName, RegionNameSource, RegionErrorNamingCtx}; 25use crate::borrow_check::{
26 nll::{
27 constraints::{
28 graph::NormalConstraintGraph,
29 ConstraintSccIndex,
30 OutlivesConstraint,
31 OutlivesConstraintSet,
32 },
33 member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
34 region_infer::values::{
35 PlaceholderIndices, RegionElement, ToElementIndex
36 },
37 type_check::{free_region_relations::UniversalRegionRelations, Locations},
38 },
39 diagnostics::{
40 OutlivesSuggestionBuilder, RegionErrorNamingCtx,
41 },
42 Upvar,
43};
44
42use self::values::{LivenessValues, RegionValueElements, RegionValues}; 45use self::values::{LivenessValues, RegionValueElements, RegionValues};
43use super::universal_regions::UniversalRegions; 46use super::universal_regions::UniversalRegions;
44use super::ToRegionVid; 47use super::ToRegionVid;
45 48
46mod dump_mir; 49mod dump_mir;
47mod error_reporting;
48mod graphviz; 50mod graphviz;
49 51
50pub mod values; 52pub mod values;
@@ -54,48 +56,51 @@ pub struct RegionInferenceContext<'tcx> {
54 /// variables are identified by their index (`RegionVid`). The 56 /// variables are identified by their index (`RegionVid`). The
55 /// definition contains information about where the region came 57 /// definition contains information about where the region came
56 /// from as well as its final inferred value. 58 /// from as well as its final inferred value.
57 definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>, 59 pub(in crate::borrow_check) definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>,
58 60
59 /// The liveness constraints added to each region. For most 61 /// The liveness constraints added to each region. For most
60 /// regions, these start out empty and steadily grow, though for 62 /// regions, these start out empty and steadily grow, though for
61 /// each universally quantified region R they start out containing 63 /// each universally quantified region R they start out containing
62 /// the entire CFG and `end(R)`. 64 /// the entire CFG and `end(R)`.
63 liveness_constraints: LivenessValues<RegionVid>, 65 pub(in crate::borrow_check) liveness_constraints: LivenessValues<RegionVid>,
64 66
65 /// The outlives constraints computed by the type-check. 67 /// The outlives constraints computed by the type-check.
66 constraints: Rc<OutlivesConstraintSet>, 68 pub(in crate::borrow_check) constraints: Rc<OutlivesConstraintSet>,
67 69
68 /// The constraint-set, but in graph form, making it easy to traverse 70 /// The constraint-set, but in graph form, making it easy to traverse
69 /// the constraints adjacent to a particular region. Used to construct 71 /// the constraints adjacent to a particular region. Used to construct
70 /// the SCC (see `constraint_sccs`) and for error reporting. 72 /// the SCC (see `constraint_sccs`) and for error reporting.
71 constraint_graph: Rc<NormalConstraintGraph>, 73 pub(in crate::borrow_check) constraint_graph: Rc<NormalConstraintGraph>,
72 74
73 /// The SCC computed from `constraints` and the constraint 75 /// The SCC computed from `constraints` and the constraint
74 /// graph. We have an edge from SCC A to SCC B if `A: B`. Used to 76 /// graph. We have an edge from SCC A to SCC B if `A: B`. Used to
75 /// compute the values of each region. 77 /// compute the values of each region.
76 constraint_sccs: Rc<Sccs<RegionVid, ConstraintSccIndex>>, 78 pub(in crate::borrow_check) constraint_sccs: Rc<Sccs<RegionVid, ConstraintSccIndex>>,
77 79
78 /// Reverse of the SCC constraint graph -- i.e., an edge `A -> B` 80 /// Reverse of the SCC constraint graph -- i.e., an edge `A -> B`
79 /// exists if `B: A`. Computed lazilly. 81 /// exists if `B: A`. Computed lazilly.
80 rev_constraint_graph: Option<Rc<VecGraph<ConstraintSccIndex>>>, 82 pub(in crate::borrow_check) rev_constraint_graph:
83 Option<Rc<VecGraph<ConstraintSccIndex>>>,
81 84
82 /// The "R0 member of [R1..Rn]" constraints, indexed by SCC. 85 /// The "R0 member of [R1..Rn]" constraints, indexed by SCC.
83 member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>, 86 pub(in crate::borrow_check) member_constraints:
87 Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>,
84 88
85 /// Records the member constraints that we applied to each scc. 89 /// Records the member constraints that we applied to each scc.
86 /// This is useful for error reporting. Once constraint 90 /// This is useful for error reporting. Once constraint
87 /// propagation is done, this vector is sorted according to 91 /// propagation is done, this vector is sorted according to
88 /// `member_region_scc`. 92 /// `member_region_scc`.
89 member_constraints_applied: Vec<AppliedMemberConstraint>, 93 pub(in crate::borrow_check) member_constraints_applied: Vec<AppliedMemberConstraint>,
90 94
91 /// Map closure bounds to a `Span` that should be used for error reporting. 95 /// Map closure bounds to a `Span` that should be used for error reporting.
92 closure_bounds_mapping: 96 pub(in crate::borrow_check) closure_bounds_mapping:
93 FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>, 97 FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
94 98
95 /// Contains the minimum universe of any variable within the same 99 /// Contains the minimum universe of any variable within the same
96 /// SCC. We will ensure that no SCC contains values that are not 100 /// SCC. We will ensure that no SCC contains values that are not
97 /// visible from this index. 101 /// visible from this index.
98 scc_universes: IndexVec<ConstraintSccIndex, ty::UniverseIndex>, 102 pub(in crate::borrow_check) scc_universes:
103 IndexVec<ConstraintSccIndex, ty::UniverseIndex>,
99 104
100 /// Contains a "representative" from each SCC. This will be the 105 /// Contains a "representative" from each SCC. This will be the
101 /// minimal RegionVid belonging to that universe. It is used as a 106 /// minimal RegionVid belonging to that universe. It is used as a
@@ -104,23 +109,25 @@ pub struct RegionInferenceContext<'tcx> {
104 /// of its SCC and be sure that -- if they have the same repr -- 109 /// of its SCC and be sure that -- if they have the same repr --
105 /// they *must* be equal (though not having the same repr does not 110 /// they *must* be equal (though not having the same repr does not
106 /// mean they are unequal). 111 /// mean they are unequal).
107 scc_representatives: IndexVec<ConstraintSccIndex, ty::RegionVid>, 112 pub(in crate::borrow_check) scc_representatives:
113 IndexVec<ConstraintSccIndex, ty::RegionVid>,
108 114
109 /// The final inferred values of the region variables; we compute 115 /// The final inferred values of the region variables; we compute
110 /// one value per SCC. To get the value for any given *region*, 116 /// one value per SCC. To get the value for any given *region*,
111 /// you first find which scc it is a part of. 117 /// you first find which scc it is a part of.
112 scc_values: RegionValues<ConstraintSccIndex>, 118 pub(in crate::borrow_check) scc_values: RegionValues<ConstraintSccIndex>,
113 119
114 /// Type constraints that we check after solving. 120 /// Type constraints that we check after solving.
115 type_tests: Vec<TypeTest<'tcx>>, 121 pub(in crate::borrow_check) type_tests: Vec<TypeTest<'tcx>>,
116 122
117 /// Information about the universally quantified regions in scope 123 /// Information about the universally quantified regions in scope
118 /// on this function. 124 /// on this function.
119 universal_regions: Rc<UniversalRegions<'tcx>>, 125 pub (in crate::borrow_check) universal_regions: Rc<UniversalRegions<'tcx>>,
120 126
121 /// Information about how the universally quantified regions in 127 /// Information about how the universally quantified regions in
122 /// scope on this function relate to one another. 128 /// scope on this function relate to one another.
123 universal_region_relations: Rc<UniversalRegionRelations<'tcx>>, 129 pub(in crate::borrow_check) universal_region_relations:
130 Rc<UniversalRegionRelations<'tcx>>,
124} 131}
125 132
126/// Each time that `apply_member_constraint` is successful, it appends 133/// Each time that `apply_member_constraint` is successful, it appends
@@ -132,38 +139,38 @@ pub struct RegionInferenceContext<'tcx> {
132/// with `'R: 'O` where `'R` is the pick-region and `'O` is the 139/// with `'R: 'O` where `'R` is the pick-region and `'O` is the
133/// minimal viable option. 140/// minimal viable option.
134#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] 141#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
135struct AppliedMemberConstraint { 142pub(crate) struct AppliedMemberConstraint {
136 /// The SCC that was affected. (The "member region".) 143 /// The SCC that was affected. (The "member region".)
137 /// 144 ///
138 /// The vector if `AppliedMemberConstraint` elements is kept sorted 145 /// The vector if `AppliedMemberConstraint` elements is kept sorted
139 /// by this field. 146 /// by this field.
140 member_region_scc: ConstraintSccIndex, 147 pub(in crate::borrow_check) member_region_scc: ConstraintSccIndex,
141 148
142 /// The "best option" that `apply_member_constraint` found -- this was 149 /// The "best option" that `apply_member_constraint` found -- this was
143 /// added as an "ad-hoc" lower-bound to `member_region_scc`. 150 /// added as an "ad-hoc" lower-bound to `member_region_scc`.
144 min_choice: ty::RegionVid, 151 pub(in crate::borrow_check) min_choice: ty::RegionVid,
145 152
146 /// The "member constraint index" -- we can find out details about 153 /// The "member constraint index" -- we can find out details about
147 /// the constraint from 154 /// the constraint from
148 /// `set.member_constraints[member_constraint_index]`. 155 /// `set.member_constraints[member_constraint_index]`.
149 member_constraint_index: NllMemberConstraintIndex, 156 pub(in crate::borrow_check) member_constraint_index: NllMemberConstraintIndex,
150} 157}
151 158
152struct RegionDefinition<'tcx> { 159pub(crate) struct RegionDefinition<'tcx> {
153 /// What kind of variable is this -- a free region? existential 160 /// What kind of variable is this -- a free region? existential
154 /// variable? etc. (See the `NLLRegionVariableOrigin` for more 161 /// variable? etc. (See the `NLLRegionVariableOrigin` for more
155 /// info.) 162 /// info.)
156 origin: NLLRegionVariableOrigin, 163 pub(in crate::borrow_check) origin: NLLRegionVariableOrigin,
157 164
158 /// Which universe is this region variable defined in? This is 165 /// Which universe is this region variable defined in? This is
159 /// most often `ty::UniverseIndex::ROOT`, but when we encounter 166 /// most often `ty::UniverseIndex::ROOT`, but when we encounter
160 /// forall-quantifiers like `for<'a> { 'a = 'b }`, we would create 167 /// forall-quantifiers like `for<'a> { 'a = 'b }`, we would create
161 /// the variable for `'a` in a fresh universe that extends ROOT. 168 /// the variable for `'a` in a fresh universe that extends ROOT.
162 universe: ty::UniverseIndex, 169 pub(in crate::borrow_check) universe: ty::UniverseIndex,
163 170
164 /// If this is 'static or an early-bound region, then this is 171 /// If this is 'static or an early-bound region, then this is
165 /// `Some(X)` where `X` is the name of the region. 172 /// `Some(X)` where `X` is the name of the region.
166 external_name: Option<ty::Region<'tcx>>, 173 pub(in crate::borrow_check) external_name: Option<ty::Region<'tcx>>,
167} 174}
168 175
169/// N.B., the variants in `Cause` are intentionally ordered. Lower 176/// N.B., the variants in `Cause` are intentionally ordered. Lower
@@ -455,7 +462,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
455 /// Once region solving has completed, this function will return 462 /// Once region solving has completed, this function will return
456 /// the member constraints that were applied to the value of a given 463 /// the member constraints that were applied to the value of a given
457 /// region `r`. See `AppliedMemberConstraint`. 464 /// region `r`. See `AppliedMemberConstraint`.
458 fn applied_member_constraints(&self, r: impl ToRegionVid) -> &[AppliedMemberConstraint] { 465 pub(in crate::borrow_check) fn applied_member_constraints(
466 &self, r: impl ToRegionVid
467 ) -> &[AppliedMemberConstraint] {
459 let scc = self.constraint_sccs.scc(r.to_region_vid()); 468 let scc = self.constraint_sccs.scc(r.to_region_vid());
460 binary_search_util::binary_search_slice( 469 binary_search_util::binary_search_slice(
461 &self.member_constraints_applied, 470 &self.member_constraints_applied,
diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs
index 5b8526c..3777e17 100644
--- a/src/librustc_parse/parser/module.rs
+++ b/src/librustc_parse/parser/module.rs
@@ -211,13 +211,13 @@ impl<'a> Parser<'a> {
211 // `./<id>.rs` and `./<id>/mod.rs`. 211 // `./<id>.rs` and `./<id>/mod.rs`.
212 let relative_prefix_string; 212 let relative_prefix_string;
213 let relative_prefix = if let Some(ident) = relative { 213 let relative_prefix = if let Some(ident) = relative {
214 relative_prefix_string = format!("{}{}", ident, path::MAIN_SEPARATOR); 214 relative_prefix_string = format!("{}{}", ident.name, path::MAIN_SEPARATOR);
215 &relative_prefix_string 215 &relative_prefix_string
216 } else { 216 } else {
217 "" 217 ""
218 }; 218 };
219 219
220 let mod_name = id.to_string(); 220 let mod_name = id.name.to_string();
221 let default_path_str = format!("{}{}.rs", relative_prefix, mod_name); 221 let default_path_str = format!("{}{}.rs", relative_prefix, mod_name);
222 let secondary_path_str = format!("{}{}{}mod.rs", 222 let secondary_path_str = format!("{}{}{}mod.rs",
223 relative_prefix, mod_name, path::MAIN_SEPARATOR); 223 relative_prefix, mod_name, path::MAIN_SEPARATOR);
diff --git a/src/librustc_target/spec/wasm32_base.rs b/src/librustc_target/spec/wasm32_base.rs
index 6f00245..e18a9e6 100644
--- a/src/librustc_target/spec/wasm32_base.rs
+++ b/src/librustc_target/spec/wasm32_base.rs
@@ -140,6 +140,9 @@ pub fn options() -> TargetOptions {
140 has_elf_tls: true, 140 has_elf_tls: true,
141 tls_model: "local-exec".to_string(), 141 tls_model: "local-exec".to_string(),
142 142
143 // gdb scripts don't work on wasm blobs
144 emit_debug_gdb_scripts: false,
145
143 .. Default::default() 146 .. Default::default()
144 } 147 }
145} 148}
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 4331d44..32df6c4 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -65,13 +65,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
65 } 65 }
66 } 66 }
67 67
68 pub fn demand_eqtype_pat( 68 pub fn demand_eqtype_pat_diag(
69 &self, 69 &self,
70 cause_span: Span, 70 cause_span: Span,
71 expected: Ty<'tcx>, 71 expected: Ty<'tcx>,
72 actual: Ty<'tcx>, 72 actual: Ty<'tcx>,
73 match_expr_span: Option<Span>, 73 match_expr_span: Option<Span>,
74 ) { 74 ) -> Option<DiagnosticBuilder<'tcx>> {
75 let cause = if let Some(span) = match_expr_span { 75 let cause = if let Some(span) = match_expr_span {
76 self.cause( 76 self.cause(
77 cause_span, 77 cause_span,
@@ -80,9 +80,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
80 } else { 80 } else {
81 self.misc(cause_span) 81 self.misc(cause_span)
82 }; 82 };
83 self.demand_eqtype_with_origin(&cause, expected, actual).map(|mut err| err.emit()); 83 self.demand_eqtype_with_origin(&cause, expected, actual)
84 } 84 }
85 85
86 pub fn demand_eqtype_pat(
87 &self,
88 cause_span: Span,
89 expected: Ty<'tcx>,
90 actual: Ty<'tcx>,
91 match_expr_span: Option<Span>,
92 ) {
93 self.demand_eqtype_pat_diag(cause_span, expected, actual, match_expr_span)
94 .map(|mut err| err.emit());
95 }
86 96
87 pub fn demand_coerce(&self, 97 pub fn demand_coerce(&self,
88 expr: &hir::Expr, 98 expr: &hir::Expr,
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs
index 4766360..5bfc60c 100644
--- a/src/librustc_typeck/check/expr.rs
+++ b/src/librustc_typeck/check/expr.rs
@@ -582,11 +582,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
582 // If this is a break with a value, we need to type-check 582 // If this is a break with a value, we need to type-check
583 // the expression. Get an expected type from the loop context. 583 // the expression. Get an expected type from the loop context.
584 let opt_coerce_to = { 584 let opt_coerce_to = {
585 // We should release `enclosing_breakables` before the `check_expr_with_hint`
586 // below, so can't move this block of code to the enclosing scope and share
587 // `ctxt` with the second `encloding_breakables` borrow below.
585 let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); 588 let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
586 enclosing_breakables.find_breakable(target_id) 589 match enclosing_breakables.opt_find_breakable(target_id) {
587 .coerce 590 Some(ctxt) =>
588 .as_ref() 591 ctxt.coerce.as_ref().map(|coerce| coerce.expected_ty()),
589 .map(|coerce| coerce.expected_ty()) 592 None => { // Avoid ICE when `break` is inside a closure (#65383).
593 self.tcx.sess.delay_span_bug(
594 expr.span,
595 "break was outside loop, but no error was emitted",
596 );
597 return tcx.types.err;
598 }
599 }
590 }; 600 };
591 601
592 // If the loop context is not a `loop { }`, then break with 602 // If the loop context is not a `loop { }`, then break with
diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs
index 9dd3bc6..71d1cd8 100644
--- a/src/librustc_typeck/check/pat.rs
+++ b/src/librustc_typeck/check/pat.rs
@@ -703,7 +703,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
703 let pat_ty = pat_ty.fn_sig(tcx).output(); 703 let pat_ty = pat_ty.fn_sig(tcx).output();
704 let pat_ty = pat_ty.no_bound_vars().expect("expected fn type"); 704 let pat_ty = pat_ty.no_bound_vars().expect("expected fn type");
705 705
706 self.demand_eqtype_pat(pat.span, expected, pat_ty, match_arm_pat_span); 706 // Type-check the tuple struct pattern against the expected type.
707 let diag = self.demand_eqtype_pat_diag(pat.span, expected, pat_ty, match_arm_pat_span);
708 let had_err = diag.is_some();
709 diag.map(|mut err| err.emit());
707 710
708 // Type-check subpatterns. 711 // Type-check subpatterns.
709 if subpats.len() == variant.fields.len() 712 if subpats.len() == variant.fields.len()
@@ -721,7 +724,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
721 } 724 }
722 } else { 725 } else {
723 // Pattern has wrong number of fields. 726 // Pattern has wrong number of fields.
724 self.e0023(pat.span, res, qpath, subpats, &variant.fields, expected); 727 self.e0023(pat.span, res, qpath, subpats, &variant.fields, expected, had_err);
725 on_error(); 728 on_error();
726 return tcx.types.err; 729 return tcx.types.err;
727 } 730 }
@@ -734,8 +737,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
734 res: Res, 737 res: Res,
735 qpath: &hir::QPath, 738 qpath: &hir::QPath,
736 subpats: &'tcx [P<Pat>], 739 subpats: &'tcx [P<Pat>],
737 fields: &[ty::FieldDef], 740 fields: &'tcx [ty::FieldDef],
738 expected: Ty<'tcx> 741 expected: Ty<'tcx>,
742 had_err: bool,
739 ) { 743 ) {
740 let subpats_ending = pluralize!(subpats.len()); 744 let subpats_ending = pluralize!(subpats.len());
741 let fields_ending = pluralize!(fields.len()); 745 let fields_ending = pluralize!(fields.len());
@@ -763,9 +767,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
763 // More generally, the expected type wants a tuple variant with one field of an 767 // More generally, the expected type wants a tuple variant with one field of an
764 // N-arity-tuple, e.g., `V_i((p_0, .., p_N))`. Meanwhile, the user supplied a pattern 768 // N-arity-tuple, e.g., `V_i((p_0, .., p_N))`. Meanwhile, the user supplied a pattern
765 // with the subpatterns directly in the tuple variant pattern, e.g., `V_i(p_0, .., p_N)`. 769 // with the subpatterns directly in the tuple variant pattern, e.g., `V_i(p_0, .., p_N)`.
766 let missing_parenthesis = match expected.kind { 770 let missing_parenthesis = match (&expected.kind, fields, had_err) {
767 ty::Adt(_, substs) if fields.len() == 1 => { 771 // #67037: only do this if we could sucessfully type-check the expected type against
768 let field_ty = fields[0].ty(self.tcx, substs); 772 // the tuple struct pattern. Otherwise the substs could get out of range on e.g.,
773 // `let P() = U;` where `P != U` with `struct P<T>(T);`.
774 (ty::Adt(_, substs), [field], false) => {
775 let field_ty = self.field_ty(pat_span, field, substs);
769 match field_ty.kind { 776 match field_ty.kind {
770 ty::Tuple(_) => field_ty.tuple_fields().count() == subpats.len(), 777 ty::Tuple(_) => field_ty.tuple_fields().count() == subpats.len(),
771 _ => false, 778 _ => false,
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 2af6671..c68e03b 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -869,12 +869,18 @@ impl Hash for Ident {
869 869
870impl fmt::Debug for Ident { 870impl fmt::Debug for Ident {
871 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 871 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
872 if self.is_raw_guess() {
873 write!(f, "r#")?;
874 }
872 write!(f, "{}{:?}", self.name, self.span.ctxt()) 875 write!(f, "{}{:?}", self.name, self.span.ctxt())
873 } 876 }
874} 877}
875 878
876impl fmt::Display for Ident { 879impl fmt::Display for Ident {
877 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 880 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
881 if self.is_raw_guess() {
882 write!(f, "r#")?;
883 }
878 fmt::Display::fmt(&self.name, f) 884 fmt::Display::fmt(&self.name, f)
879 } 885 }
880} 886}
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 1cb123e..6698e5d 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -658,46 +658,11 @@ public:
658 } 658 }
659}; 659};
660 660
661class RustPrintModulePass : public ModulePass {
662 raw_ostream* OS;
663 DemangleFn Demangle;
664public:
665 static char ID;
666 RustPrintModulePass() : ModulePass(ID), OS(nullptr), Demangle(nullptr) {}
667 RustPrintModulePass(raw_ostream &OS, DemangleFn Demangle)
668 : ModulePass(ID), OS(&OS), Demangle(Demangle) {}
669
670 bool runOnModule(Module &M) override {
671 RustAssemblyAnnotationWriter AW(Demangle);
672
673 M.print(*OS, &AW, false);
674
675 return false;
676 }
677
678 void getAnalysisUsage(AnalysisUsage &AU) const override {
679 AU.setPreservesAll();
680 }
681
682 static StringRef name() { return "RustPrintModulePass"; }
683};
684
685} // namespace 661} // namespace
686 662
687namespace llvm {
688 void initializeRustPrintModulePassPass(PassRegistry&);
689}
690
691char RustPrintModulePass::ID = 0;
692INITIALIZE_PASS(RustPrintModulePass, "print-rust-module",
693 "Print rust module to stderr", false, false)
694
695extern "C" LLVMRustResult 663extern "C" LLVMRustResult
696LLVMRustPrintModule(LLVMPassManagerRef PMR, LLVMModuleRef M, 664LLVMRustPrintModule(LLVMModuleRef M, const char *Path, DemangleFn Demangle) {
697 const char *Path, DemangleFn Demangle) {
698 llvm::legacy::PassManager *PM = unwrap<llvm::legacy::PassManager>(PMR);
699 std::string ErrorInfo; 665 std::string ErrorInfo;
700
701 std::error_code EC; 666 std::error_code EC;
702 raw_fd_ostream OS(Path, EC, sys::fs::F_None); 667 raw_fd_ostream OS(Path, EC, sys::fs::F_None);
703 if (EC) 668 if (EC)
@@ -707,11 +672,9 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR, LLVMModuleRef M,
707 return LLVMRustResult::Failure; 672 return LLVMRustResult::Failure;
708 } 673 }
709 674
675 RustAssemblyAnnotationWriter AAW(Demangle);
710 formatted_raw_ostream FOS(OS); 676 formatted_raw_ostream FOS(OS);
711 677 unwrap(M)->print(FOS, &AAW);
712 PM->add(new RustPrintModulePass(FOS, Demangle));
713
714 PM->run(*unwrap(M));
715 678
716 return LLVMRustResult::Success; 679 return LLVMRustResult::Success;
717} 680}
diff --git a/src/test/codegen/gdb_debug_script_load.rs b/src/test/codegen/gdb_debug_script_load.rs
index 2e8dc7b..178269f 100644
--- a/src/test/codegen/gdb_debug_script_load.rs
+++ b/src/test/codegen/gdb_debug_script_load.rs
@@ -1,6 +1,8 @@
1// ignore-tidy-linelength 1// ignore-tidy-linelength
2// ignore-windows 2// ignore-windows
3// ignore-macos 3// ignore-macos
4// ignore-wasm
5// ignore-emscripten
4 6
5// compile-flags: -g -C no-prepopulate-passes 7// compile-flags: -g -C no-prepopulate-passes
6 8
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
index 627609c..3e39c8a 100644
--- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
@@ -9,13 +9,21 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { 10LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
11 | ^^ 11 | ^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected Type<'_> 13 --> $DIR/project-fn-ret-invariant.rs:48:13
14 found Type<'a> 14 |
15LL | bar(foo, x)
16 | ^
17 = note: expected `Type<'_>`
18 found `Type<'a>`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16 = note: ...so that the expression is assignable: 20note: ...so that the expression is assignable
17 expected Type<'static> 21 --> $DIR/project-fn-ret-invariant.rs:48:4
18 found Type<'_> 22 |
23LL | bar(foo, x)
24 | ^^^^^^^^^^^
25 = note: expected `Type<'static>`
26 found `Type<'_>`
19 27
20error: aborting due to previous error 28error: aborting due to previous error
21 29
diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr
index c80ed5e..cd4cd8b 100644
--- a/src/test/ui/c-variadic/variadic-ffi-4.stderr
+++ b/src/test/ui/c-variadic/variadic-ffi-4.stderr
@@ -49,9 +49,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
49 | 49 |
50LL | let _ = ap.with_copy(|ap| { ap }); 50LL | let _ = ap.with_copy(|ap| { ap });
51 | ^^^^^^^^^^^ 51 | ^^^^^^^^^^^
52 = note: ...so that the expression is assignable: 52note: ...so that the expression is assignable
53 expected core::ffi::VaList<'_, '_> 53 --> $DIR/variadic-ffi-4.rs:16:33
54 found core::ffi::VaList<'_, '_> 54 |
55LL | let _ = ap.with_copy(|ap| { ap });
56 | ^^
57 = note: expected `core::ffi::VaList<'_, '_>`
58 found `core::ffi::VaList<'_, '_>`
55note: but, the lifetime must be valid for the method call at 16:13... 59note: but, the lifetime must be valid for the method call at 16:13...
56 --> $DIR/variadic-ffi-4.rs:16:13 60 --> $DIR/variadic-ffi-4.rs:16:13
57 | 61 |
diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr
index 5e80c67..3300293 100644
--- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr
+++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr
@@ -9,13 +9,21 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) { 10LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
11 | ^^ 11 | ^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected std::boxed::Box<dyn std::fmt::Debug> 13 --> $DIR/dyn-trait.rs:20:16
14 found std::boxed::Box<(dyn std::fmt::Debug + 'a)> 14 |
15LL | static_val(x);
16 | ^
17 = note: expected `std::boxed::Box<dyn std::fmt::Debug>`
18 found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16 = note: ...so that the types are compatible: 20note: ...so that the types are compatible
17 expected StaticTrait 21 --> $DIR/dyn-trait.rs:20:5
18 found StaticTrait 22 |
23LL | static_val(x);
24 | ^^^^^^^^^^
25 = note: expected `StaticTrait`
26 found `StaticTrait`
19 27
20error: aborting due to previous error 28error: aborting due to previous error
21 29
diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr
index b663e21..99700f2 100644
--- a/src/test/ui/issues/issue-16683.stderr
+++ b/src/test/ui/issues/issue-16683.stderr
@@ -21,9 +21,13 @@ note: but, the lifetime must be valid for the lifetime `'a` as defined on the tr
21 | 21 |
22LL | trait T<'a> { 22LL | trait T<'a> {
23 | ^^ 23 | ^^
24 = note: ...so that the types are compatible: 24note: ...so that the types are compatible
25 expected &'a Self 25 --> $DIR/issue-16683.rs:4:14
26 found &Self 26 |
27LL | self.a();
28 | ^
29 = note: expected `&'a Self`
30 found `&Self`
27 31
28error: aborting due to previous error 32error: aborting due to previous error
29 33
diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr
index adcbb62..adfc3f508 100644
--- a/src/test/ui/issues/issue-17758.stderr
+++ b/src/test/ui/issues/issue-17758.stderr
@@ -22,9 +22,13 @@ note: but, the lifetime must be valid for the lifetime `'a` as defined on the tr
22 | 22 |
23LL | trait Foo<'a> { 23LL | trait Foo<'a> {
24 | ^^ 24 | ^^
25 = note: ...so that the types are compatible: 25note: ...so that the types are compatible
26 expected &'a Self 26 --> $DIR/issue-17758.rs:7:14
27 found &Self 27 |
28LL | self.foo();
29 | ^^^
30 = note: expected `&'a Self`
31 found `&Self`
28 32
29error: aborting due to previous error 33error: aborting due to previous error
30 34
diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr
index 13c9c09..c7fd134 100644
--- a/src/test/ui/issues/issue-20831-debruijn.stderr
+++ b/src/test/ui/issues/issue-20831-debruijn.stderr
@@ -88,9 +88,19 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on
88 | 88 |
89LL | impl<'a> Publisher<'a> for MyStruct<'a> { 89LL | impl<'a> Publisher<'a> for MyStruct<'a> {
90 | ^^ 90 | ^^
91 = note: ...so that the types are compatible: 91note: ...so that the types are compatible
92 expected Publisher<'_> 92 --> $DIR/issue-20831-debruijn.rs:28:5
93 found Publisher<'_> 93 |
94LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
95LL | | // Not obvious, but there is an implicit lifetime here -------^
96LL | |
97LL | |
98... |
99LL | | self.sub = t;
100LL | | }
101 | |_____^
102 = note: expected `Publisher<'_>`
103 found `Publisher<'_>`
94 104
95error: aborting due to 3 previous errors 105error: aborting due to 3 previous errors
96 106
diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr
index b79a5dd..a8960f7 100644
--- a/src/test/ui/issues/issue-52213.stderr
+++ b/src/test/ui/issues/issue-52213.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { 10LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
11 | ^^ 11 | ^^
12 = note: ...so that the types are compatible: 12note: ...so that the types are compatible
13 expected (&&(T,),) 13 --> $DIR/issue-52213.rs:2:11
14 found (&&'a (T,),) 14 |
15LL | match (&t,) {
16 | ^^^^^
17 = note: expected `(&&(T,),)`
18 found `(&&'a (T,),)`
15note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27... 19note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27...
16 --> $DIR/issue-52213.rs:1:27 20 --> $DIR/issue-52213.rs:1:27
17 | 21 |
diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr
index 7b910f5..b8cafdc 100644
--- a/src/test/ui/issues/issue-55796.stderr
+++ b/src/test/ui/issues/issue-55796.stderr
@@ -15,9 +15,13 @@ note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closu
15LL | Box::new(self.out_edges(u).map(|e| e.target())) 15LL | Box::new(self.out_edges(u).map(|e| e.target()))
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 = note: but, the lifetime must be valid for the static lifetime... 17 = note: but, the lifetime must be valid for the static lifetime...
18 = note: ...so that the expression is assignable: 18note: ...so that the expression is assignable
19 expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)> 19 --> $DIR/issue-55796.rs:16:9
20 found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>> 20 |
21LL | Box::new(self.out_edges(u).map(|e| e.target()))
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
24 found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
21 25
22error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements 26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
23 --> $DIR/issue-55796.rs:21:9 27 --> $DIR/issue-55796.rs:21:9
@@ -36,9 +40,13 @@ note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closu
36LL | Box::new(self.in_edges(u).map(|e| e.target())) 40LL | Box::new(self.in_edges(u).map(|e| e.target()))
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 = note: but, the lifetime must be valid for the static lifetime... 42 = note: but, the lifetime must be valid for the static lifetime...
39 = note: ...so that the expression is assignable: 43note: ...so that the expression is assignable
40 expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)> 44 --> $DIR/issue-55796.rs:21:9
41 found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>> 45 |
46LL | Box::new(self.in_edges(u).map(|e| e.target()))
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>`
49 found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>`
42 50
43error: aborting due to 2 previous errors 51error: aborting due to 2 previous errors
44 52
diff --git a/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs b/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs
new file mode 100644
index 0000000..b928510
--- /dev/null
+++ b/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs
@@ -0,0 +1,22 @@
1#![allow(non_camel_case_types)]
2
3trait r#async {
4 fn r#struct(&self) {
5 println!("async");
6 }
7}
8
9trait r#await {
10 fn r#struct(&self) {
11 println!("await");
12 }
13}
14
15struct r#fn {}
16
17impl r#async for r#fn {}
18impl r#await for r#fn {}
19
20fn main() {
21 r#fn {}.r#struct(); //~ ERROR multiple applicable items in scope
22}
diff --git a/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr
new file mode 100644
index 0000000..c7bb653
--- /dev/null
+++ b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr
@@ -0,0 +1,22 @@
1error[E0034]: multiple applicable items in scope
2 --> $DIR/issue-65634-raw-ident-suggestion.rs:21:13
3 |
4LL | r#fn {}.r#struct();
5 | ^^^^^^^^ multiple `r#struct` found
6 |
7note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn`
8 --> $DIR/issue-65634-raw-ident-suggestion.rs:4:5
9 |
10LL | fn r#struct(&self) {
11 | ^^^^^^^^^^^^^^^^^^
12 = help: to disambiguate the method call, write `async::r#struct(r#fn {})` instead
13note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn`
14 --> $DIR/issue-65634-raw-ident-suggestion.rs:10:5
15 |
16LL | fn r#struct(&self) {
17 | ^^^^^^^^^^^^^^^^^^
18 = help: to disambiguate the method call, write `await::r#struct(r#fn {})` instead
19
20error: aborting due to previous error
21
22For more information about this error, try `rustc --explain E0034`.
diff --git a/src/test/ui/issues/issue-66702-break-outside-loop-val.rs b/src/test/ui/issues/issue-66702-break-outside-loop-val.rs
new file mode 100644
index 0000000..bd3c00d
--- /dev/null
+++ b/src/test/ui/issues/issue-66702-break-outside-loop-val.rs
@@ -0,0 +1,7 @@
1// Breaks with values inside closures used to ICE (#66863)
2
3fn main() {
4 'some_label: loop {
5 || break 'some_label (); //~ ERROR: `break` inside of a closure
6 }
7}
diff --git a/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr b/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr
new file mode 100644
index 0000000..83bde97
--- /dev/null
+++ b/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr
@@ -0,0 +1,11 @@
1error[E0267]: `break` inside of a closure
2 --> $DIR/issue-66702-break-outside-loop-val.rs:5:12
3 |
4LL | || break 'some_label ();
5 | -- ^^^^^^^^^^^^^^^^^^^^ cannot `break` inside of a closure
6 | |
7 | enclosing closure
8
9error: aborting due to previous error
10
11For more information about this error, try `rustc --explain E0267`.
diff --git a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs
new file mode 100644
index 0000000..44bd645
--- /dev/null
+++ b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs
@@ -0,0 +1,21 @@
1// Regression test for #67037.
2//
3// In type checking patterns, E0023 occurs when the tuple pattern and the expected
4// tuple pattern have different number of fields. For example, as below, `P()`,
5// the tuple struct pattern, has 0 fields, but requires 1 field.
6//
7// In emitting E0023, we try to see if this is a case of e.g., `Some(a, b, c)` but where
8// the scrutinee was of type `Some((a, b, c))`, and suggest that parenthesis be added.
9//
10// However, we did not account for the expected type being different than the tuple pattern type.
11// This caused an issue when the tuple pattern type (`P<T>`) was generic.
12// Specifically, we tried deriving the 0th field's type using the `substs` of the expected type.
13// When attempting to substitute `T`, there was no such substitution, so "out of range" occured.
14
15struct U {} // 0 type parameters offered
16struct P<T>(T); // 1 type parameter wanted
17
18fn main() {
19 let P() = U {}; //~ ERROR mismatched types
20 //~^ ERROR this pattern has 0 fields, but the corresponding tuple struct has 1 field
21}
diff --git a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
new file mode 100644
index 0000000..521dd02
--- /dev/null
+++ b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
@@ -0,0 +1,22 @@
1error[E0308]: mismatched types
2 --> $DIR/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs:19:9
3 |
4LL | let P() = U {};
5 | ^^^ expected struct `U`, found struct `P`
6 |
7 = note: expected struct `U`
8 found struct `P<_>`
9
10error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 1 field
11 --> $DIR/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs:19:9
12 |
13LL | struct P<T>(T); // 1 type parameter wanted
14 | --------------- tuple struct defined here
15...
16LL | let P() = U {};
17 | ^^^ expected 1 field, found 0
18
19error: aborting due to 2 previous errors
20
21Some errors have detailed explanations: E0023, E0308.
22For more information about an error, try `rustc --explain E0023`.
diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr
index 714a63b..69a6ab0 100644
--- a/src/test/ui/nll/issue-55394.stderr
+++ b/src/test/ui/nll/issue-55394.stderr
@@ -21,9 +21,13 @@ note: but, the lifetime must be valid for the lifetime `'_` as defined on the im
21 | 21 |
22LL | impl Foo<'_> { 22LL | impl Foo<'_> {
23 | ^^ 23 | ^^
24 = note: ...so that the expression is assignable: 24note: ...so that the expression is assignable
25 expected Foo<'_> 25 --> $DIR/issue-55394.rs:9:9
26 found Foo<'_> 26 |
27LL | Foo { bar }
28 | ^^^^^^^^^^^
29 = note: expected `Foo<'_>`
30 found `Foo<'_>`
27 31
28error: aborting due to previous error 32error: aborting due to previous error
29 33
diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr
index 3a152fb..58f2067 100644
--- a/src/test/ui/nll/normalization-bounds-error.stderr
+++ b/src/test/ui/nll/normalization-bounds-error.stderr
@@ -14,9 +14,13 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on
14 | 14 |
15LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} 15LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
16 | ^^ 16 | ^^
17 = note: ...so that the types are compatible: 17note: ...so that the types are compatible
18 expected Visitor<'d> 18 --> $DIR/normalization-bounds-error.rs:12:1
19 found Visitor<'_> 19 |
20LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 = note: expected `Visitor<'d>`
23 found `Visitor<'_>`
20 24
21error: aborting due to previous error 25error: aborting due to previous error
22 26
diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr
index 6986389..5191dec 100644
--- a/src/test/ui/nll/type-alias-free-regions.stderr
+++ b/src/test/ui/nll/type-alias-free-regions.stderr
@@ -11,17 +11,25 @@ LL | / fn from_box(b: Box<B>) -> Self {
11LL | | C { f: b } 11LL | | C { f: b }
12LL | | } 12LL | | }
13 | |_____^ 13 | |_____^
14 = note: ...so that the expression is assignable: 14note: ...so that the expression is assignable
15 expected std::boxed::Box<std::boxed::Box<&isize>> 15 --> $DIR/type-alias-free-regions.rs:17:16
16 found std::boxed::Box<std::boxed::Box<&isize>> 16 |
17LL | C { f: b }
18 | ^
19 = note: expected `std::boxed::Box<std::boxed::Box<&isize>>`
20 found `std::boxed::Box<std::boxed::Box<&isize>>`
17note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6... 21note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6...
18 --> $DIR/type-alias-free-regions.rs:15:6 22 --> $DIR/type-alias-free-regions.rs:15:6
19 | 23 |
20LL | impl<'a> FromBox<'a> for C<'a> { 24LL | impl<'a> FromBox<'a> for C<'a> {
21 | ^^ 25 | ^^
22 = note: ...so that the expression is assignable: 26note: ...so that the expression is assignable
23 expected C<'a> 27 --> $DIR/type-alias-free-regions.rs:17:9
24 found C<'_> 28 |
29LL | C { f: b }
30 | ^^^^^^^^^^
31 = note: expected `C<'a>`
32 found `C<'_>`
25 33
26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements 34error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
27 --> $DIR/type-alias-free-regions.rs:27:16 35 --> $DIR/type-alias-free-regions.rs:27:16
@@ -36,17 +44,25 @@ LL | / fn from_tuple(b: (B,)) -> Self {
36LL | | C { f: Box::new(b.0) } 44LL | | C { f: Box::new(b.0) }
37LL | | } 45LL | | }
38 | |_____^ 46 | |_____^
39 = note: ...so that the expression is assignable: 47note: ...so that the expression is assignable
40 expected std::boxed::Box<&isize> 48 --> $DIR/type-alias-free-regions.rs:27:25
41 found std::boxed::Box<&isize> 49 |
50LL | C { f: Box::new(b.0) }
51 | ^^^
52 = note: expected `std::boxed::Box<&isize>`
53 found `std::boxed::Box<&isize>`
42note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6... 54note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6...
43 --> $DIR/type-alias-free-regions.rs:25:6 55 --> $DIR/type-alias-free-regions.rs:25:6
44 | 56 |
45LL | impl<'a> FromTuple<'a> for C<'a> { 57LL | impl<'a> FromTuple<'a> for C<'a> {
46 | ^^ 58 | ^^
47 = note: ...so that the expression is assignable: 59note: ...so that the expression is assignable
48 expected C<'a> 60 --> $DIR/type-alias-free-regions.rs:27:9
49 found C<'_> 61 |
62LL | C { f: Box::new(b.0) }
63 | ^^^^^^^^^^^^^^^^^^^^^^
64 = note: expected `C<'a>`
65 found `C<'_>`
50 66
51error: aborting due to 2 previous errors 67error: aborting due to 2 previous errors
52 68
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr
index 4ebd991..37be450 100644
--- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr
+++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn foo<'a>(_: &'a u32) -> &'static u32 { 10LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
11 | ^^ 11 | ^^
12 = note: ...so that the types are compatible: 12note: ...so that the types are compatible
13 expected Foo<'_> 13 --> $DIR/constant-in-expr-inherent-1.rs:8:5
14 found Foo<'a> 14 |
15LL | <Foo<'a>>::C
16 | ^^^^^^^^^^^^
17 = note: expected `Foo<'_>`
18 found `Foo<'a>`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16note: ...so that reference does not outlive borrowed content 20note: ...so that reference does not outlive borrowed content
17 --> $DIR/constant-in-expr-inherent-1.rs:8:5 21 --> $DIR/constant-in-expr-inherent-1.rs:8:5
diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr
index d61659e..4ee3284 100644
--- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr
+++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { 10LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
11 | ^^ 11 | ^^
12 = note: ...so that the types are compatible: 12note: ...so that the types are compatible
13 expected Foo<'_> 13 --> $DIR/constant-in-expr-trait-item-3.rs:10:5
14 found Foo<'a> 14 |
15LL | T::C
16 | ^^^^
17 = note: expected `Foo<'_>`
18 found `Foo<'a>`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16note: ...so that reference does not outlive borrowed content 20note: ...so that reference does not outlive borrowed content
17 --> $DIR/constant-in-expr-trait-item-3.rs:10:5 21 --> $DIR/constant-in-expr-trait-item-3.rs:10:5
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
index d66322c..1952ee8 100644
--- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
+++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
@@ -19,9 +19,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu
19 | 19 |
20LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { 20LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
21 | ^^ 21 | ^^
22 = note: ...so that the expression is assignable: 22note: ...so that the expression is assignable
23 expected &'b (dyn SomeTrait + 'b) 23 --> $DIR/object-lifetime-default-elision.rs:71:5
24 found &dyn SomeTrait 24 |
25LL | ss
26 | ^^
27 = note: expected `&'b (dyn SomeTrait + 'b)`
28 found `&dyn SomeTrait`
25 29
26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements 30error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
27 --> $DIR/object-lifetime-default-elision.rs:71:5 31 --> $DIR/object-lifetime-default-elision.rs:71:5
@@ -44,9 +48,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu
44 | 48 |
45LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { 49LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
46 | ^^ 50 | ^^
47 = note: ...so that the expression is assignable: 51note: ...so that the expression is assignable
48 expected &'b (dyn SomeTrait + 'b) 52 --> $DIR/object-lifetime-default-elision.rs:71:5
49 found &dyn SomeTrait 53 |
54LL | ss
55 | ^^
56 = note: expected `&'b (dyn SomeTrait + 'b)`
57 found `&dyn SomeTrait`
50 58
51error: aborting due to 2 previous errors 59error: aborting due to 2 previous errors
52 60
diff --git a/src/test/ui/parser/raw/raw-literal-keywords.rs b/src/test/ui/parser/raw/raw-literal-keywords.rs
index bf9cbcd..a986980 100644
--- a/src/test/ui/parser/raw/raw-literal-keywords.rs
+++ b/src/test/ui/parser/raw/raw-literal-keywords.rs
@@ -11,11 +11,11 @@ fn test_union() {
11} 11}
12 12
13fn test_if_2() { 13fn test_if_2() {
14 let _ = r#if; //~ ERROR cannot find value `if` in this scope 14 let _ = r#if; //~ ERROR cannot find value `r#if` in this scope
15} 15}
16 16
17fn test_struct_2() { 17fn test_struct_2() {
18 let _ = r#struct; //~ ERROR cannot find value `struct` in this scope 18 let _ = r#struct; //~ ERROR cannot find value `r#struct` in this scope
19} 19}
20 20
21fn test_union_2() { 21fn test_union_2() {
diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr
index fd8eda3..f7b6c89 100644
--- a/src/test/ui/parser/raw/raw-literal-keywords.stderr
+++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr
@@ -16,13 +16,13 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
16LL | r#union Test; 16LL | r#union Test;
17 | ^^^^ expected one of 8 possible tokens 17 | ^^^^ expected one of 8 possible tokens
18 18
19error[E0425]: cannot find value `if` in this scope 19error[E0425]: cannot find value `r#if` in this scope
20 --> $DIR/raw-literal-keywords.rs:14:13 20 --> $DIR/raw-literal-keywords.rs:14:13
21 | 21 |
22LL | let _ = r#if; 22LL | let _ = r#if;
23 | ^^^^ not found in this scope 23 | ^^^^ not found in this scope
24 24
25error[E0425]: cannot find value `struct` in this scope 25error[E0425]: cannot find value `r#struct` in this scope
26 --> $DIR/raw-literal-keywords.rs:18:13 26 --> $DIR/raw-literal-keywords.rs:18:13
27 | 27 |
28LL | let _ = r#struct; 28LL | let _ = r#struct;
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
index 14934d6..e889651 100644
--- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
@@ -34,17 +34,25 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
34 | 34 |
35LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { 35LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
36 | ^^ 36 | ^^
37 = note: ...so that the expression is assignable: 37note: ...so that the expression is assignable
38 expected &[u8] 38 --> $DIR/region-object-lifetime-in-coercion.rs:26:14
39 found &'a [u8] 39 |
40LL | Box::new(v)
41 | ^
42 = note: expected `&[u8]`
43 found `&'a [u8]`
40note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9... 44note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
41 --> $DIR/region-object-lifetime-in-coercion.rs:25:9 45 --> $DIR/region-object-lifetime-in-coercion.rs:25:9
42 | 46 |
43LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { 47LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
44 | ^^ 48 | ^^
45 = note: ...so that the expression is assignable: 49note: ...so that the expression is assignable
46 expected std::boxed::Box<(dyn Foo + 'b)> 50 --> $DIR/region-object-lifetime-in-coercion.rs:26:5
47 found std::boxed::Box<dyn Foo> 51 |
52LL | Box::new(v)
53 | ^^^^^^^^^^^
54 = note: expected `std::boxed::Box<(dyn Foo + 'b)>`
55 found `std::boxed::Box<dyn Foo>`
48 56
49error: aborting due to 4 previous errors 57error: aborting due to 4 previous errors
50 58
diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr
index a636c9e..865e967 100644
--- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr
+++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp
9 | 9 |
10LL | impl<'a> Foo<'static> for &'a i32 { 10LL | impl<'a> Foo<'static> for &'a i32 {
11 | ^^ 11 | ^^
12 = note: ...so that the types are compatible: 12note: ...so that the types are compatible
13 expected Foo<'static> 13 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10
14 found Foo<'static> 14 |
15LL | impl<'a> Foo<'static> for &'a i32 {
16 | ^^^^^^^^^^^^
17 = note: expected `Foo<'static>`
18 found `Foo<'static>`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16note: ...so that the type `&i32` will meet its required lifetime bounds 20note: ...so that the type `&i32` will meet its required lifetime bounds
17 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10 21 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10
@@ -30,9 +34,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp
30 | 34 |
31LL | impl<'a,'b> Foo<'b> for &'a i64 { 35LL | impl<'a,'b> Foo<'b> for &'a i64 {
32 | ^^ 36 | ^^
33 = note: ...so that the types are compatible: 37note: ...so that the types are compatible
34 expected Foo<'b> 38 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:13
35 found Foo<'_> 39 |
40LL | impl<'a,'b> Foo<'b> for &'a i64 {
41 | ^^^^^^^
42 = note: expected `Foo<'b>`
43 found `Foo<'_>`
36note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9... 44note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9...
37 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9 45 --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9
38 | 46 |
diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr
index 81256e3..6a34871 100644
--- a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr
+++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp
9 | 9 |
10LL | impl<'a> Foo for &'a i32 { 10LL | impl<'a> Foo for &'a i32 {
11 | ^^ 11 | ^^
12 = note: ...so that the types are compatible: 12note: ...so that the types are compatible
13 expected Foo 13 --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10
14 found Foo 14 |
15LL | impl<'a> Foo for &'a i32 {
16 | ^^^
17 = note: expected `Foo`
18 found `Foo`
15 = note: but, the lifetime must be valid for the static lifetime... 19 = note: but, the lifetime must be valid for the static lifetime...
16note: ...so that the type `&i32` will meet its required lifetime bounds 20note: ...so that the type `&i32` will meet its required lifetime bounds
17 --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10 21 --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr
index 8e473da..28873ab 100644
--- a/src/test/ui/regions/regions-close-object-into-object-2.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr
@@ -15,9 +15,13 @@ note: ...so that the type `(dyn A<T> + 'a)` is not borrowed for too long
15LL | box B(&*v) as Box<dyn X> 15LL | box B(&*v) as Box<dyn X>
16 | ^^^ 16 | ^^^
17 = note: but, the lifetime must be valid for the static lifetime... 17 = note: but, the lifetime must be valid for the static lifetime...
18 = note: ...so that the expression is assignable: 18note: ...so that the expression is assignable
19 expected std::boxed::Box<(dyn X + 'static)> 19 --> $DIR/regions-close-object-into-object-2.rs:10:5
20 found std::boxed::Box<dyn X> 20 |
21LL | box B(&*v) as Box<dyn X>
22 | ^^^^^^^^^^^^^^^^^^^^^^^^
23 = note: expected `std::boxed::Box<(dyn X + 'static)>`
24 found `std::boxed::Box<dyn X>`
21 25
22error: aborting due to previous error 26error: aborting due to previous error
23 27
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr
index c80d13e..449a5b5 100644
--- a/src/test/ui/regions/regions-close-object-into-object-4.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr
@@ -15,9 +15,13 @@ note: ...so that the type `(dyn A<U> + 'a)` is not borrowed for too long
15LL | box B(&*v) as Box<dyn X> 15LL | box B(&*v) as Box<dyn X>
16 | ^^^ 16 | ^^^
17 = note: but, the lifetime must be valid for the static lifetime... 17 = note: but, the lifetime must be valid for the static lifetime...
18 = note: ...so that the expression is assignable: 18note: ...so that the expression is assignable
19 expected std::boxed::Box<(dyn X + 'static)> 19 --> $DIR/regions-close-object-into-object-4.rs:10:5
20 found std::boxed::Box<dyn X> 20 |
21LL | box B(&*v) as Box<dyn X>
22 | ^^^^^^^^^^^^^^^^^^^^^^^^
23 = note: expected `std::boxed::Box<(dyn X + 'static)>`
24 found `std::boxed::Box<dyn X>`
21 25
22error: aborting due to previous error 26error: aborting due to previous error
23 27
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
index ef21316..b2a7afa 100644
--- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
+++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
@@ -19,9 +19,13 @@ note: but, the lifetime must be valid for the lifetime `'c` as defined on the fu
19 | 19 |
20LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> { 20LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> {
21 | ^^ 21 | ^^
22 = note: ...so that the expression is assignable: 22note: ...so that the expression is assignable
23 expected std::boxed::Box<(dyn SomeTrait + 'c)> 23 --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5
24 found std::boxed::Box<dyn SomeTrait> 24 |
25LL | box v as Box<dyn SomeTrait + 'a>
26 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27 = note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>`
28 found `std::boxed::Box<dyn SomeTrait>`
25 29
26error: aborting due to previous error 30error: aborting due to previous error
27 31
diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr
index 12b8978..58f74e4 100644
--- a/src/test/ui/regions/regions-creating-enums4.stderr
+++ b/src/test/ui/regions/regions-creating-enums4.stderr
@@ -9,17 +9,25 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun
9 | 9 |
10LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { 10LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
11 | ^^ 11 | ^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected &Ast<'_> 13 --> $DIR/regions-creating-enums4.rs:7:14
14 found &Ast<'a> 14 |
15LL | Ast::Add(x, y)
16 | ^
17 = note: expected `&Ast<'_>`
18 found `&Ast<'a>`
15note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19... 19note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
16 --> $DIR/regions-creating-enums4.rs:6:19 20 --> $DIR/regions-creating-enums4.rs:6:19
17 | 21 |
18LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { 22LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
19 | ^^ 23 | ^^
20 = note: ...so that the expression is assignable: 24note: ...so that the expression is assignable
21 expected Ast<'b> 25 --> $DIR/regions-creating-enums4.rs:7:5
22 found Ast<'_> 26 |
27LL | Ast::Add(x, y)
28 | ^^^^^^^^^^^^^^
29 = note: expected `Ast<'b>`
30 found `Ast<'_>`
23 31
24error: aborting due to previous error 32error: aborting due to previous error
25 33
diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr
index b93dd0d..ffc2a25 100644
--- a/src/test/ui/regions/regions-escape-method.stderr
+++ b/src/test/ui/regions/regions-escape-method.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
9 | 9 |
10LL | s.f(|p| p) 10LL | s.f(|p| p)
11 | ^^^^^ 11 | ^^^^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected &i32 13 --> $DIR/regions-escape-method.rs:15:13
14 found &i32 14 |
15LL | s.f(|p| p)
16 | ^
17 = note: expected `&i32`
18 found `&i32`
15note: but, the lifetime must be valid for the method call at 15:5... 19note: but, the lifetime must be valid for the method call at 15:5...
16 --> $DIR/regions-escape-method.rs:15:5 20 --> $DIR/regions-escape-method.rs:15:5
17 | 21 |
diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr
index a6b165e..9082346 100644
--- a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr
+++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
9 | 9 |
10LL | with(|o| o) 10LL | with(|o| o)
11 | ^^^^^ 11 | ^^^^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected &isize 13 --> $DIR/regions-escape-via-trait-or-not.rs:18:14
14 found &isize 14 |
15LL | with(|o| o)
16 | ^
17 = note: expected `&isize`
18 found `&isize`
15note: but, the lifetime must be valid for the expression at 18:5... 19note: but, the lifetime must be valid for the expression at 18:5...
16 --> $DIR/regions-escape-via-trait-or-not.rs:18:5 20 --> $DIR/regions-escape-via-trait-or-not.rs:18:5
17 | 21 |
diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr
index f4eb5c8..8fce160 100644
--- a/src/test/ui/regions/regions-nested-fns.stderr
+++ b/src/test/ui/regions/regions-nested-fns.stderr
@@ -29,9 +29,18 @@ LL | | if false { return ay; }
29LL | | return z; 29LL | | return z;
30LL | | })); 30LL | | }));
31 | |_____^ 31 | |_____^
32 = note: ...so that the types are compatible: 32note: ...so that the types are compatible
33 expected &isize 33 --> $DIR/regions-nested-fns.rs:13:76
34 found &isize 34 |
35LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
36 | ____________________________________________________________________________^
37LL | | if false { return x; }
38LL | | if false { return ay; }
39LL | | return z;
40LL | | }));
41 | |_____^
42 = note: expected `&isize`
43 found `&isize`
35 44
36error[E0312]: lifetime of reference outlives lifetime of borrowed content... 45error[E0312]: lifetime of reference outlives lifetime of borrowed content...
37 --> $DIR/regions-nested-fns.rs:14:27 46 --> $DIR/regions-nested-fns.rs:14:27
diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr
index d29fd80..8a600d2 100644
--- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr
+++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr
@@ -17,9 +17,16 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined on
17 | 17 |
18LL | fn bar<'a, 'b>() 18LL | fn bar<'a, 'b>()
19 | ^^ 19 | ^^
20 = note: ...so that the types are compatible: 20note: ...so that the types are compatible
21 expected Project<'a, 'b> 21 --> $DIR/regions-normalize-in-where-clause-list.rs:22:1
22 found Project<'_, '_> 22 |
23LL | / fn bar<'a, 'b>()
24LL | | where <() as Project<'a, 'b>>::Item : Eq
25LL | | {
26LL | | }
27 | |_^
28 = note: expected `Project<'a, 'b>`
29 found `Project<'_, '_>`
23 30
24error: aborting due to previous error 31error: aborting due to previous error
25 32
diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.stderr
index 4907667..2895a0c 100644
--- a/src/test/ui/regions/regions-ret-borrowed-1.stderr
+++ b/src/test/ui/regions/regions-ret-borrowed-1.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
9 | 9 |
10LL | with(|o| o) 10LL | with(|o| o)
11 | ^^^^^ 11 | ^^^^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected &isize 13 --> $DIR/regions-ret-borrowed-1.rs:10:14
14 found &isize 14 |
15LL | with(|o| o)
16 | ^
17 = note: expected `&isize`
18 found `&isize`
15note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14... 19note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14...
16 --> $DIR/regions-ret-borrowed-1.rs:9:14 20 --> $DIR/regions-ret-borrowed-1.rs:9:14
17 | 21 |
diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.stderr
index eb1ade2..b74f10f 100644
--- a/src/test/ui/regions/regions-ret-borrowed.stderr
+++ b/src/test/ui/regions/regions-ret-borrowed.stderr
@@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th
9 | 9 |
10LL | with(|o| o) 10LL | with(|o| o)
11 | ^^^^^ 11 | ^^^^^
12 = note: ...so that the expression is assignable: 12note: ...so that the expression is assignable
13 expected &isize 13 --> $DIR/regions-ret-borrowed.rs:13:14
14 found &isize 14 |
15LL | with(|o| o)
16 | ^
17 = note: expected `&isize`
18 found `&isize`
15note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14... 19note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14...
16 --> $DIR/regions-ret-borrowed.rs:12:14 20 --> $DIR/regions-ret-borrowed.rs:12:14
17 | 21 |
diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr
index ef69f25..58b79d2 100644
--- a/src/test/ui/regions/regions-trait-object-subtyping.stderr
+++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr
@@ -36,9 +36,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu
36 | 36 |
37LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { 37LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
38 | ^^ 38 | ^^
39 = note: ...so that the expression is assignable: 39note: ...so that the expression is assignable
40 expected &'b mut (dyn Dummy + 'b) 40 --> $DIR/regions-trait-object-subtyping.rs:15:5
41 found &mut (dyn Dummy + 'b) 41 |
42LL | x
43 | ^
44 = note: expected `&'b mut (dyn Dummy + 'b)`
45 found `&mut (dyn Dummy + 'b)`
42 46
43error[E0308]: mismatched types 47error[E0308]: mismatched types
44 --> $DIR/regions-trait-object-subtyping.rs:22:5 48 --> $DIR/regions-trait-object-subtyping.rs:22:5
diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr
index e55f023..527babb 100644
--- a/src/test/ui/reject-specialized-drops-8142.stderr
+++ b/src/test/ui/reject-specialized-drops-8142.stderr
@@ -105,9 +105,13 @@ note: ...but the lifetime must also be valid for the lifetime `'l2` as defined o
105 | 105 |
106LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } 106LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
107 | ^^^ 107 | ^^^
108 = note: ...so that the types are compatible: 108note: ...so that the types are compatible
109 expected W<'l1, 'l2> 109 --> $DIR/reject-specialized-drops-8142.rs:54:1
110 found W<'_, '_> 110 |
111LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
112 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113 = note: expected `W<'l1, 'l2>`
114 found `W<'_, '_>`
111 115
112error: aborting due to 8 previous errors 116error: aborting due to 8 previous errors
113 117
diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.rs b/src/test/ui/suggestions/raw-name-use-suggestion.rs
index 6c01383..0a8073c 100644
--- a/src/test/ui/suggestions/raw-name-use-suggestion.rs
+++ b/src/test/ui/suggestions/raw-name-use-suggestion.rs
@@ -5,5 +5,5 @@ mod foo {
5 5
6fn main() { 6fn main() {
7 foo::let(); //~ ERROR expected identifier, found keyword `let` 7 foo::let(); //~ ERROR expected identifier, found keyword `let`
8 r#break(); //~ ERROR cannot find function `break` in this scope 8 r#break(); //~ ERROR cannot find function `r#break` in this scope
9} 9}
diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.stderr b/src/test/ui/suggestions/raw-name-use-suggestion.stderr
index 58eb87c..62b7631 100644
--- a/src/test/ui/suggestions/raw-name-use-suggestion.stderr
+++ b/src/test/ui/suggestions/raw-name-use-suggestion.stderr
@@ -20,7 +20,7 @@ help: you can escape reserved keywords to use them as identifiers
20LL | foo::r#let(); 20LL | foo::r#let();
21 | ^^^^^ 21 | ^^^^^
22 22
23error[E0425]: cannot find function `break` in this scope 23error[E0425]: cannot find function `r#break` in this scope
24 --> $DIR/raw-name-use-suggestion.rs:8:5 24 --> $DIR/raw-name-use-suggestion.rs:8:5
25 | 25 |
26LL | r#break(); 26LL | r#break();
diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr
index 88c9c47..9fdcd4d 100644
--- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr
+++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr
@@ -14,9 +14,13 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined on
14 | 14 |
15LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { 15LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
16 | ^^ 16 | ^^
17 = note: ...so that the types are compatible: 17note: ...so that the types are compatible
18 expected T1<'a> 18 --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:13
19 found T1<'_> 19 |
20LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
21 | ^^^^^^^^^^
22 = note: expected `T1<'a>`
23 found `T1<'_>`
20 24
21error: aborting due to previous error 25error: aborting due to previous error
22 26
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
index d0475bf..e6029e0d 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
@@ -18,9 +18,13 @@ note: ...so that reference does not outlive borrowed content
18LL | Box::new(items.iter()) 18LL | Box::new(items.iter())
19 | ^^^^^ 19 | ^^^^^
20 = note: but, the lifetime must be valid for the static lifetime... 20 = note: but, the lifetime must be valid for the static lifetime...
21 = note: ...so that the expression is assignable: 21note: ...so that the expression is assignable
22 expected std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)> 22 --> $DIR/dyn-trait-underscore.rs:8:5
23 found std::boxed::Box<dyn std::iter::Iterator<Item = &T>> 23 |
24LL | Box::new(items.iter())
25 | ^^^^^^^^^^^^^^^^^^^^^^
26 = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>`
27 found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>`
24 28
25error: aborting due to previous error 29error: aborting due to previous error
26 30