Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7bc7be8

Browse files
committedJan 18, 2022
Auto merge of rust-lang#87648 - JulianKnodt:const_eq_constrain, r=oli-obk
allow eq constraints on associated constants Updates rust-lang#70256 (cc `@varkor,` `@Centril)`
2 parents 7531d2f + b77bb5c commit 7bc7be8

File tree

83 files changed

+776
-382
lines changed

Some content is hidden

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

83 files changed

+776
-382
lines changed
 

‎Cargo.lock

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ dependencies = [
335335
"cargo-test-macro",
336336
"cargo-test-support",
337337
"cargo-util",
338-
"clap 3.0.6",
338+
"clap",
339339
"crates-io",
340340
"crossbeam-utils",
341341
"curl",
@@ -615,28 +615,13 @@ dependencies = [
615615
"ansi_term 0.12.1",
616616
"atty",
617617
"bitflags",
618-
"strsim 0.8.0",
619-
"textwrap 0.11.0",
618+
"strsim",
619+
"textwrap",
620620
"unicode-width",
621621
"vec_map",
622622
"yaml-rust 0.3.5",
623623
]
624624

625-
[[package]]
626-
name = "clap"
627-
version = "3.0.6"
628-
source = "registry+https://github.com/rust-lang/crates.io-index"
629-
checksum = "1957aa4a5fb388f0a0a73ce7556c5b42025b874e5cdc2c670775e346e97adec0"
630-
dependencies = [
631-
"atty",
632-
"bitflags",
633-
"indexmap",
634-
"os_str_bytes",
635-
"strsim 0.10.0",
636-
"termcolor",
637-
"textwrap 0.14.2",
638-
]
639-
640625
[[package]]
641626
name = "clippy"
642627
version = "0.1.60"
@@ -669,7 +654,7 @@ version = "0.0.1"
669654
dependencies = [
670655
"bytecount",
671656
"cargo_metadata 0.14.0",
672-
"clap 2.34.0",
657+
"clap",
673658
"indoc",
674659
"itertools 0.10.1",
675660
"opener",
@@ -1751,7 +1736,7 @@ name = "installer"
17511736
version = "0.0.0"
17521737
dependencies = [
17531738
"anyhow",
1754-
"clap 2.34.0",
1739+
"clap",
17551740
"flate2",
17561741
"lazy_static",
17571742
"num_cpus",
@@ -2190,7 +2175,7 @@ dependencies = [
21902175
"ammonia",
21912176
"anyhow",
21922177
"chrono",
2193-
"clap 2.34.0",
2178+
"clap",
21942179
"elasticlunr-rs",
21952180
"env_logger 0.7.1",
21962181
"handlebars",
@@ -2521,15 +2506,6 @@ dependencies = [
25212506
"winapi",
25222507
]
25232508

2524-
[[package]]
2525-
name = "os_str_bytes"
2526-
version = "6.0.0"
2527-
source = "registry+https://github.com/rust-lang/crates.io-index"
2528-
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
2529-
dependencies = [
2530-
"memchr",
2531-
]
2532-
25332509
[[package]]
25342510
name = "output_vt100"
25352511
version = "0.1.2"
@@ -2934,7 +2910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29342910
checksum = "b0b4b5faaf07040474e8af74a9e19ff167d5d204df5db5c5c765edecfb900358"
29352911
dependencies = [
29362912
"bitflags",
2937-
"clap 2.34.0",
2913+
"clap",
29382914
"derive_more",
29392915
"env_logger 0.7.1",
29402916
"humantime 2.0.1",
@@ -3282,7 +3258,7 @@ dependencies = [
32823258
name = "rustbook"
32833259
version = "0.1.0"
32843260
dependencies = [
3285-
"clap 2.34.0",
3261+
"clap",
32863262
"env_logger 0.7.1",
32873263
"mdbook",
32883264
]
@@ -4898,19 +4874,13 @@ version = "0.8.0"
48984874
source = "registry+https://github.com/rust-lang/crates.io-index"
48994875
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
49004876

4901-
[[package]]
4902-
name = "strsim"
4903-
version = "0.10.0"
4904-
source = "registry+https://github.com/rust-lang/crates.io-index"
4905-
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
4906-
49074877
[[package]]
49084878
name = "structopt"
49094879
version = "0.3.25"
49104880
source = "registry+https://github.com/rust-lang/crates.io-index"
49114881
checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
49124882
dependencies = [
4913-
"clap 2.34.0",
4883+
"clap",
49144884
"lazy_static",
49154885
"structopt-derive",
49164886
]
@@ -5081,12 +5051,6 @@ dependencies = [
50815051
"unicode-width",
50825052
]
50835053

5084-
[[package]]
5085-
name = "textwrap"
5086-
version = "0.14.2"
5087-
source = "registry+https://github.com/rust-lang/crates.io-index"
5088-
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
5089-
50905054
[[package]]
50915055
name = "thiserror"
50925056
version = "1.0.30"

‎compiler/rustc_ast/src/ast.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub enum AngleBracketedArg {
224224
/// Argument for a generic parameter.
225225
Arg(GenericArg),
226226
/// Constraint for an associated item.
227-
Constraint(AssocTyConstraint),
227+
Constraint(AssocConstraint),
228228
}
229229

230230
impl AngleBracketedArg {
@@ -1843,19 +1843,38 @@ impl UintTy {
18431843
/// A constraint on an associated type (e.g., `A = Bar` in `Foo<A = Bar>` or
18441844
/// `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`).
18451845
#[derive(Clone, Encodable, Decodable, Debug)]
1846-
pub struct AssocTyConstraint {
1846+
pub struct AssocConstraint {
18471847
pub id: NodeId,
18481848
pub ident: Ident,
18491849
pub gen_args: Option<GenericArgs>,
1850-
pub kind: AssocTyConstraintKind,
1850+
pub kind: AssocConstraintKind,
18511851
pub span: Span,
18521852
}
18531853

1854-
/// The kinds of an `AssocTyConstraint`.
1854+
/// The kinds of an `AssocConstraint`.
18551855
#[derive(Clone, Encodable, Decodable, Debug)]
1856-
pub enum AssocTyConstraintKind {
1857-
/// E.g., `A = Bar` in `Foo<A = Bar>`.
1858-
Equality { ty: P<Ty> },
1856+
pub enum Term {
1857+
Ty(P<Ty>),
1858+
Const(AnonConst),
1859+
}
1860+
1861+
impl From<P<Ty>> for Term {
1862+
fn from(v: P<Ty>) -> Self {
1863+
Term::Ty(v)
1864+
}
1865+
}
1866+
1867+
impl From<AnonConst> for Term {
1868+
fn from(v: AnonConst) -> Self {
1869+
Term::Const(v)
1870+
}
1871+
}
1872+
1873+
/// The kinds of an `AssocConstraint`.
1874+
#[derive(Clone, Encodable, Decodable, Debug)]
1875+
pub enum AssocConstraintKind {
1876+
/// E.g., `A = Bar`, `A = 3` in `Foo<A = Bar>` where A is an associated type.
1877+
Equality { term: Term },
18591878
/// E.g. `A: TraitA + TraitB` in `Foo<A: TraitA + TraitB>`.
18601879
Bound { bounds: GenericBounds },
18611880
}

0 commit comments

Comments
 (0)
This repository has been archived.