about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-30 21:25:15 +0000
committerbors <bors@rust-lang.org>2020-12-30 21:25:15 +0000
commit9775ffef2a4c3a36cadb58b72ea60cefb92c86ae (patch)
tree3cd62fcea1d36df812c14eec010c884c466deb8b /src
parente2267046859c9ceb932abc983561d53a117089f6 (diff)
parent8998e31223333cdcf384cf39876d7c4bb533db48 (diff)
downloadrust-9775ffef2a4c3a36cadb58b72ea60cefb92c86ae.tar.gz
rust-9775ffef2a4c3a36cadb58b72ea60cefb92c86ae.zip
Auto merge of #80530 - m-ou-se:rollup-zit69ko, r=m-ou-se
Rollup of 9 pull requests

Successful merges:

 - #78934 (refactor: removing library/alloc/src/vec/mod.rs ignore-tidy-filelength)
 - #79479 (Add `Iterator::intersperse`)
 - #80128 (Edit rustc_ast::ast::FieldPat docs)
 - #80424 (Don't give an error when creating a file for the first time)
 - #80458 (Some Promotion Refactoring)
 - #80488 (Do not create dangling &T in Weak<T>::drop)
 - #80491 (Miri: make size/align_of_val work for dangling raw ptrs)
 - #80495 (Rename kw::Invalid -> kw::Empty)
 - #80513 (Add regression test for #80062)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bootstrap.py6
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/clean/utils.rs1
-rw-r--r--src/librustdoc/html/render/mod.rs6
-rw-r--r--src/librustdoc/lib.rs1
-rw-r--r--src/test/ui/associated-types/defaults-wf.stderr2
-rw-r--r--src/test/ui/bad/bad-sized.stderr2
-rw-r--r--src/test/ui/const-generics/issues/issue-80062.rs10
-rw-r--r--src/test/ui/const-generics/issues/issue-80062.stderr11
-rw-r--r--src/test/ui/consts/const-size_of_val-align_of_val.rs7
-rw-r--r--src/test/ui/issues/issue-20433.stderr2
-rw-r--r--src/test/ui/lint/lint-const-item-mutation.stderr2
-rw-r--r--src/tools/clippy/clippy_lints/src/lifetimes.rs2
13 files changed, 43 insertions, 13 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 97f40815b87..b8bae69d063 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -351,11 +351,13 @@ def output(filepath):
     with open(tmp, 'w') as f:
         yield f
     try:
-        os.remove(filepath)  # PermissionError/OSError on Win32 if in use
-        os.rename(tmp, filepath)
+        if os.path.exists(filepath):
+            os.remove(filepath)  # PermissionError/OSError on Win32 if in use
     except OSError:
         shutil.copy2(tmp, filepath)
         os.remove(tmp)
+        return
+    os.rename(tmp, filepath)
 
 
 class RustBuild(object):
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index e56556b5af7..766b02a5acd 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -941,7 +941,7 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], &'a [Ident]) {
                 .iter()
                 .enumerate()
                 .map(|(i, ty)| {
-                    let mut name = self.1.get(i).map(|ident| ident.name).unwrap_or(kw::Invalid);
+                    let mut name = self.1.get(i).map(|ident| ident.name).unwrap_or(kw::Empty);
                     if name.is_empty() {
                         name = kw::Underscore;
                     }
@@ -1000,7 +1000,7 @@ impl<'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
                     .iter()
                     .map(|t| Argument {
                         type_: t.clean(cx),
-                        name: names.next().map(|i| i.name).unwrap_or(kw::Invalid),
+                        name: names.next().map(|i| i.name).unwrap_or(kw::Empty),
                     })
                     .collect(),
             },
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index 2cde0c209ee..a6c090c6576 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -8,7 +8,6 @@ use crate::clean::{
 };
 use crate::core::DocContext;
 
-use itertools::Itertools;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index d8fadbf57e8..a83a3600383 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -2086,8 +2086,8 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
                 (true, false) => return Ordering::Greater,
             }
         }
-        let lhs = i1.name.unwrap_or(kw::Invalid).as_str();
-        let rhs = i2.name.unwrap_or(kw::Invalid).as_str();
+        let lhs = i1.name.unwrap_or(kw::Empty).as_str();
+        let rhs = i2.name.unwrap_or(kw::Empty).as_str();
         compare_names(&lhs, &rhs)
     }
 
@@ -4207,7 +4207,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer, cache:
                 ty: \"{ty}\", \
                 relpath: \"{path}\"\
             }};</script>",
-        name = it.name.unwrap_or(kw::Invalid),
+        name = it.name.unwrap_or(kw::Empty),
         ty = it.type_(),
         path = relpath
     );
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index e8bf664d45c..7ed64c5813f 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -17,6 +17,7 @@
 #![feature(type_ascription)]
 #![feature(split_inclusive)]
 #![feature(str_split_once)]
+#![feature(iter_intersperse)]
 #![recursion_limit = "256"]
 
 #[macro_use]
diff --git a/src/test/ui/associated-types/defaults-wf.stderr b/src/test/ui/associated-types/defaults-wf.stderr
index 4c43e6a182d..d4fa5be742f 100644
--- a/src/test/ui/associated-types/defaults-wf.stderr
+++ b/src/test/ui/associated-types/defaults-wf.stderr
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
 LL |     type Ty = Vec<[u8]>;
    |     ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    | 
-  ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
+  ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
    |
 LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr
index 60a5bb9f786..260d78b543a 100644
--- a/src/test/ui/bad/bad-sized.stderr
+++ b/src/test/ui/bad/bad-sized.stderr
@@ -15,7 +15,7 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila
 LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
    |            ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    | 
-  ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
+  ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
    |
 LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
diff --git a/src/test/ui/const-generics/issues/issue-80062.rs b/src/test/ui/const-generics/issues/issue-80062.rs
new file mode 100644
index 00000000000..56dc53298fb
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-80062.rs
@@ -0,0 +1,10 @@
+// Regression test for issue #80062 (fixed by `min_const_generics`)
+
+fn sof<T>() -> T { unimplemented!() }
+
+fn test<T>() {
+    let _: [u8; sof::<T>()];
+    //~^ ERROR generic parameters may not be used in const operations
+}
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issues/issue-80062.stderr b/src/test/ui/const-generics/issues/issue-80062.stderr
new file mode 100644
index 00000000000..aad8907bda2
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-80062.stderr
@@ -0,0 +1,11 @@
+error: generic parameters may not be used in const operations
+  --> $DIR/issue-80062.rs:6:23
+   |
+LL |     let _: [u8; sof::<T>()];
+   |                       ^ cannot perform const operation using `T`
+   |
+   = note: type parameters may not be used in const expressions
+   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/const-size_of_val-align_of_val.rs b/src/test/ui/consts/const-size_of_val-align_of_val.rs
index e8e6f1d3900..5c0d7d94d64 100644
--- a/src/test/ui/consts/const-size_of_val-align_of_val.rs
+++ b/src/test/ui/consts/const-size_of_val-align_of_val.rs
@@ -1,6 +1,7 @@
 // run-pass
 
 #![feature(const_size_of_val, const_align_of_val)]
+#![feature(const_size_of_val_raw, const_align_of_val_raw, layout_for_ptr)]
 
 use std::mem;
 
@@ -32,6 +33,9 @@ const ALIGN_OF_UGH: usize = mem::align_of_val(&UGH);
 
 const SIZE_OF_SLICE: usize = mem::size_of_val("foobar".as_bytes());
 
+const SIZE_OF_DANGLING: usize = unsafe { mem::size_of_val_raw(0x100 as *const i32) };
+const ALIGN_OF_DANGLING: usize = unsafe { mem::align_of_val_raw(0x100 as *const i16) };
+
 fn main() {
     assert_eq!(SIZE_OF_FOO, mem::size_of::<Foo>());
     assert_eq!(SIZE_OF_BAR, mem::size_of::<Bar>());
@@ -41,5 +45,8 @@ fn main() {
     assert_eq!(ALIGN_OF_BAR, mem::align_of::<Bar>());
     assert_eq!(ALIGN_OF_UGH, mem::align_of::<Ugh>());
 
+    assert_eq!(SIZE_OF_DANGLING, mem::size_of::<i32>());
+    assert_eq!(ALIGN_OF_DANGLING, mem::align_of::<i16>());
+
     assert_eq!(SIZE_OF_SLICE, "foobar".len());
 }
diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr
index 3f7226c79bf..5fed02164b5 100644
--- a/src/test/ui/issues/issue-20433.stderr
+++ b/src/test/ui/issues/issue-20433.stderr
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
 LL |     fn iceman(c: Vec<[i32]>) {}
    |                  ^^^^^^^^^^ doesn't have a size known at compile-time
    | 
-  ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
+  ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
    |
 LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
diff --git a/src/test/ui/lint/lint-const-item-mutation.stderr b/src/test/ui/lint/lint-const-item-mutation.stderr
index 74505eeb987..3973af540c8 100644
--- a/src/test/ui/lint/lint-const-item-mutation.stderr
+++ b/src/test/ui/lint/lint-const-item-mutation.stderr
@@ -107,7 +107,7 @@ LL |     VEC.push(0);
    = note: each usage of a `const` item creates a new temporary
    = note: the mutable reference will refer to this temporary, not the original `const` item
 note: mutable reference created due to call to this method
-  --> $SRC_DIR/alloc/src/vec.rs:LL:COL
+  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
    |
 LL | /     pub fn push(&mut self, value: T) {
 LL | |         // This will panic or abort if we would allocate > isize::MAX bytes
diff --git a/src/tools/clippy/clippy_lints/src/lifetimes.rs b/src/tools/clippy/clippy_lints/src/lifetimes.rs
index 4d737b3f49b..e84c8b4e5b3 100644
--- a/src/tools/clippy/clippy_lints/src/lifetimes.rs
+++ b/src/tools/clippy/clippy_lints/src/lifetimes.rs
@@ -501,7 +501,7 @@ impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker {
 
     // for lifetimes as parameters of generics
     fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
-        if lifetime.name.ident().name != kw::Invalid && lifetime.name.ident().name != kw::StaticLifetime {
+        if lifetime.name.ident().name != kw::Empty && lifetime.name.ident().name != kw::StaticLifetime {
             self.lifetimes_used_in_body = true;
         }
     }