Skip to content

Commit 56438c3

Browse files
committed
Auto merge of #3648 - rust-lang:rustup-2024-06-05, r=RalfJung
Automatic Rustup
2 parents 58f3894 + 9a77692 commit 56438c3

File tree

1,370 files changed

+15135
-10206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,370 files changed

+15135
-10206
lines changed

Cargo.lock

Lines changed: 150 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,21 @@ dependencies = [
284284
"nom",
285285
]
286286

287+
[[package]]
288+
name = "assert_cmd"
289+
version = "2.0.14"
290+
source = "registry+https://github.com/rust-lang/crates.io-index"
291+
checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8"
292+
dependencies = [
293+
"anstyle",
294+
"bstr",
295+
"doc-comment",
296+
"predicates",
297+
"predicates-core",
298+
"predicates-tree",
299+
"wait-timeout",
300+
]
301+
287302
[[package]]
288303
name = "autocfg"
289304
version = "1.3.0"
@@ -1095,6 +1110,12 @@ version = "0.1.13"
10951110
source = "registry+https://github.com/rust-lang/crates.io-index"
10961111
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
10971112

1113+
[[package]]
1114+
name = "difflib"
1115+
version = "0.4.0"
1116+
source = "registry+https://github.com/rust-lang/crates.io-index"
1117+
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
1118+
10981119
[[package]]
10991120
name = "digest"
11001121
version = "0.10.7"
@@ -1197,6 +1218,12 @@ dependencies = [
11971218
"windows-sys 0.52.0",
11981219
]
11991220

1221+
[[package]]
1222+
name = "doc-comment"
1223+
version = "0.3.3"
1224+
source = "registry+https://github.com/rust-lang/crates.io-index"
1225+
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
1226+
12001227
[[package]]
12011228
name = "either"
12021229
version = "1.12.0"
@@ -2337,6 +2364,33 @@ dependencies = [
23372364
"topological-sort",
23382365
]
23392366

2367+
[[package]]
2368+
name = "mdbook-trpl-listing"
2369+
version = "0.1.0"
2370+
dependencies = [
2371+
"assert_cmd",
2372+
"clap",
2373+
"mdbook",
2374+
"pulldown-cmark 0.10.3",
2375+
"pulldown-cmark-to-cmark",
2376+
"serde_json",
2377+
"thiserror",
2378+
"toml 0.8.13",
2379+
"xmlparser",
2380+
]
2381+
2382+
[[package]]
2383+
name = "mdbook-trpl-note"
2384+
version = "1.0.0"
2385+
dependencies = [
2386+
"assert_cmd",
2387+
"clap",
2388+
"mdbook",
2389+
"pulldown-cmark 0.10.3",
2390+
"pulldown-cmark-to-cmark",
2391+
"serde_json",
2392+
]
2393+
23402394
[[package]]
23412395
name = "measureme"
23422396
version = "11.0.1"
@@ -2949,6 +3003,33 @@ version = "0.1.1"
29493003
source = "registry+https://github.com/rust-lang/crates.io-index"
29503004
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
29513005

3006+
[[package]]
3007+
name = "predicates"
3008+
version = "3.1.0"
3009+
source = "registry+https://github.com/rust-lang/crates.io-index"
3010+
checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8"
3011+
dependencies = [
3012+
"anstyle",
3013+
"difflib",
3014+
"predicates-core",
3015+
]
3016+
3017+
[[package]]
3018+
name = "predicates-core"
3019+
version = "1.0.6"
3020+
source = "registry+https://github.com/rust-lang/crates.io-index"
3021+
checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174"
3022+
3023+
[[package]]
3024+
name = "predicates-tree"
3025+
version = "1.0.9"
3026+
source = "registry+https://github.com/rust-lang/crates.io-index"
3027+
checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf"
3028+
dependencies = [
3029+
"predicates-core",
3030+
"termtree",
3031+
]
3032+
29523033
[[package]]
29533034
name = "prettydiff"
29543035
version = "0.6.4"
@@ -3018,6 +3099,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30183099
checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993"
30193100
dependencies = [
30203101
"bitflags 2.5.0",
3102+
"getopts",
30213103
"memchr",
30223104
"pulldown-cmark-escape",
30233105
"unicase",
@@ -3029,6 +3111,15 @@ version = "0.10.1"
30293111
source = "registry+https://github.com/rust-lang/crates.io-index"
30303112
checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3"
30313113

3114+
[[package]]
3115+
name = "pulldown-cmark-to-cmark"
3116+
version = "13.0.0"
3117+
source = "registry+https://github.com/rust-lang/crates.io-index"
3118+
checksum = "f609795c8d835f79dcfcf768415b9fb57ef1b74891e99f86e73f43a7a257163b"
3119+
dependencies = [
3120+
"pulldown-cmark 0.10.3",
3121+
]
3122+
30323123
[[package]]
30333124
name = "punycode"
30343125
version = "0.4.1"
@@ -3276,6 +3367,8 @@ dependencies = [
32763367
"clap",
32773368
"env_logger",
32783369
"mdbook",
3370+
"mdbook-trpl-listing",
3371+
"mdbook-trpl-note",
32793372
]
32803373

32813374
[[package]]
@@ -5386,6 +5479,12 @@ dependencies = [
53865479
"winapi",
53875480
]
53885481

5482+
[[package]]
5483+
name = "termtree"
5484+
version = "0.4.1"
5485+
source = "registry+https://github.com/rust-lang/crates.io-index"
5486+
checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
5487+
53895488
[[package]]
53905489
name = "test"
53915490
version = "0.0.0"
@@ -5558,7 +5657,19 @@ dependencies = [
55585657
"serde",
55595658
"serde_spanned",
55605659
"toml_datetime",
5561-
"toml_edit",
5660+
"toml_edit 0.19.15",
5661+
]
5662+
5663+
[[package]]
5664+
name = "toml"
5665+
version = "0.8.13"
5666+
source = "registry+https://github.com/rust-lang/crates.io-index"
5667+
checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba"
5668+
dependencies = [
5669+
"serde",
5670+
"serde_spanned",
5671+
"toml_datetime",
5672+
"toml_edit 0.22.13",
55625673
]
55635674

55645675
[[package]]
@@ -5580,7 +5691,20 @@ dependencies = [
55805691
"serde",
55815692
"serde_spanned",
55825693
"toml_datetime",
5583-
"winnow",
5694+
"winnow 0.5.40",
5695+
]
5696+
5697+
[[package]]
5698+
name = "toml_edit"
5699+
version = "0.22.13"
5700+
source = "registry+https://github.com/rust-lang/crates.io-index"
5701+
checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
5702+
dependencies = [
5703+
"indexmap",
5704+
"serde",
5705+
"serde_spanned",
5706+
"toml_datetime",
5707+
"winnow 0.6.8",
55845708
]
55855709

55865710
[[package]]
@@ -5990,6 +6114,15 @@ version = "0.9.4"
59906114
source = "registry+https://github.com/rust-lang/crates.io-index"
59916115
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
59926116

6117+
[[package]]
6118+
name = "wait-timeout"
6119+
version = "0.2.0"
6120+
source = "registry+https://github.com/rust-lang/crates.io-index"
6121+
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
6122+
dependencies = [
6123+
"libc",
6124+
]
6125+
59936126
[[package]]
59946127
name = "walkdir"
59956128
version = "2.5.0"
@@ -6302,6 +6435,15 @@ dependencies = [
63026435
"memchr",
63036436
]
63046437

6438+
[[package]]
6439+
name = "winnow"
6440+
version = "0.6.8"
6441+
source = "registry+https://github.com/rust-lang/crates.io-index"
6442+
checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d"
6443+
dependencies = [
6444+
"memchr",
6445+
]
6446+
63056447
[[package]]
63066448
name = "writeable"
63076449
version = "0.5.4"
@@ -6319,6 +6461,12 @@ dependencies = [
63196461
"rustix",
63206462
]
63216463

6464+
[[package]]
6465+
name = "xmlparser"
6466+
version = "0.13.6"
6467+
source = "registry+https://github.com/rust-lang/crates.io-index"
6468+
checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"
6469+
63226470
[[package]]
63236471
name = "xz2"
63246472
version = "0.1.7"

compiler/rustc_ast/src/ast.rs

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl PathSegment {
167167
}
168168
}
169169

170-
/// The arguments of a path segment.
170+
/// The generic arguments and associated item constraints of a path segment.
171171
///
172172
/// E.g., `<A, B>` as in `Foo<A, B>` or `(A, B)` as in `Foo(A, B)`.
173173
#[derive(Clone, Encodable, Decodable, Debug)]
@@ -221,14 +221,13 @@ pub struct AngleBracketedArgs {
221221
pub args: ThinVec<AngleBracketedArg>,
222222
}
223223

224-
/// Either an argument for a parameter e.g., `'a`, `Vec<u8>`, `0`,
225-
/// or a constraint on an associated item, e.g., `Item = String` or `Item: Bound`.
224+
/// Either an argument for a generic parameter or a constraint on an associated item.
226225
#[derive(Clone, Encodable, Decodable, Debug)]
227226
pub enum AngleBracketedArg {
228-
/// Argument for a generic parameter.
227+
/// A generic argument for a generic parameter.
229228
Arg(GenericArg),
230-
/// Constraint for an associated item.
231-
Constraint(AssocConstraint),
229+
/// A constraint on an associated item.
230+
Constraint(AssocItemConstraint),
232231
}
233232

234233
impl AngleBracketedArg {
@@ -418,7 +417,7 @@ impl Default for WhereClause {
418417
/// A single predicate in a where-clause.
419418
#[derive(Clone, Encodable, Decodable, Debug)]
420419
pub enum WherePredicate {
421-
/// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`).
420+
/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
422421
BoundPredicate(WhereBoundPredicate),
423422
/// A lifetime predicate (e.g., `'a: 'b + 'c`).
424423
RegionPredicate(WhereRegionPredicate),
@@ -2034,18 +2033,25 @@ impl UintTy {
20342033
}
20352034
}
20362035

2037-
/// A constraint on an associated type (e.g., `A = Bar` in `Foo<A = Bar>` or
2038-
/// `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`).
2039-
#[derive(Clone, Encodable, Decodable, Debug)]
2040-
pub struct AssocConstraint {
2036+
/// A constraint on an associated item.
2037+
///
2038+
/// ### Examples
2039+
///
2040+
/// * the `A = Ty` and `B = Ty` in `Trait<A = Ty, B = Ty>`
2041+
/// * the `G<Ty> = Ty` in `Trait<G<Ty> = Ty>`
2042+
/// * the `A: Bound` in `Trait<A: Bound>`
2043+
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
2044+
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `associated_const_equality`)
2045+
/// * the `f(): Bound` in `Trait<f(): Bound>` (feature `return_type_notation`)
2046+
#[derive(Clone, Encodable, Decodable, Debug)]
2047+
pub struct AssocItemConstraint {
20412048
pub id: NodeId,
20422049
pub ident: Ident,
20432050
pub gen_args: Option<GenericArgs>,
2044-
pub kind: AssocConstraintKind,
2051+
pub kind: AssocItemConstraintKind,
20452052
pub span: Span,
20462053
}
20472054

2048-
/// The kinds of an `AssocConstraint`.
20492055
#[derive(Clone, Encodable, Decodable, Debug)]
20502056
pub enum Term {
20512057
Ty(P<Ty>),
@@ -2064,12 +2070,17 @@ impl From<AnonConst> for Term {
20642070
}
20652071
}
20662072

2067-
/// The kinds of an `AssocConstraint`.
2073+
/// The kind of [associated item constraint][AssocItemConstraint].
20682074
#[derive(Clone, Encodable, Decodable, Debug)]
2069-
pub enum AssocConstraintKind {
2070-
/// E.g., `A = Bar`, `A = 3` in `Foo<A = Bar>` where A is an associated type.
2075+
pub enum AssocItemConstraintKind {
2076+
/// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait<AssocTy = Ty>`).
2077+
///
2078+
/// Also known as an *associated item binding* (we *bind* an associated item to a term).
2079+
///
2080+
/// Furthermore, associated type equality constraints can also be referred to as *associated type
2081+
/// bindings*. Similarly with associated const equality constraints and *associated const bindings*.
20712082
Equality { term: Term },
2072-
/// E.g. `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`.
2083+
/// A bound on an associated type (e.g., `AssocTy: Bound` in `Trait<AssocTy: Bound>`).
20732084
Bound { bounds: GenericBounds },
20742085
}
20752086

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ pub trait MutVisitor: Sized {
175175
noop_visit_lifetime(l, self);
176176
}
177177

178-
fn visit_constraint(&mut self, t: &mut AssocConstraint) {
179-
noop_visit_constraint(t, self);
178+
fn visit_assoc_item_constraint(&mut self, c: &mut AssocItemConstraint) {
179+
noop_visit_assoc_item_constraint(c, self);
180180
}
181181

182182
fn visit_foreign_mod(&mut self, nm: &mut ForeignMod) {
@@ -463,8 +463,8 @@ pub fn noop_flat_map_arm<T: MutVisitor>(mut arm: Arm, vis: &mut T) -> SmallVec<[
463463
smallvec![arm]
464464
}
465465

466-
fn noop_visit_constraint<T: MutVisitor>(
467-
AssocConstraint { id, ident, gen_args, kind, span }: &mut AssocConstraint,
466+
fn noop_visit_assoc_item_constraint<T: MutVisitor>(
467+
AssocItemConstraint { id, ident, gen_args, kind, span }: &mut AssocItemConstraint,
468468
vis: &mut T,
469469
) {
470470
vis.visit_id(id);
@@ -473,11 +473,11 @@ fn noop_visit_constraint<T: MutVisitor>(
473473
vis.visit_generic_args(gen_args);
474474
}
475475
match kind {
476-
AssocConstraintKind::Equality { term } => match term {
476+
AssocItemConstraintKind::Equality { term } => match term {
477477
Term::Ty(ty) => vis.visit_ty(ty),
478478
Term::Const(c) => vis.visit_anon_const(c),
479479
},
480-
AssocConstraintKind::Bound { bounds } => visit_bounds(bounds, vis),
480+
AssocItemConstraintKind::Bound { bounds } => visit_bounds(bounds, vis),
481481
}
482482
vis.visit_span(span);
483483
}
@@ -607,7 +607,7 @@ fn noop_visit_angle_bracketed_parameter_data<T: MutVisitor>(
607607
let AngleBracketedArgs { args, span } = data;
608608
visit_thin_vec(args, |arg| match arg {
609609
AngleBracketedArg::Arg(arg) => vis.visit_generic_arg(arg),
610-
AngleBracketedArg::Constraint(constraint) => vis.visit_constraint(constraint),
610+
AngleBracketedArg::Constraint(constraint) => vis.visit_assoc_item_constraint(constraint),
611611
});
612612
vis.visit_span(span);
613613
}

0 commit comments

Comments
 (0)