From 2a1e61e2d653cd287ac902bdf3411d8cbbc40f0c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 27 Mar 2020 16:34:15 +0100 Subject: [PATCH 01/10] avoid creating unnecessary reference in Windows Env iterator --- src/libstd/sys/windows/os.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index cc4ae405906..a0da2498bb7 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -94,7 +94,7 @@ impl Iterator for Env { if *self.cur == 0 { return None; } - let p = &*self.cur as *const u16; + let p = self.cur as *const u16; let mut len = 0; while *p.offset(len) != 0 { len += 1; From df1ac679135f5e8dfbfdc948b906890d44436f50 Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:11:44 +0200 Subject: [PATCH 02/10] update polonius-engine to 0.12.1 This will fix some move errors false positives --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fdc84e53d12..ae2c76def5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2522,9 +2522,9 @@ checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" [[package]] name = "polonius-engine" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d8ef65e3f89ecaec9ca7cb0e0911b4617352d4494018bcf934992f03f2024c" +checksum = "ef2558a4b464e185b36ee08a2937ebb62ea5464c38856cfb1465c97cb38db52d" dependencies = [ "datafrog", "log", From 860f71f141baf8228a9d71a75092ff2378bfee42 Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:13:03 +0200 Subject: [PATCH 03/10] Polonius fact generation: fix path access fact location This will fix the other move errors false positives: emitting the fact at the start point caused accesses to be at the same point as an initialization fact of the return place of a call on the following block, which emitted an error. --- src/librustc_mir/borrow_check/type_check/liveness/polonius.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs b/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs index 407e0628b6e..1c1983fefd4 100644 --- a/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs +++ b/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs @@ -43,7 +43,7 @@ impl UseFactsExtractor<'_> { fn insert_path_access(&mut self, path: MovePathIndex, location: Location) { debug!("UseFactsExtractor::insert_path_access({:?}, {:?})", path, location); - self.path_accessed_at_base.push((path, self.location_table.start_index(location))); + self.path_accessed_at_base.push((path, self.location_to_index(location))); } fn place_to_mpi(&self, place: &Place<'_>) -> Option { From 2a7644746b5c5cc7fe214a61fb443efceac06dc5 Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:18:27 +0200 Subject: [PATCH 04/10] bless output of ui test hrtb/hrtb-perfect-forwarding.rs trivial formatting changes --- src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr index 558d643cde8..676a934569c 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr @@ -39,6 +39,7 @@ LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also ... | LL | | foo_hrtb_bar_not(&mut t); | | ------------------------ recursive call site +LL | | LL | | } | |_^ cannot return without recursing | @@ -51,7 +52,7 @@ LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:49:1 + --> $DIR/hrtb-perfect-forwarding.rs:50:1 | LL | / fn foo_hrtb_bar_hrtb(mut t: T) LL | | where T : for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize> From c73d5db21fa89c33064724219e1dd5f168449d55 Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:22:59 +0200 Subject: [PATCH 05/10] bless output of ui test nll/outlives-suggestion-simple.rs trivial diagnostics wording change --- .../ui/nll/outlives-suggestion-simple.polonius.stderr | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr b/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr index 815744618f6..dbbda62d208 100644 --- a/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr +++ b/src/test/ui/nll/outlives-suggestion-simple.polonius.stderr @@ -72,6 +72,8 @@ LL | (x, x) | = help: consider adding the following bound: `'a: 'c` +help: add bound `'a: 'b + 'c` + error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:31:9 | @@ -106,16 +108,16 @@ LL | self.x | = help: consider adding the following bound: `'b: 'a` -error[E0521]: borrowed data escapes outside of function +error[E0521]: borrowed data escapes outside of associated function --> $DIR/outlives-suggestion-simple.rs:73:9 | LL | fn get_bar(&self) -> Bar2 { | ----- | | - | `self` is declared here, outside of the function body - | `self` is a reference that is only valid in the function body + | `self` declared here, outside of the associated function body + | `self` is a reference that is only valid in the associated function body LL | Bar2::new(&self) - | ^^^^^^^^^^^^^^^^ `self` escapes the function body here + | ^^^^^^^^^^^^^^^^ `self` escapes the associated function body here error: aborting due to 10 previous errors From fcd12bd2f42202bf75f89c3712d25295af47e1ab Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:24:52 +0200 Subject: [PATCH 06/10] bless output of ui test closures/closure-expected-type/expect-region-supply-region.rs trivial diagnostics grammar change --- .../expect-region-supply-region.polonius.stderr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr index 2a7461fb469..df60416709f 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.polonius.stderr @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/expect-region-supply-region.rs:18:9 | LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body + | ----- `f` declared here, outside of the closure body LL | closure_expecting_bound(|x| { | - `x` is a reference that is only valid in the closure body LL | f = Some(x); @@ -12,7 +12,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/expect-region-supply-region.rs:28:9 | LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body + | ----- `f` declared here, outside of the closure body LL | closure_expecting_bound(|x: &u32| { | - `x` is a reference that is only valid in the closure body LL | f = Some(x); @@ -33,7 +33,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/expect-region-supply-region.rs:42:9 | LL | let mut f: Option<&u32> = None; - | ----- `f` is declared here, outside of the closure body + | ----- `f` declared here, outside of the closure body ... LL | closure_expecting_bound(|x: &'x u32| { | - `x` is a reference that is only valid in the closure body From 82424634a389a88584ef40008d613695ff7e72ce Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:28:27 +0200 Subject: [PATCH 07/10] bless output of ui test impl-trait/multiple-lifetimes/error-handling.rs Some impl Trait fixes lead to locating more accurately the cause of a universal region error with a user annotation --- .../multiple-lifetimes/error-handling.polonius.stderr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr index 72e8fa33d7b..6ce3aaf49eb 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.polonius.stderr @@ -1,10 +1,13 @@ error: lifetime may not live long enough - --> $DIR/error-handling.rs:13:56 + --> $DIR/error-handling.rs:23:16 | LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { - | -- -- lifetime `'b` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'b` + | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here +... +LL | let _: &'b i32 = *u.0; + | ^^^^^^^ type annotation requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` From 5af11d261d38c6dad4475c933ffa59a388979cfb Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Mon, 30 Mar 2020 01:30:26 +0200 Subject: [PATCH 08/10] bless output of ui test nll/user-annotations/closure-substs.rs Trivial diagnostics grammar change --- src/test/ui/nll/user-annotations/closure-substs.polonius.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr b/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr index d5bcdf64441..46b6c04dcbc 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr @@ -50,7 +50,7 @@ error[E0521]: borrowed data escapes outside of closure --> $DIR/closure-substs.rs:29:9 | LL | |x: &i32, b: fn(&'static i32)| { - | - - `b` is declared here, outside of the closure body + | - - `b` declared here, outside of the closure body | | | `x` is a reference that is only valid in the closure body LL | b(x); From 032d3cd553ec503a4483c8ef1f2a8d773775a3f2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Mar 2020 12:03:55 +0200 Subject: [PATCH 09/10] fix BTreeMap test compilation with Miri --- src/liballoc/tests/btree/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs index 535b6a9c314..e28b71510ce 100644 --- a/src/liballoc/tests/btree/map.rs +++ b/src/liballoc/tests/btree/map.rs @@ -528,7 +528,7 @@ fn test_range_1000() { #[cfg(not(miri))] // Miri is too slow let size = 1000; #[cfg(miri)] - let size = MIN_INSERTS_HEIGHT_2; + let size = MIN_INSERTS_HEIGHT_2 as u32; let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); fn test(map: &BTreeMap, size: u32, min: Bound<&u32>, max: Bound<&u32>) { From 60e7473bdf343584bb9be21165770b034ad8423e Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Mon, 30 Mar 2020 10:09:51 -0400 Subject: [PATCH 10/10] Fix broken link in README --- src/librustc_codegen_llvm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_codegen_llvm/README.md b/src/librustc_codegen_llvm/README.md index 97d8f76623e..afec60d017e 100644 --- a/src/librustc_codegen_llvm/README.md +++ b/src/librustc_codegen_llvm/README.md @@ -4,4 +4,4 @@ that runs towards the end of the compilation process. For more information about how codegen works, see the [rustc dev guide]. -[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/codegen.html +[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/backend/codegen.html