Skip to content

Commit 2730354

Browse files
committed
Auto merge of rust-lang#119962 - GuillaumeGomez:rollup-mj7agm6, r=GuillaumeGomez
Rollup of 3 pull requests Successful merges: - rust-lang#119944 (Don't ICE when noting GAT bounds in `report_no_match_method_error`) - rust-lang#119949 (Add note on SpecOptionPartialEq to `newtype_index`) - rust-lang#119961 ([meta] Remove Zulip rustdoc nomination alert) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8847bda + 7841d26 commit 2730354

File tree

6 files changed

+100
-15
lines changed

6 files changed

+100
-15
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
825825
"auto trait is invoked with no method error, but no error reported?",
826826
);
827827
}
828-
Some(Node::Item(hir::Item {
829-
ident,
830-
kind: hir::ItemKind::Trait(..) | hir::ItemKind::TraitAlias(..),
831-
..
832-
})) => {
828+
Some(
829+
Node::Item(hir::Item {
830+
ident,
831+
kind: hir::ItemKind::Trait(..) | hir::ItemKind::TraitAlias(..),
832+
..
833+
})
834+
// We may also encounter unsatisfied GAT or method bounds
835+
| Node::TraitItem(hir::TraitItem { ident, .. })
836+
| Node::ImplItem(hir::ImplItem { ident, .. }),
837+
) => {
833838
skip_list.insert(p);
834839
let entry = spanned_predicates.entry(ident.span);
835840
let entry = entry.or_insert_with(|| {
@@ -840,7 +845,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
840845
entry.1.insert((cause_span, "unsatisfied trait bound introduced here"));
841846
entry.2.push(p);
842847
}
843-
Some(node) => unreachable!("encountered `{node:?}`"),
848+
Some(node) => unreachable!("encountered `{node:?}` due to `{cause:#?}`"),
844849
None => (),
845850
}
846851
}

compiler/rustc_index_macros/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ mod newtype;
3131
/// - `#[max = 0xFFFF_FFFD]`: specifies the max value, which allows niche
3232
/// optimizations. The default max value is 0xFFFF_FF00.
3333
/// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only.
34+
///
35+
/// `SpecOptionPartialEq` is specialized by this macro, so using it requires enabling
36+
/// `#![feature(min_specialization)]` for the crate.
3437
#[proc_macro]
3538
#[cfg_attr(
3639
feature = "nightly",

library/core/src/option.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,7 @@ impl<T: PartialEq> PartialEq for Option<T> {
21472147
///
21482148
/// Once that's fixed, `Option` should go back to deriving `PartialEq`, as
21492149
/// it used to do before <https://github.com/rust-lang/rust/pull/103556>.
2150+
/// The comment regarding this trait on the `newtype_index` macro should be removed if this is done.
21502151
#[unstable(feature = "spec_option_partial_eq", issue = "none", reason = "exposed only for rustc")]
21512152
#[doc(hidden)]
21522153
pub trait SpecOptionPartialEq: Sized {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use std::ops::Deref;
2+
3+
trait PointerFamily {
4+
type Pointer<T>: Deref<Target = T>;
5+
}
6+
7+
struct RcFamily;
8+
9+
impl PointerFamily for RcFamily {
10+
type Pointer<T> = dyn Deref<Target = T>;
11+
//~^ ERROR the size for values of type `(dyn Deref<Target = T> + 'static)` cannot be known at compilation time
12+
}
13+
14+
enum Node<T, P: PointerFamily> {
15+
Cons(T, P::Pointer<Node<T, P>>),
16+
Nil,
17+
}
18+
19+
type RcNode<T> = Node<T, RcFamily>;
20+
21+
impl<T, P: PointerFamily> Node<T, P>
22+
where
23+
P::Pointer<Node<T, P>>: Sized,
24+
{
25+
fn new() -> P::Pointer<Self> {
26+
todo!()
27+
}
28+
}
29+
30+
fn main() {
31+
let mut list = RcNode::<i32>::new();
32+
//~^ ERROR the size for values of type `Node<i32, RcFamily>` cannot be known at compilation time
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error[E0277]: the size for values of type `(dyn Deref<Target = T> + 'static)` cannot be known at compilation time
2+
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:10:23
3+
|
4+
LL | type Pointer<T> = dyn Deref<Target = T>;
5+
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `(dyn Deref<Target = T> + 'static)`
8+
note: required by a bound in `PointerFamily::Pointer`
9+
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:4:5
10+
|
11+
LL | type Pointer<T>: Deref<Target = T>;
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `PointerFamily::Pointer`
13+
help: consider relaxing the implicit `Sized` restriction
14+
|
15+
LL | type Pointer<T>: Deref<Target = T> + ?Sized;
16+
| ++++++++
17+
18+
error[E0599]: the size for values of type `Node<i32, RcFamily>` cannot be known at compilation time
19+
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:31:35
20+
|
21+
LL | enum Node<T, P: PointerFamily> {
22+
| ------------------------------
23+
| |
24+
| variant or associated item `new` not found for this enum
25+
| doesn't satisfy `Node<i32, RcFamily>: Sized`
26+
...
27+
LL | let mut list = RcNode::<i32>::new();
28+
| ^^^ doesn't have a size known at compile-time
29+
--> $SRC_DIR/core/src/ops/deref.rs:LL:COL
30+
|
31+
= note: doesn't satisfy `_: Sized`
32+
|
33+
note: trait bound `Node<i32, RcFamily>: Sized` was not satisfied
34+
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:4:18
35+
|
36+
LL | type Pointer<T>: Deref<Target = T>;
37+
| ------- ^ unsatisfied trait bound introduced here
38+
note: trait bound `(dyn Deref<Target = Node<i32, RcFamily>> + 'static): Sized` was not satisfied
39+
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:23:29
40+
|
41+
LL | impl<T, P: PointerFamily> Node<T, P>
42+
| ----------
43+
LL | where
44+
LL | P::Pointer<Node<T, P>>: Sized,
45+
| ^^^^^ unsatisfied trait bound introduced here
46+
note: the trait `Sized` must be implemented
47+
--> $SRC_DIR/core/src/marker.rs:LL:COL
48+
49+
error: aborting due to 2 previous errors
50+
51+
Some errors have detailed explanations: E0277, E0599.
52+
For more information about an error, try `rustc --explain E0277`.

triagebot.toml

-9
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,6 @@ message_on_remove = "Issue #{number}'s prioritization request has been removed."
389389
message_on_close = "Issue #{number} has been closed while requested for prioritization."
390390
message_on_reopen = "Issue #{number} has been reopened."
391391

392-
[notify-zulip."T-rustdoc"]
393-
required_labels = ["I-nominated"]
394-
zulip_stream = 266220 # #rustdoc
395-
topic = "nominated: #{number}"
396-
message_on_add = """\
397-
@*T-rustdoc* issue #{number} "{title}" has been nominated for `T-rustdoc` discussion.
398-
"""
399-
message_on_remove = "Issue #{number}'s nomination request has been removed."
400-
401392
[notify-zulip."I-types-nominated"]
402393
zulip_stream = 326866 # #T-types/nominated
403394
topic = "#{number}: {title}"

0 commit comments

Comments
 (0)