about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-16 13:23:46 +0000
committerbors <bors@rust-lang.org>2020-09-16 13:23:46 +0000
commit7bb106fe633872de703af46381843057f8cd384f (patch)
tree05487dfb7b864c32f3391dcd8d964e7f86459a39 /src
parent5fae56971d8487088c0099c82c0a5ce1638b5f62 (diff)
parentf63129356537822c3c108ecea8cda4bc741557b5 (diff)
downloadrust-7bb106fe633872de703af46381843057f8cd384f.tar.gz
rust-7bb106fe633872de703af46381843057f8cd384f.zip
Auto merge of #76786 - Dylan-DPC:rollup-x6p60m6, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #76669 (Prefer asm! over llvm_asm! in core)
 - #76675 (Small improvements to asm documentation)
 - #76681 (remove orphaned files)
 - #76694 (Introduce a PartitioningCx struct)
 - #76695 (fix syntax error in suggesting generic constraint in trait parameter)
 - #76699 (improve const infer error)
 - #76707 (Simplify iter flatten struct doc)
 - #76710 (:arrow_up: rust-analyzer)
 - #76714 (Small docs improvements)
 - #76717 (Fix generating rustc docs with non-default lib directory.)

Failed merges:

r? `@ghost`
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs8
-rw-r--r--src/bootstrap/doc.rs4
-rw-r--r--src/bootstrap/test.rs8
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-x86_64-linux/build-git.sh15
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-x86_64-linux/build-headers.sh16
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-x86_64-linux/build-perl.sh21
-rw-r--r--src/doc/unstable-book/src/library-features/asm.md19
-rw-r--r--src/doc/unstable-book/src/library-features/llvm-asm.md6
-rw-r--r--src/test/ui/const-generics/infer/cannot-infer-const-args.full.stderr (renamed from src/test/ui/const-generics/cannot-infer-const-args.full.stderr)2
-rw-r--r--src/test/ui/const-generics/infer/cannot-infer-const-args.min.stderr (renamed from src/test/ui/const-generics/cannot-infer-const-args.min.stderr)2
-rw-r--r--src/test/ui/const-generics/infer/cannot-infer-const-args.rs (renamed from src/test/ui/const-generics/cannot-infer-const-args.rs)0
-rw-r--r--src/test/ui/const-generics/infer/method-chain.full.stderr11
-rw-r--r--src/test/ui/const-generics/infer/method-chain.min.stderr11
-rw-r--r--src/test/ui/const-generics/infer/method-chain.rs22
-rw-r--r--src/test/ui/const-generics/infer/uninferred-consts.full.stderr (renamed from src/test/ui/const-generics/uninferred-consts.full.stderr)6
-rw-r--r--src/test/ui/const-generics/infer/uninferred-consts.min.stderr (renamed from src/test/ui/const-generics/uninferred-consts.min.stderr)6
-rw-r--r--src/test/ui/const-generics/infer/uninferred-consts.rs (renamed from src/test/ui/const-generics/uninferred-consts.rs)0
-rw-r--r--src/test/ui/trait-impl-bound-suggestions.fixed20
-rw-r--r--src/test/ui/trait-impl-bound-suggestions.rs20
-rw-r--r--src/test/ui/trait-impl-bound-suggestions.stderr17
-rw-r--r--src/test/ui/type/type-check-defaults.stderr4
-rw-r--r--src/tools/lint-docs/src/lib.rs5
m---------src/tools/rust-analyzer49
23 files changed, 184 insertions, 88 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 34756af21e4..140507eab66 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -683,7 +683,7 @@ impl<'a> Builder<'a> {
 
     /// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic
     /// library lookup path.
-    pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Cargo) {
+    pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Command) {
         // Windows doesn't need dylib path munging because the dlls for the
         // compiler live next to the compiler and the system will find them
         // automatically.
@@ -691,7 +691,7 @@ impl<'a> Builder<'a> {
             return;
         }
 
-        add_dylib_path(vec![self.rustc_libdir(compiler)], &mut cmd.command);
+        add_dylib_path(vec![self.rustc_libdir(compiler)], cmd);
     }
 
     /// Gets a path to the compiler specified.
@@ -1488,6 +1488,10 @@ impl Cargo {
         self.command.env(key.as_ref(), value.as_ref());
         self
     }
+
+    pub fn add_rustc_lib_path(&mut self, builder: &Builder<'_>, compiler: Compiler) {
+        builder.add_rustc_lib_path(compiler, &mut self.command);
+    }
 }
 
 impl From<Cargo> for Command {
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 98a0119e4df..f90e76a4f4e 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -766,6 +766,10 @@ impl Step for RustcBook {
         if builder.config.verbose() {
             cmd.arg("--verbose");
         }
+        // If the lib directories are in an unusual location (changed in
+        // config.toml), then this needs to explicitly update the dylib search
+        // path.
+        builder.add_rustc_lib_path(self.compiler, &mut cmd);
         builder.run(&mut cmd);
         // Run rustbook/mdbook to generate the HTML pages.
         builder.ensure(RustbookSrc {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 045dda2d4cb..ba5f75c49ac 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -270,7 +270,7 @@ impl Step for Rls {
             &[],
         );
 
-        builder.add_rustc_lib_path(compiler, &mut cargo);
+        cargo.add_rustc_lib_path(builder, compiler);
         cargo.arg("--").args(builder.config.cmd.test_args());
 
         if try_run(builder, &mut cargo.into()) {
@@ -328,7 +328,7 @@ impl Step for Rustfmt {
         t!(fs::create_dir_all(&dir));
         cargo.env("RUSTFMT_TEST_DIR", dir);
 
-        builder.add_rustc_lib_path(compiler, &mut cargo);
+        cargo.add_rustc_lib_path(builder, compiler);
 
         if try_run(builder, &mut cargo.into()) {
             builder.save_toolstate("rustfmt", ToolState::TestPass);
@@ -449,7 +449,7 @@ impl Step for Miri {
 
             cargo.arg("--").args(builder.config.cmd.test_args());
 
-            builder.add_rustc_lib_path(compiler, &mut cargo);
+            cargo.add_rustc_lib_path(builder, compiler);
 
             if !try_run(builder, &mut cargo.into()) {
                 return;
@@ -554,7 +554,7 @@ impl Step for Clippy {
 
         cargo.arg("--").args(builder.config.cmd.test_args());
 
-        builder.add_rustc_lib_path(compiler, &mut cargo);
+        cargo.add_rustc_lib_path(builder, compiler);
 
         builder.run(&mut cargo.into());
     }
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-git.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-git.sh
deleted file mode 100755
index 38fea2a8094..00000000000
--- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-git.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-source shared.sh
-
-curl -L https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz | tar xzf -
-
-cd git-2.10.0
-make configure
-hide_output ./configure --prefix=/rustroot
-hide_output make -j10
-hide_output make install
-
-cd ..
-rm -rf git-2.10.0
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-headers.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-headers.sh
deleted file mode 100755
index b623e53583b..00000000000
--- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-headers.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-source shared.sh
-
-curl https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.2.84.tar.xz | unxz | tar x
-
-cd linux-3.2.84
-hide_output make mrproper
-hide_output make INSTALL_HDR_PATH=dest headers_install
-
-find dest/include \( -name .install -o -name ..install.cmd \) -delete
-yes | cp -fr dest/include/* /usr/include
-
-cd ..
-rm -rf linux-3.2.84
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-perl.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-perl.sh
deleted file mode 100755
index a678d353d52..00000000000
--- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-perl.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-source shared.sh
-
-curl https://www.cpan.org/src/5.0/perl-5.28.0.tar.gz | \
-  tar xzf -
-
-cd perl-5.28.0
-
-# Gotta do some hackery to tell python about our custom OpenSSL build, but other
-# than that fairly normal.
-CC=gcc \
-CFLAGS='-I /rustroot/include -fgnu89-inline' \
-LDFLAGS='-L /rustroot/lib -L /rustroot/lib64' \
-    hide_output ./configure.gnu
-hide_output make -j10
-hide_output make install
-
-cd ..
-rm -rf perl-5.28.0
diff --git a/src/doc/unstable-book/src/library-features/asm.md b/src/doc/unstable-book/src/library-features/asm.md
index 28a5fe31fc4..df113f0f161 100644
--- a/src/doc/unstable-book/src/library-features/asm.md
+++ b/src/doc/unstable-book/src/library-features/asm.md
@@ -345,6 +345,25 @@ The `h` modifier will emit the register name for the high byte of that register
 
 If you use a smaller data type (e.g. `u16`) with an operand and forget the use template modifiers, the compiler will emit a warning and suggest the correct modifier to use.
 
+## Memory address operands
+
+Sometimes assembly instructions require operands passed via memory addresses/memory locations.
+You have to manually use the memory address syntax specified by the respectively architectures.
+For example, in x86/x86_64 and intel assembly syntax, you should wrap inputs/outputs in `[]`
+to indicate they are memory operands:
+
+```rust,allow_fail
+# #![feature(asm, llvm_asm)]
+# fn load_fpu_control_word(control: u16) {
+unsafe {
+    asm!("fldcw [{}]", in(reg) &control, options(nostack));
+
+    // Previously this would have been written with the deprecated `llvm_asm!` like this
+    llvm_asm!("fldcw $0" :: "m" (control) :: "volatile");
+}
+# }
+```
+
 ## Options
 
 By default, an inline assembly block is treated the same way as an external FFI function call with a custom calling convention: it may read/write memory, have observable side effects, etc. However in many cases, it is desirable to give the compiler more information about what the assembly code is actually doing so that it can optimize better.
diff --git a/src/doc/unstable-book/src/library-features/llvm-asm.md b/src/doc/unstable-book/src/library-features/llvm-asm.md
index da01d9228f1..a2f029db291 100644
--- a/src/doc/unstable-book/src/library-features/llvm-asm.md
+++ b/src/doc/unstable-book/src/library-features/llvm-asm.md
@@ -159,12 +159,12 @@ specify some extra info about the inline assembly:
 
 Current valid options are:
 
-1. *volatile* - specifying this is analogous to
+1. `volatile` - specifying this is analogous to
    `__asm__ __volatile__ (...)` in gcc/clang.
-2. *alignstack* - certain instructions expect the stack to be
+2. `alignstack` - certain instructions expect the stack to be
    aligned a certain way (i.e. SSE) and specifying this indicates to
    the compiler to insert its usual stack alignment code
-3. *intel* - use intel syntax instead of the default AT&T.
+3. `intel` - use intel syntax instead of the default AT&T.
 
 ```rust
 # #![feature(llvm_asm)]
diff --git a/src/test/ui/const-generics/cannot-infer-const-args.full.stderr b/src/test/ui/const-generics/infer/cannot-infer-const-args.full.stderr
index 053139787ed..84e75cc3764 100644
--- a/src/test/ui/const-generics/cannot-infer-const-args.full.stderr
+++ b/src/test/ui/const-generics/infer/cannot-infer-const-args.full.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     foo();
    |     ^^^
    |
-   = note: unable to infer the value of a const parameter
+   = note: cannot infer the value of the const parameter `X`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/cannot-infer-const-args.min.stderr b/src/test/ui/const-generics/infer/cannot-infer-const-args.min.stderr
index 053139787ed..84e75cc3764 100644
--- a/src/test/ui/const-generics/cannot-infer-const-args.min.stderr
+++ b/src/test/ui/const-generics/infer/cannot-infer-const-args.min.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     foo();
    |     ^^^
    |
-   = note: unable to infer the value of a const parameter
+   = note: cannot infer the value of the const parameter `X`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/cannot-infer-const-args.rs b/src/test/ui/const-generics/infer/cannot-infer-const-args.rs
index 2d74b4788bf..2d74b4788bf 100644
--- a/src/test/ui/const-generics/cannot-infer-const-args.rs
+++ b/src/test/ui/const-generics/infer/cannot-infer-const-args.rs
diff --git a/src/test/ui/const-generics/infer/method-chain.full.stderr b/src/test/ui/const-generics/infer/method-chain.full.stderr
new file mode 100644
index 00000000000..e65bc3f1096
--- /dev/null
+++ b/src/test/ui/const-generics/infer/method-chain.full.stderr
@@ -0,0 +1,11 @@
+error[E0282]: type annotations needed
+  --> $DIR/method-chain.rs:21:33
+   |
+LL |     Foo.bar().bar().bar().bar().baz();
+   |                                 ^^^
+   |
+   = note: cannot infer the value of the const parameter `N`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/const-generics/infer/method-chain.min.stderr b/src/test/ui/const-generics/infer/method-chain.min.stderr
new file mode 100644
index 00000000000..e65bc3f1096
--- /dev/null
+++ b/src/test/ui/const-generics/infer/method-chain.min.stderr
@@ -0,0 +1,11 @@
+error[E0282]: type annotations needed
+  --> $DIR/method-chain.rs:21:33
+   |
+LL |     Foo.bar().bar().bar().bar().baz();
+   |                                 ^^^
+   |
+   = note: cannot infer the value of the const parameter `N`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/const-generics/infer/method-chain.rs b/src/test/ui/const-generics/infer/method-chain.rs
new file mode 100644
index 00000000000..9389ca20d10
--- /dev/null
+++ b/src/test/ui/const-generics/infer/method-chain.rs
@@ -0,0 +1,22 @@
+// revisions: full min
+
+#![cfg_attr(full, feature(const_generics))]
+#![cfg_attr(full, allow(incomplete_features))]
+#![cfg_attr(min, feature(min_const_generics))]
+
+struct Foo;
+
+impl Foo {
+    fn bar(self) -> Foo {
+        Foo
+    }
+
+    fn baz<const N: usize>(self) -> Foo {
+        println!("baz: {}", N);
+        Foo
+    }
+}
+
+fn main() {
+    Foo.bar().bar().bar().bar().baz(); //~ ERROR type annotations needed
+}
diff --git a/src/test/ui/const-generics/uninferred-consts.full.stderr b/src/test/ui/const-generics/infer/uninferred-consts.full.stderr
index 2c5af9e65f8..e47b6bd5dc6 100644
--- a/src/test/ui/const-generics/uninferred-consts.full.stderr
+++ b/src/test/ui/const-generics/infer/uninferred-consts.full.stderr
@@ -1,10 +1,10 @@
 error[E0282]: type annotations needed
-  --> $DIR/uninferred-consts.rs:14:5
+  --> $DIR/uninferred-consts.rs:14:9
    |
 LL |     Foo.foo();
-   |     ^^^^^^^^^
+   |         ^^^
    |
-   = note: unable to infer the value of a const parameter
+   = note: cannot infer the value of the const parameter `N`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/uninferred-consts.min.stderr b/src/test/ui/const-generics/infer/uninferred-consts.min.stderr
index 2c5af9e65f8..e47b6bd5dc6 100644
--- a/src/test/ui/const-generics/uninferred-consts.min.stderr
+++ b/src/test/ui/const-generics/infer/uninferred-consts.min.stderr
@@ -1,10 +1,10 @@
 error[E0282]: type annotations needed
-  --> $DIR/uninferred-consts.rs:14:5
+  --> $DIR/uninferred-consts.rs:14:9
    |
 LL |     Foo.foo();
-   |     ^^^^^^^^^
+   |         ^^^
    |
-   = note: unable to infer the value of a const parameter
+   = note: cannot infer the value of the const parameter `N`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/uninferred-consts.rs b/src/test/ui/const-generics/infer/uninferred-consts.rs
index ec5b3ffe544..ec5b3ffe544 100644
--- a/src/test/ui/const-generics/uninferred-consts.rs
+++ b/src/test/ui/const-generics/infer/uninferred-consts.rs
diff --git a/src/test/ui/trait-impl-bound-suggestions.fixed b/src/test/ui/trait-impl-bound-suggestions.fixed
new file mode 100644
index 00000000000..db3a95f5c4f
--- /dev/null
+++ b/src/test/ui/trait-impl-bound-suggestions.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+
+#[allow(unused)]
+use std::fmt::Debug;
+// Rustfix should add this, or use `std::fmt::Debug` instead.
+
+#[allow(dead_code)]
+struct ConstrainedStruct<X: Copy> {
+    x: X
+}
+
+#[allow(dead_code)]
+trait InsufficientlyConstrainedGeneric<X=()> where X: Copy {
+    fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
+        //~^ ERROR the trait bound `X: Copy` is not satisfied
+        ConstrainedStruct { x }
+    }
+}
+
+pub fn main() { }
diff --git a/src/test/ui/trait-impl-bound-suggestions.rs b/src/test/ui/trait-impl-bound-suggestions.rs
new file mode 100644
index 00000000000..bf75175179e
--- /dev/null
+++ b/src/test/ui/trait-impl-bound-suggestions.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+
+#[allow(unused)]
+use std::fmt::Debug;
+// Rustfix should add this, or use `std::fmt::Debug` instead.
+
+#[allow(dead_code)]
+struct ConstrainedStruct<X: Copy> {
+    x: X
+}
+
+#[allow(dead_code)]
+trait InsufficientlyConstrainedGeneric<X=()> {
+    fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
+        //~^ ERROR the trait bound `X: Copy` is not satisfied
+        ConstrainedStruct { x }
+    }
+}
+
+pub fn main() { }
diff --git a/src/test/ui/trait-impl-bound-suggestions.stderr b/src/test/ui/trait-impl-bound-suggestions.stderr
new file mode 100644
index 00000000000..3a21e9c6b2a
--- /dev/null
+++ b/src/test/ui/trait-impl-bound-suggestions.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `X: Copy` is not satisfied
+  --> $DIR/trait-impl-bound-suggestions.rs:14:52
+   |
+LL | struct ConstrainedStruct<X: Copy> {
+   |                             ---- required by this bound in `ConstrainedStruct`
+...
+LL |     fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
+   |                                                    ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `X`
+   |
+help: consider further restricting type parameter `X`
+   |
+LL | trait InsufficientlyConstrainedGeneric<X=()> where X: Copy {
+   |                                              ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr
index fa6f3422410..d8c7f595e62 100644
--- a/src/test/ui/type/type-check-defaults.stderr
+++ b/src/test/ui/type/type-check-defaults.stderr
@@ -56,8 +56,8 @@ LL | trait Base<T = String>: Super<T> { }
    |
 help: consider further restricting type parameter `T`
    |
-LL | trait Base<T = String>: Super<T>, T: Copy { }
-   |                                 ^^^^^^^^^
+LL | trait Base<T = String>: Super<T> where T: Copy { }
+   |                                  ^^^^^^^^^^^^^
 
 error[E0277]: cannot add `u8` to `i32`
   --> $DIR/type-check-defaults.rs:24:66
diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs
index 5323bc357c0..92b3d186fa1 100644
--- a/src/tools/lint-docs/src/lib.rs
+++ b/src/tools/lint-docs/src/lib.rs
@@ -402,9 +402,12 @@ fn generate_lint_output(
                 None => {
                     let rendered: Vec<&str> =
                         msgs.iter().filter_map(|msg| msg["rendered"].as_str()).collect();
+                    let non_json: Vec<&str> =
+                        stderr.lines().filter(|line| !line.starts_with('{')).collect();
                     Err(format!(
-                        "did not find lint `{}` in output of example, got:\n{}",
+                        "did not find lint `{}` in output of example, got:\n{}\n{}",
                         name,
+                        non_json.join("\n"),
                         rendered.join("\n")
                     )
                     .into())
diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer
-Subproject 0275b08d1521606fa733f76fe5d5707717456fb
+Subproject 0d03fe6ef57d3956e92382e0e1f1a916015191c