Skip to content

Commit 744a97b

Browse files
committed
Auto merge of rust-lang#105095 - matthiaskrgr:rollup-9pu7vrx, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#103065 (rustdoc-json: Document and Test that args can be patterns.) - rust-lang#104865 (Don't overwrite local changes when updating submodules) - rust-lang#104895 (Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code) - rust-lang#105063 (Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.) - rust-lang#105064 (rustdoc: add comment to confusing CSS `main { min-width: 0 }`) - rust-lang#105074 (Add Nicholas Bishop to `.mailmap`) - rust-lang#105081 (Add a regression test for rust-lang#104322) - rust-lang#105086 (rustdoc: clean up sidebar link CSS) - rust-lang#105091 (add Tshepang Mbambo to .mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1dcf6ad + ffb071f commit 744a97b

File tree

11 files changed

+206
-11
lines changed

11 files changed

+206
-11
lines changed

.mailmap

+3
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ Nathaniel Herman <[email protected]> Nathaniel Herman <[email protected]
402402
403403
Ngo Iok Ui (Wu Yu Wei) <[email protected]>
404404
Nicholas Baron <[email protected]>
405+
406+
405407
Nicholas Nethercote <[email protected]> <[email protected]>
406408
Nicholas Nethercote <[email protected]> <[email protected]>
407409
Nick Platt <[email protected]>
@@ -530,6 +532,7 @@ Tomas Koutsky <[email protected]>
530532
Torsten Weber <[email protected]>
531533
532534
535+
Tshepang Mbambo <[email protected]>
533536
Ty Overby <[email protected]>
534537
535538
Tyler Ruckinger <[email protected]>

compiler/rustc_middle/src/ty/diagnostics.rs

+6
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ pub fn suggest_constraining_type_params<'a>(
355355
));
356356
}
357357

358+
// FIXME: remove the suggestions that are from derive, as the span is not correct
359+
suggestions = suggestions
360+
.into_iter()
361+
.filter(|(span, _, _)| !span.in_derive_expansion())
362+
.collect::<Vec<_>>();
363+
358364
if suggestions.len() == 1 {
359365
let (span, suggestion, msg) = suggestions.pop().unwrap();
360366

src/bootstrap/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,10 @@ impl Build {
647647
if !update(true).status().map_or(false, |status| status.success()) {
648648
self.run(&mut update(false));
649649
}
650-
650+
self.run(Command::new("git").args(&["stash", "push"]).current_dir(&absolute_path));
651651
self.run(Command::new("git").args(&["reset", "-q", "--hard"]).current_dir(&absolute_path));
652-
self.run(Command::new("git").args(&["clean", "-qdfx"]).current_dir(absolute_path));
652+
self.run(Command::new("git").args(&["clean", "-qdfx"]).current_dir(&absolute_path));
653+
self.run(Command::new("git").args(&["stash", "pop"]).current_dir(absolute_path));
653654
}
654655

655656
/// If any submodule has been initialized already, sync it unconditionally.

src/librustdoc/html/static/css/rustdoc.css

+6-8
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ main {
314314
position: relative;
315315
flex-grow: 1;
316316
padding: 10px 15px 40px 45px;
317-
min-width: 0;
317+
min-width: 0; /* avoid growing beyond the size limit */
318318
}
319319

320320
.source main {
@@ -480,15 +480,11 @@ ul.block, .block li {
480480
list-style: none;
481481
}
482482

483-
.block a,
484-
.sidebar h2 a,
485-
.sidebar h3 a {
483+
.sidebar-elems a,
484+
.sidebar > h2 a {
486485
display: block;
487-
padding: 0.25rem;
486+
padding: 0.25rem; /* 4px */
488487
margin-left: -0.25rem;
489-
490-
text-overflow: ellipsis;
491-
overflow: hidden;
492488
}
493489

494490
.sidebar h2 {
@@ -522,6 +518,8 @@ ul.block, .block li {
522518

523519
.sidebar-elems .block li a {
524520
white-space: nowrap;
521+
text-overflow: ellipsis;
522+
overflow: hidden;
525523
}
526524

527525
.mobile-topbar {

src/rustdoc-json-types/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ pub struct FunctionPointer {
615615

616616
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
617617
pub struct FnDecl {
618+
/// List of argument names and their type.
619+
///
620+
/// Note that not all names will be valid identifiers, as some of
621+
/// them may be patterns.
618622
pub inputs: Vec<(String, Type)>,
619623
pub output: Option<Type>,
620624
pub c_variadic: bool,
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @is "$.index[*][?(@.name=='fst')].inner.decl.inputs[0][0]" '"(x, _)"'
2+
pub fn fst<X, Y>((x, _): (X, Y)) -> X {
3+
x
4+
}
5+
6+
// @is "$.index[*][?(@.name=='drop_int')].inner.decl.inputs[0][0]" '"_"'
7+
pub fn drop_int(_: i32) {}

src/test/rustdoc-json/traits/uses_extern_trait.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@ pub fn drop_default<T: core::default::Default>(_x: T) {}
33

44
// FIXME(adotinthevoid): Theses shouldn't be here
55
// @has "$.index[*][?(@.name=='Debug')]"
6-
// @set Debug_fmt = "$.index[*][?(@.name=='Debug')].inner.items[*]"
6+
7+
// Debug may have several items. All we depend on here the that `fmt` is first. See
8+
// https://github.com/rust-lang/rust/pull/104525#issuecomment-1331087852 for why we
9+
// can't use [*].
10+
11+
// @set Debug_fmt = "$.index[*][?(@.name=='Debug')].inner.items[0]"
712
// @has "$.index[*][?(@.name=='fmt')].id" $Debug_fmt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
4+
#![crate_type = "proc-macro"]
5+
6+
extern crate proc_macro;
7+
8+
use proc_macro::TokenStream;
9+
10+
#[proc_macro_derive(AddImpl)]
11+
12+
pub fn derive(input: TokenStream) -> TokenStream {
13+
"use std::cmp::Ordering;
14+
15+
impl<T> Ord for PriorityQueue<T> {
16+
fn cmp(&self, other: &Self) -> Ordering {
17+
self.0.cmp(&self.height)
18+
}
19+
}
20+
"
21+
.parse()
22+
.unwrap()
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// aux-build:issue-104884.rs
2+
3+
use std::collections::BinaryHeap;
4+
5+
#[macro_use]
6+
extern crate issue_104884;
7+
8+
#[derive(PartialEq, Eq, PartialOrd, Ord)]
9+
struct PriorityQueueEntry<T> {
10+
value: T,
11+
}
12+
13+
#[derive(PartialOrd, AddImpl)]
14+
//~^ ERROR can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
15+
//~| ERROR the trait bound `PriorityQueue<T>: Eq` is not satisfied
16+
//~| ERROR can't compare `T` with `T`
17+
18+
struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
error[E0277]: can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
2+
--> $DIR/issue-104884-trait-impl-sugg-err.rs:13:10
3+
|
4+
LL | #[derive(PartialOrd, AddImpl)]
5+
| ^^^^^^^^^^ no implementation for `PriorityQueue<T> == PriorityQueue<T>`
6+
|
7+
= help: the trait `PartialEq` is not implemented for `PriorityQueue<T>`
8+
note: required by a bound in `PartialOrd`
9+
--> $SRC_DIR/core/src/cmp.rs:LL:COL
10+
|
11+
LL | pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
12+
| ^^^^^^^^^^^^^^ required by this bound in `PartialOrd`
13+
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
14+
15+
error[E0277]: the trait bound `PriorityQueue<T>: Eq` is not satisfied
16+
--> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
17+
|
18+
LL | #[derive(PartialOrd, AddImpl)]
19+
| ^^^^^^^ the trait `Eq` is not implemented for `PriorityQueue<T>`
20+
|
21+
note: required by a bound in `Ord`
22+
--> $SRC_DIR/core/src/cmp.rs:LL:COL
23+
|
24+
LL | pub trait Ord: Eq + PartialOrd<Self> {
25+
| ^^ required by this bound in `Ord`
26+
= note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info)
27+
28+
error[E0277]: can't compare `T` with `T`
29+
--> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
30+
|
31+
LL | #[derive(PartialOrd, AddImpl)]
32+
| ^^^^^^^ no implementation for `T < T` and `T > T`
33+
|
34+
note: required for `PriorityQueue<T>` to implement `PartialOrd`
35+
--> $DIR/issue-104884-trait-impl-sugg-err.rs:13:10
36+
|
37+
LL | #[derive(PartialOrd, AddImpl)]
38+
| ^^^^^^^^^^
39+
note: required by a bound in `Ord`
40+
--> $SRC_DIR/core/src/cmp.rs:LL:COL
41+
|
42+
LL | pub trait Ord: Eq + PartialOrd<Self> {
43+
| ^^^^^^^^^^^^^^^^ required by this bound in `Ord`
44+
= note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
45+
46+
error: aborting due to 3 previous errors
47+
48+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/traits/issue-104322.rs

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// build-pass
2+
//
3+
// Tests that overflows do not occur in certain situations
4+
// related to generic diesel code
5+
6+
use mini_diesel::*;
7+
8+
pub trait HandleDelete<K> {}
9+
10+
pub fn handle_delete<D, R>()
11+
where
12+
R: HasTable,
13+
R::Table: HandleDelete<D> + 'static,
14+
{
15+
}
16+
17+
impl<K, T> HandleDelete<K> for T
18+
where
19+
T: Table + HasTable<Table = T> + 'static,
20+
K: 'static,
21+
&'static K: Identifiable<Table = T>,
22+
T::PrimaryKey: EqAll<<&'static K as Identifiable>::Id>,
23+
T::Query: FilterDsl<<T::PrimaryKey as EqAll<<&'static K as Identifiable>::Id>>::Output>,
24+
Filter<T::Query, <T::PrimaryKey as EqAll<<&'static K as Identifiable>::Id>>::Output>:
25+
IntoUpdateTarget<Table = T>,
26+
{
27+
}
28+
29+
mod mini_diesel {
30+
pub trait HasTable {
31+
type Table: Table;
32+
}
33+
34+
pub trait Identifiable: HasTable {
35+
type Id;
36+
}
37+
38+
pub trait EqAll<Rhs> {
39+
type Output;
40+
}
41+
42+
pub trait IntoUpdateTarget: HasTable {
43+
type WhereClause;
44+
}
45+
46+
pub trait Query {
47+
type SqlType;
48+
}
49+
50+
pub trait AsQuery {
51+
type Query: Query;
52+
}
53+
impl<T: Query> AsQuery for T {
54+
type Query = Self;
55+
}
56+
57+
pub trait FilterDsl<Predicate> {
58+
type Output;
59+
}
60+
61+
impl<T, Predicate> FilterDsl<Predicate> for T
62+
where
63+
T: Table,
64+
T::Query: FilterDsl<Predicate>,
65+
{
66+
type Output = Filter<T::Query, Predicate>;
67+
}
68+
69+
pub trait QuerySource {
70+
type FromClause;
71+
}
72+
73+
pub trait Table: QuerySource + AsQuery + Sized {
74+
type PrimaryKey;
75+
}
76+
77+
pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output;
78+
}
79+
80+
fn main() {}

0 commit comments

Comments
 (0)