about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-02 20:58:33 +0000
committerbors <bors@rust-lang.org>2022-04-02 20:58:33 +0000
commit76d770ac21d9521db6a92a48c7b3d5b2cc535941 (patch)
tree9795d3e6cc67d2ae9fdf407c923076f2960ab531 /src
parent8f96ef4bb56f5d905ed89ed569ef97f50731c977 (diff)
parent0e528f062d51d90368728c163d66297173b07080 (diff)
downloadrust-76d770ac21d9521db6a92a48c7b3d5b2cc535941.tar.gz
rust-76d770ac21d9521db6a92a48c7b3d5b2cc535941.zip
Auto merge of #95600 - Dylan-DPC:rollup-580y2ra, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #95587 (Remove need for associated_type_bounds in std.)
 - #95589 (Include a header in .rlink files)
 - #95593 (diagnostics: add test case for bogus T:Sized suggestion)
 - #95597 (Refer to u8 by absolute path in expansion of thread_local)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make-fulldeps/separate-link-fail/Makefile7
-rw-r--r--src/test/ui/consts/const-eval/size-of-t.rs13
-rw-r--r--src/test/ui/consts/const-eval/size-of-t.stderr11
-rw-r--r--src/test/ui/thread-local/name-collision.rs15
4 files changed, 46 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/separate-link-fail/Makefile b/src/test/run-make-fulldeps/separate-link-fail/Makefile
new file mode 100644
index 00000000000..c759f42a235
--- /dev/null
+++ b/src/test/run-make-fulldeps/separate-link-fail/Makefile
@@ -0,0 +1,7 @@
+-include ../tools.mk
+
+all:
+	echo 'fn main(){}' > $(TMPDIR)/main.rs
+	# Make sure that this fails
+	! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt
+	$(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt
diff --git a/src/test/ui/consts/const-eval/size-of-t.rs b/src/test/ui/consts/const-eval/size-of-t.rs
new file mode 100644
index 00000000000..efbdeec7008
--- /dev/null
+++ b/src/test/ui/consts/const-eval/size-of-t.rs
@@ -0,0 +1,13 @@
+// https://github.com/rust-lang/rust/issues/69228
+// Used to give bogus suggestion about T not being Sized.
+
+use std::mem::size_of;
+
+fn foo<T>() {
+    let _arr: [u8; size_of::<T>()];
+    //~^ ERROR generic parameters may not be used in const operations
+    //~| NOTE cannot perform const operation
+    //~| NOTE type parameters may not be used in const expressions
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const-eval/size-of-t.stderr b/src/test/ui/consts/const-eval/size-of-t.stderr
new file mode 100644
index 00000000000..abe6410465e
--- /dev/null
+++ b/src/test/ui/consts/const-eval/size-of-t.stderr
@@ -0,0 +1,11 @@
+error: generic parameters may not be used in const operations
+  --> $DIR/size-of-t.rs:7:30
+   |
+LL |     let _arr: [u8; size_of::<T>()];
+   |                              ^ cannot perform const operation using `T`
+   |
+   = note: type parameters may not be used in const expressions
+   = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/thread-local/name-collision.rs b/src/test/ui/thread-local/name-collision.rs
new file mode 100644
index 00000000000..dcff9183ad9
--- /dev/null
+++ b/src/test/ui/thread-local/name-collision.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+#[allow(non_camel_case_types)]
+struct u8;
+
+std::thread_local! {
+    pub static A: i32 = f();
+    pub static B: i32 = const { 0 };
+}
+
+fn f() -> i32 {
+    0
+}
+
+fn main() {}