about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-27 10:05:16 +0000
committerbors <bors@rust-lang.org>2022-10-27 10:05:16 +0000
commit0da281b6068a7d889ae89a9bd8991284cc9b7535 (patch)
tree85ff8caeb0d7c81c6899184d87dd3cb61817b6ea /src
parent9dd3d29ec848efd753667292277fd9f297d7db8d (diff)
parent2252f7aa78f4a75704137e666eae2fbedc0d600e (diff)
downloadrust-0da281b6068a7d889ae89a9bd8991284cc9b7535.tar.gz
rust-0da281b6068a7d889ae89a9bd8991284cc9b7535.zip
Auto merge of #103623 - matthiaskrgr:rollup-318yc1t, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #103035 (Even nicer errors from assert_unsafe_precondition)
 - #103106 (Try to say that memory outside the AM is always exposed)
 - #103475 (Make param index generation a bit more robust)
 - #103525 (Move a wf-check into the site where the value is instantiated)
 - #103564 (library: allow some unused things in Miri)
 - #103586 (Process registered region obligation in `resolve_regions_with_wf_tys`)
 - #103592 (rustdoc: remove redundant CSS selector `.notable-traits .notable`)
 - #103593 (Remove an unused parser function (`Expr::returns`))
 - #103611 (Add test for issue 103574)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css2
-rw-r--r--src/test/rustdoc-gui/notable-trait.goml39
-rw-r--r--src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs10
-rw-r--r--src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs9
-rw-r--r--src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr31
-rw-r--r--src/test/ui/marker_trait_attr/overlap-marker-trait.rs3
-rw-r--r--src/test/ui/marker_trait_attr/overlap-marker-trait.stderr4
-rw-r--r--src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs3
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr4
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr4
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr8
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr4
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr4
-rw-r--r--src/test/ui/wf/issue-103573.rs22
-rw-r--r--src/test/ui/wf/issue-103573.stderr14
15 files changed, 143 insertions, 18 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index b60c7719563..5a1a6c0f0f9 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1293,7 +1293,7 @@ h3.variant {
 	content: "\00a0\00a0\00a0";
 }
 
-.notable-traits .notable, .notable-traits .docblock {
+.notable-traits .docblock {
 	margin: 0;
 }
 
diff --git a/src/test/rustdoc-gui/notable-trait.goml b/src/test/rustdoc-gui/notable-trait.goml
index 997fb5cf0ad..efe0cb15f08 100644
--- a/src/test/rustdoc-gui/notable-trait.goml
+++ b/src/test/rustdoc-gui/notable-trait.goml
@@ -24,7 +24,23 @@ assert-position: (
     "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
     {"x": 951},
 )
-
+// The tooltip should be beside the `i`
+click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
+compare-elements-position-near: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
+    {"y": 2}
+)
+compare-elements-position-false: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
+    ("x")
+)
+// The docblock should be flush with the border.
+assert-css: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']/*[@class='docblock']",
+    {"margin-left": "0px"}
+)
 
 // Now only the `i` should be on the next line.
 size: (1055, 600)
@@ -81,6 +97,27 @@ assert-position: (
     "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
     {"x": 289},
 )
+// The tooltip should be below `i`
+compare-elements-position-near-false: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
+    {"y": 2}
+)
+compare-elements-position-false: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
+    ("x")
+)
+compare-elements-position-near: (
+    "//*[@id='method.create_an_iterator_from_read']/parent::*",
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
+    {"x": 5}
+)
+// The docblock should be flush with the border.
+assert-css: (
+    "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']/*[@class='docblock']",
+    {"margin-left": "0px"}
+)
 
 // Checking on very small mobile. The `i` should be on its own line.
 size: (365, 600)
diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs
new file mode 100644
index 00000000000..62aa22d41ed
--- /dev/null
+++ b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs
@@ -0,0 +1,10 @@
+// check-pass
+#![feature(marker_trait_attr)]
+
+#[marker]
+trait Marker {}
+
+impl Marker for &'static () {}
+impl Marker for &'static () {}
+
+fn main() {}
diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs
new file mode 100644
index 00000000000..eabce1aeff1
--- /dev/null
+++ b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs
@@ -0,0 +1,9 @@
+#![feature(marker_trait_attr)]
+
+#[marker]
+trait Marker {}
+
+impl Marker for &'_ () {} //~ ERROR type annotations needed
+impl Marker for &'_ () {} //~ ERROR type annotations needed
+
+fn main() {}
diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr
new file mode 100644
index 00000000000..235c89e200a
--- /dev/null
+++ b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr
@@ -0,0 +1,31 @@
+error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
+  --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:6
+   |
+LL | impl Marker for &'_ () {}
+   |      ^^^^^^
+   |
+note: multiple `impl`s satisfying `&(): Marker` found
+  --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1
+   |
+LL | impl Marker for &'_ () {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+LL | impl Marker for &'_ () {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
+  --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:6
+   |
+LL | impl Marker for &'_ () {}
+   |      ^^^^^^
+   |
+note: multiple `impl`s satisfying `&(): Marker` found
+  --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1
+   |
+LL | impl Marker for &'_ () {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+LL | impl Marker for &'_ () {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait.rs
index 8794d42f411..67e55179775 100644
--- a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs
+++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.rs
@@ -7,7 +7,8 @@
 
 use std::fmt::{Debug, Display};
 
-#[marker] trait Marker {}
+#[marker]
+trait Marker {}
 
 impl<T: Debug> Marker for T {}
 impl<T: Display> Marker for T {}
diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr
index 1f341059794..133bc0484ee 100644
--- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr
+++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
-  --> $DIR/overlap-marker-trait.rs:27:17
+  --> $DIR/overlap-marker-trait.rs:28:17
    |
 LL |     is_marker::<NotDebugOrDisplay>();
    |                 ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
    |
 note: required by a bound in `is_marker`
-  --> $DIR/overlap-marker-trait.rs:15:17
+  --> $DIR/overlap-marker-trait.rs:16:17
    |
 LL | fn is_marker<T: Marker>() { }
    |                 ^^^^^^ required by this bound in `is_marker`
diff --git a/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs b/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs
index 38331390237..f7654458feb 100644
--- a/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs
+++ b/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs
@@ -7,7 +7,8 @@
 
 use std::fmt::{Debug, Display};
 
-#[marker] trait MyMarker {}
+#[marker]
+trait MyMarker {}
 
 impl<T: Debug> MyMarker for T {}
 impl<T: Display> MyMarker for T {}
diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
index b86acb2cc9a..d4f42b787e4 100644
--- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
+++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
@@ -1,8 +1,8 @@
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-2.rs:11:12
+  --> $DIR/super-traits-fail-2.rs:11:19
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^^^^^
+   |                   ^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
index b86acb2cc9a..d4f42b787e4 100644
--- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
+++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
@@ -1,8 +1,8 @@
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-2.rs:11:12
+  --> $DIR/super-traits-fail-2.rs:11:19
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^^^^^
+   |                   ^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index 191edca1761..d433e1cfa69 100644
--- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -1,14 +1,14 @@
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:12:12
+  --> $DIR/super-traits-fail-3.rs:12:19
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^^^^^
+   |                   ^^^
 
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:15:17
+  --> $DIR/super-traits-fail-3.rs:15:24
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^^^^^
+   |                        ^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
index a3b4c302a57..2a7e8e00bc7 100644
--- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
+++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
@@ -1,8 +1,8 @@
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:12:12
+  --> $DIR/super-traits-fail-3.rs:12:19
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^^^^^
+   |                   ^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
index 9d611665465..e5978c12a09 100644
--- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
+++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
@@ -1,8 +1,8 @@
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:15:17
+  --> $DIR/super-traits-fail-3.rs:15:24
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^^^^^
+   |                        ^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/wf/issue-103573.rs b/src/test/ui/wf/issue-103573.rs
new file mode 100644
index 00000000000..bcbf4f941ec
--- /dev/null
+++ b/src/test/ui/wf/issue-103573.rs
@@ -0,0 +1,22 @@
+trait TraitA {
+    type TypeA;
+}
+
+trait TraitD {
+    type TypeD;
+}
+
+pub trait TraitB {
+    type TypeB: TraitD;
+
+    fn f(_: &<Self::TypeB as TraitD>::TypeD);
+}
+
+pub trait TraitC<E> {
+    type TypeC<'a>: TraitB;
+
+    fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
+    //~^ ERROR the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
+}
+
+fn main() {}
diff --git a/src/test/ui/wf/issue-103573.stderr b/src/test/ui/wf/issue-103573.stderr
new file mode 100644
index 00000000000..fcf3f15e4d3
--- /dev/null
+++ b/src/test/ui/wf/issue-103573.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
+  --> $DIR/issue-103573.rs:18:5
+   |
+LL |     fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB`
+   |
+help: consider further restricting the associated type
+   |
+LL |     fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA) where <<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA;
+   |                                                                         +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.