about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-13 17:11:36 +0000
committerbors <bors@rust-lang.org>2019-07-13 17:11:36 +0000
commit69656fa4cbafc378fd63f9186d93b0df3cdd9320 (patch)
tree690b6c3c570374a457a346b7462c8c7c9061d6c3 /src/test
parentec30876f30082a7b32876bd78a8da01f11dcde1e (diff)
parent791ceb6a9c5dfeeeb5fc6098db2022a99c2eec18 (diff)
downloadrust-69656fa4cbafc378fd63f9186d93b0df3cdd9320.tar.gz
rust-69656fa4cbafc378fd63f9186d93b0df3cdd9320.zip
Auto merge of #62659 - Centril:rollup-90oz643, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #62577 (Add an AtomicCell abstraction)
 - #62585 (Make struct_tail normalize when possible)
 - #62604 (Handle errors during error recovery gracefully)
 - #62636 (rustbuild: Improve assert about building tools once)
 - #62651 (Make some rustc macros more hygienic)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass-fulldeps/newtype_index.rs6
-rw-r--r--src/test/ui/layout/issue-60431-unsized-tail-behind-projection.rs35
-rw-r--r--src/test/ui/parser/issue-62546.rs3
-rw-r--r--src/test/ui/parser/issue-62546.stderr17
4 files changed, 58 insertions, 3 deletions
diff --git a/src/test/run-pass-fulldeps/newtype_index.rs b/src/test/run-pass-fulldeps/newtype_index.rs
index 18b845eeecb..1192a44a6ee 100644
--- a/src/test/run-pass-fulldeps/newtype_index.rs
+++ b/src/test/run-pass-fulldeps/newtype_index.rs
@@ -1,9 +1,9 @@
-#![feature(rustc_attrs, rustc_private, step_trait)]
+#![feature(rustc_private)]
 
-#[macro_use] extern crate rustc_data_structures;
+extern crate rustc_data_structures;
 extern crate serialize as rustc_serialize;
 
-use rustc_data_structures::indexed_vec::Idx;
+use rustc_data_structures::{newtype_index, indexed_vec::Idx};
 
 newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });
 
diff --git a/src/test/ui/layout/issue-60431-unsized-tail-behind-projection.rs b/src/test/ui/layout/issue-60431-unsized-tail-behind-projection.rs
new file mode 100644
index 00000000000..65845d2c9fe
--- /dev/null
+++ b/src/test/ui/layout/issue-60431-unsized-tail-behind-projection.rs
@@ -0,0 +1,35 @@
+// rust-lang/rust#60431: This is a scenario where to determine the size of
+// `&Ref<Obstack>`, we need to know the concrete type of the last field in
+// `Ref<Obstack>` (i.e. its "struct tail"), and determining that concrete type
+// requires normalizing `Obstack::Dyn`.
+//
+// The old "struct tail" computation did not perform such normalization, and so
+// the compiler would ICE when trying to figure out if `Ref<Obstack>` is a
+// dynamically-sized type (DST).
+
+// run-pass
+
+use std::mem;
+
+pub trait Arena {
+    type Dyn : ?Sized;
+}
+
+pub struct DynRef {
+    _dummy: [()],
+}
+
+pub struct Ref<A: Arena> {
+    _value: u8,
+    _dyn_arena: A::Dyn,
+}
+
+pub struct Obstack;
+
+impl Arena for Obstack {
+    type Dyn = DynRef;
+}
+
+fn main() {
+    assert_eq!(mem::size_of::<&Ref<Obstack>>(), mem::size_of::<&[()]>());
+}
diff --git a/src/test/ui/parser/issue-62546.rs b/src/test/ui/parser/issue-62546.rs
new file mode 100644
index 00000000000..75b95e74073
--- /dev/null
+++ b/src/test/ui/parser/issue-62546.rs
@@ -0,0 +1,3 @@
+pub t(#
+//~^ ERROR missing `fn` or `struct` for function or struct definition
+//~ ERROR this file contains an un-closed delimiter
diff --git a/src/test/ui/parser/issue-62546.stderr b/src/test/ui/parser/issue-62546.stderr
new file mode 100644
index 00000000000..631aac95505
--- /dev/null
+++ b/src/test/ui/parser/issue-62546.stderr
@@ -0,0 +1,17 @@
+error: this file contains an un-closed delimiter
+  --> $DIR/issue-62546.rs:3:53
+   |
+LL | pub t(#
+   |      - un-closed delimiter
+LL |
+LL |
+   |                                                     ^
+
+error: missing `fn` or `struct` for function or struct definition
+  --> $DIR/issue-62546.rs:1:4
+   |
+LL | pub t(#
+   | ---^- help: if you meant to call a macro, try: `t!`
+
+error: aborting due to 2 previous errors
+