Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated pull from upstream master #78

Merged
merged 58 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
58 commits
Select commit Hold shift click to select a range
51e22be
feat: render Object Safety informations non-object safe traits
poliorcetics Jul 1, 2023
40556b9
feat: Add 'object-safety' ID to init_id_map() in rustdoc
poliorcetics Jul 8, 2023
a119158
tests: object-safety section in traits
poliorcetics Jul 1, 2023
50ca5ef
When encountering unclosed delimiters during parsing, check for diff …
estebank Oct 13, 2023
1e5b2da
Rename Since -> StableSince in preparation for a DeprecatedSince
dtolnay Oct 26, 2023
5c7cf83
Fill in syntactically valid deprecation version in tests
dtolnay Oct 30, 2023
2fe7d17
Store version of `deprecated` attribute in structured form
dtolnay Oct 26, 2023
8afb40b
Delete unused InvalidDeprecationVersion diagnostic
dtolnay Oct 30, 2023
1e10fe9
Move deprecation_in_effect to inherent method on Deprecation
dtolnay Oct 30, 2023
af7472e
Add a stable MIR visitor
celinval Oct 30, 2023
48491c1
Also consider TAIT to be uncomputable if the MIR body is tainted
compiler-errors Oct 30, 2023
b106167
Add a DeprecatedSince::Err variant for versions that fail to parse
dtolnay Oct 30, 2023
c523672
Preserve deprecation attribute even if 'since' version is missing
dtolnay Oct 30, 2023
e8868af
Represent absence of 'since' attribute as a variant of DeprecatedSince
dtolnay Oct 30, 2023
add09e6
Some more coroutine renamings
compiler-errors Oct 30, 2023
dccf10e
Descriptive variant name deprecation versions outside the standard li…
dtolnay Oct 30, 2023
8b8906b
Add method for checking if deprecation is a rustc version
dtolnay Oct 30, 2023
ffb7ed9
Auto merge of #117419 - compiler-errors:gen, r=oli-obk
bors Oct 31, 2023
22b2712
Auto merge of #117377 - dtolnay:deprecatedsince, r=cjgillot
bors Oct 31, 2023
5b7cc9d
Do not ICE on constant evaluation failure in GVN.
cjgillot Oct 31, 2023
078144e
prepopulate opaque ty storage before using it :>
lcnr Oct 31, 2023
8ef67d0
coverage: Promote some debug-only checks to always run
Zalathar Oct 29, 2023
6d956a2
coverage: Replace impossible `coverage::Error` with assertions
Zalathar Oct 29, 2023
7c673db
don't use the moral equivalent of `assert!(false, "foo")`
oli-obk Sep 29, 2023
9a49ef3
Simplify all `require_simd` invocations by moving all of the shared i…
oli-obk Sep 29, 2023
f8372df
Merge simd size and type extraction into checking whether a type is s…
oli-obk Sep 29, 2023
ed27cb0
Reorder passes.
cjgillot Jul 22, 2023
c748ac1
Replace SwitchInt to unreachable by an assumption.
cjgillot Jul 22, 2023
0b13e63
Simplify assume of a constant.
cjgillot Jul 22, 2023
096196d
Refactor UninhabitedEnumBranching to mark targets unreachable.
cjgillot Jul 22, 2023
cb91890
Only emit `!=` assumptions if the otherwise target is reachable.
cjgillot Sep 24, 2023
ae2e211
FileCheck uninhabited_enum_branching.
cjgillot Oct 21, 2023
d0833c4
Rollup merge of #116267 - oli-obk:simd_cleanups, r=petrochenkov
matthiaskrgr Oct 31, 2023
7035c3d
Rollup merge of #116712 - estebank:issue-116252, r=petrochenkov
matthiaskrgr Oct 31, 2023
8daa317
Rollup merge of #117416 - compiler-errors:tait-in-bad-body, r=oli-obk
matthiaskrgr Oct 31, 2023
793776f
Rollup merge of #117421 - Zalathar:error, r=oli-obk,Swatinem
matthiaskrgr Oct 31, 2023
f623530
Rollup merge of #117438 - cjgillot:deterministic-error, r=oli-obk
matthiaskrgr Oct 31, 2023
045f158
Auto merge of #117444 - matthiaskrgr:rollup-43s0spc, r=matthiaskrgr
bors Oct 31, 2023
de83057
Use derivative for Clone
compiler-errors Oct 30, 2023
8eb932d
Use derivative for PartialOrd/ord
compiler-errors Oct 30, 2023
8b4fa0f
Use derivative for Hash
compiler-errors Oct 30, 2023
4512f21
Accept less invalid Rust in rustdoc
oli-obk Oct 31, 2023
d7d9f15
Auto merge of #117407 - compiler-errors:derive-clone, r=oli-obk
bors Oct 31, 2023
a8ece11
Add support for pre-unix-epoch file dates on Apple platforms (#108277)
Byron Oct 31, 2023
77174d3
Turn const_caller_location from a query to a hook
oli-obk Oct 30, 2023
50be229
Auto merge of #117450 - oli-obk:rustdoc_verify, r=estebank
bors Oct 31, 2023
51b275b
Rollup merge of #113241 - poliorcetics:85138-doc-object-safety, r=Gui…
matthiaskrgr Oct 31, 2023
83990ba
Rollup merge of #117388 - oli-obk:dequerification, r=RalfJung
matthiaskrgr Oct 31, 2023
290daf9
Rollup merge of #117417 - celinval:smir-visitor, r=oli-obk
matthiaskrgr Oct 31, 2023
86d69f9
Rollup merge of #117439 - lcnr:prepopulate-earlier, r=compiler-errors
matthiaskrgr Oct 31, 2023
d06200b
Rollup merge of #117451 - Byron:issue-108277-apple-fix, r=joshtriplett
matthiaskrgr Oct 31, 2023
7ea6977
Update cargo
weihanglo Oct 31, 2023
9d83ac2
Auto merge of #117462 - weihanglo:update-cargo, r=weihanglo
bors Oct 31, 2023
09ac6e4
Auto merge of #117459 - matthiaskrgr:rollup-t3osb3c, r=matthiaskrgr
bors Oct 31, 2023
98f5ebb
Auto merge of #113970 - cjgillot:assume-all-the-things, r=nikic
bors Nov 1, 2023
18168b8
remove excluded files from upstream
github-actions[bot] Nov 1, 2023
0df4dc9
pull new changes from upstream
github-actions[bot] Nov 1, 2023
d549a5c
add newly-added tests to conflict marker allowlist
tshepang Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 1011,17 @@ dependencies = [
"syn 2.0.29",
]

[[package]]
name = "derivative"
version = "2.2.0"
source = "registry https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]

[[package]]
name = "derive_builder"
version = "0.12.0"
Expand Down Expand Up @@ -4667,6 4678,7 @@ name = "rustc_type_ir"
version = "0.0.0"
dependencies = [
"bitflags 1.3.2",
"derivative",
"rustc_data_structures",
"rustc_index",
"rustc_macros",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_type_ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 6,7 @@ edition = "2021"
[dependencies]
# tidy-alphabetical-start
bitflags = "1.2.1"
derivative = "2.2.0"
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
Expand Down
22 changes: 3 additions & 19 deletions compiler/rustc_type_ir/src/canonical.rs
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
use std::fmt;
use std::hash;
use std::hash::Hash;
use std::ops::ControlFlow;

use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
Expand All @@ -13,6 13,8 @@ use crate::{HashStableContext, Interner, TyEncoder, UniverseIndex};
/// A "canonicalized" type `V` is one where all free inference
/// variables have been rewritten to "canonical vars". These are
/// numbered starting from 0 in order of first appearance.
#[derive(derivative::Derivative)]
#[derivative(Clone(bound = "V: Clone"), Hash(bound = "V: Hash"))]
pub struct Canonical<I: Interner, V> {
pub value: V,
pub max_universe: UniverseIndex,
Expand Down Expand Up @@ -59,14 61,6 @@ impl<I: Interner, V> Canonical<I, V> {
}
}

impl<I: Interner, V: hash::Hash> hash::Hash for Canonical<I, V> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.value.hash(state);
self.max_universe.hash(state);
self.variables.hash(state);
}
}

impl<CTX: HashStableContext, I: Interner, V: HashStable<CTX>> HashStable<CTX> for Canonical<I, V>
where
I::CanonicalVars: HashStable<CTX>,
Expand Down Expand Up @@ -108,16 102,6 @@ impl<I: Interner, V: fmt::Debug> fmt::Debug for Canonical<I, V> {
}
}

impl<I: Interner, V: Clone> Clone for Canonical<I, V> {
fn clone(&self) -> Self {
Canonical {
value: self.value.clone(),
max_universe: self.max_universe.clone(),
variables: self.variables.clone(),
}
}
}

impl<I: Interner, V: Copy> Copy for Canonical<I, V> where I::CanonicalVars: Copy {}

impl<I: Interner, V: TypeFoldable<I>> TypeFoldable<I> for Canonical<I, V>
Expand Down
73 changes: 9 additions & 64 deletions compiler/rustc_type_ir/src/const_kind.rs
Original file line number Diff line number Diff line change
@@ -1,9 1,7 @@
use rustc_data_structures::stable_hasher::HashStable;
use rustc_data_structures::stable_hasher::StableHasher;
use rustc_serialize::{Decodable, Decoder, Encodable};
use std::cmp::Ordering;
use std::fmt;
use std::hash;

use crate::{
DebruijnIndex, DebugWithInfcx, HashStableContext, InferCtxtLike, Interner, TyDecoder,
Expand All @@ -13,7 11,15 @@ use crate::{
use self::ConstKind::*;

/// Represents a constant in Rust.
// #[derive(derive_more::From)]
#[derive(derivative::Derivative)]
#[derivative(
Clone(bound = ""),
PartialOrd(bound = ""),
PartialOrd = "feature_allow_slow_enum",
Ord(bound = ""),
Ord = "feature_allow_slow_enum",
Hash(bound = "")
)]
pub enum ConstKind<I: Interner> {
/// A const generic parameter.
Param(I::ParamConst),
Expand Down Expand Up @@ -57,25 63,6 @@ const fn const_kind_discriminant<I: Interner>(value: &ConstKind<I>) -> usize {
}
}

impl<I: Interner> hash::Hash for ConstKind<I> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
const_kind_discriminant(self).hash(state);
match self {
Param(p) => p.hash(state),
Infer(i) => i.hash(state),
Bound(d, b) => {
d.hash(state);
b.hash(state);
}
Placeholder(p) => p.hash(state),
Unevaluated(u) => u.hash(state),
Value(v) => v.hash(state),
Error(e) => e.hash(state),
Expr(e) => e.hash(state),
}
}
}

impl<CTX: HashStableContext, I: Interner> HashStable<CTX> for ConstKind<I>
where
I::ParamConst: HashStable<CTX>,
Expand Down Expand Up @@ -166,33 153,6 @@ where
}
}

impl<I: Interner> PartialOrd for ConstKind<I> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

impl<I: Interner> Ord for ConstKind<I> {
fn cmp(&self, other: &Self) -> Ordering {
const_kind_discriminant(self)
.cmp(&const_kind_discriminant(other))
.then_with(|| match (self, other) {
(Param(p1), Param(p2)) => p1.cmp(p2),
(Infer(i1), Infer(i2)) => i1.cmp(i2),
(Bound(d1, b1), Bound(d2, b2)) => d1.cmp(d2).then_with(|| b1.cmp(b2)),
(Placeholder(p1), Placeholder(p2)) => p1.cmp(p2),
(Unevaluated(u1), Unevaluated(u2)) => u1.cmp(u2),
(Value(v1), Value(v2)) => v1.cmp(v2),
(Error(e1), Error(e2)) => e1.cmp(e2),
(Expr(e1), Expr(e2)) => e1.cmp(e2),
_ => {
debug_assert!(false, "This branch must be unreachable, maybe the match is missing an arm? self = {self:?}, other = {other:?}");
Ordering::Equal
}
})
}
}

impl<I: Interner> PartialEq for ConstKind<I> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
Expand All @@ -211,21 171,6 @@ impl<I: Interner> PartialEq for ConstKind<I> {

impl<I: Interner> Eq for ConstKind<I> {}

impl<I: Interner> Clone for ConstKind<I> {
fn clone(&self) -> Self {
match self {
Param(arg0) => Param(arg0.clone()),
Infer(arg0) => Infer(arg0.clone()),
Bound(arg0, arg1) => Bound(arg0.clone(), arg1.clone()),
Placeholder(arg0) => Placeholder(arg0.clone()),
Unevaluated(arg0) => Unevaluated(arg0.clone()),
Value(arg0) => Value(arg0.clone()),
Error(arg0) => Error(arg0.clone()),
Expr(arg0) => Expr(arg0.clone()),
}
}
}

impl<I: Interner> fmt::Debug for ConstKind<I> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
WithInfcx::with_no_infcx(self).fmt(f)
Expand Down
83 changes: 4 additions & 79 deletions compiler/rustc_type_ir/src/predicate_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_serialize::Decoder;
use rustc_serialize::{Decodable, Encodable};
use std::fmt;
use std::hash;
use std::ops::ControlFlow;

use crate::fold::{FallibleTypeFolder, TypeFoldable};
Expand All @@ -12,6 11,8 @@ use crate::{TyDecoder, TyEncoder};

/// A clause is something that can appear in where bounds or be inferred
/// by implied bounds.
#[derive(derivative::Derivative)]
#[derivative(Clone(bound = ""), Hash(bound = ""))]
pub enum ClauseKind<I: Interner> {
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
/// the `Self` type of the trait reference and `A`, `B`, and `C`
Expand Down Expand Up @@ -39,20 40,6 @@ pub enum ClauseKind<I: Interner> {
ConstEvaluatable(I::Const),
}

impl<I: Interner> Clone for ClauseKind<I> {
fn clone(&self) -> Self {
match self {
Self::Trait(arg0) => Self::Trait(arg0.clone()),
Self::RegionOutlives(arg0) => Self::RegionOutlives(arg0.clone()),
Self::TypeOutlives(arg0) => Self::TypeOutlives(arg0.clone()),
Self::Projection(arg0) => Self::Projection(arg0.clone()),
Self::ConstArgHasType(arg0, arg1) => Self::ConstArgHasType(arg0.clone(), arg1.clone()),
Self::WellFormed(arg0) => Self::WellFormed(arg0.clone()),
Self::ConstEvaluatable(arg0) => Self::ConstEvaluatable(arg0.clone()),
}
}
}

impl<I: Interner> Copy for ClauseKind<I>
where
I::Ty: Copy,
Expand Down Expand Up @@ -94,24 81,6 @@ fn clause_kind_discriminant<I: Interner>(value: &ClauseKind<I>) -> usize {
}
}

impl<I: Interner> hash::Hash for ClauseKind<I> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
clause_kind_discriminant(self).hash(state);
match self {
ClauseKind::Trait(p) => p.hash(state),
ClauseKind::RegionOutlives(p) => p.hash(state),
ClauseKind::TypeOutlives(p) => p.hash(state),
ClauseKind::Projection(p) => p.hash(state),
ClauseKind::ConstArgHasType(c, t) => {
c.hash(state);
t.hash(state);
}
ClauseKind::WellFormed(t) => t.hash(state),
ClauseKind::ConstEvaluatable(c) => c.hash(state),
}
}
}

impl<CTX: HashStableContext, I: Interner> HashStable<CTX> for ClauseKind<I>
where
I::Ty: HashStable<CTX>,
Expand Down Expand Up @@ -249,6 218,8 @@ where
}
}

#[derive(derivative::Derivative)]
#[derivative(Clone(bound = ""), Hash(bound = ""))]
pub enum PredicateKind<I: Interner> {
/// Prove a clause
Clause(ClauseKind<I>),
Expand Down Expand Up @@ -305,25 276,6 @@ where
{
}

impl<I: Interner> Clone for PredicateKind<I> {
fn clone(&self) -> Self {
match self {
Self::Clause(arg0) => Self::Clause(arg0.clone()),
Self::ObjectSafe(arg0) => Self::ObjectSafe(arg0.clone()),
Self::ClosureKind(arg0, arg1, arg2) => {
Self::ClosureKind(arg0.clone(), arg1.clone(), arg2.clone())
}
Self::Subtype(arg0) => Self::Subtype(arg0.clone()),
Self::Coerce(arg0) => Self::Coerce(arg0.clone()),
Self::ConstEquate(arg0, arg1) => Self::ConstEquate(arg0.clone(), arg1.clone()),
Self::Ambiguous => Self::Ambiguous,
Self::AliasRelate(arg0, arg1, arg2) => {
Self::AliasRelate(arg0.clone(), arg1.clone(), arg2.clone())
}
}
}
}

impl<I: Interner> PartialEq for PredicateKind<I> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
Expand Down Expand Up @@ -358,33 310,6 @@ fn predicate_kind_discriminant<I: Interner>(value: &PredicateKind<I>) -> usize {
}
}

impl<I: Interner> hash::Hash for PredicateKind<I> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
predicate_kind_discriminant(self).hash(state);
match self {
PredicateKind::Clause(p) => p.hash(state),
PredicateKind::ObjectSafe(d) => d.hash(state),
PredicateKind::ClosureKind(d, g, k) => {
d.hash(state);
g.hash(state);
k.hash(state);
}
PredicateKind::Subtype(p) => p.hash(state),
PredicateKind::Coerce(p) => p.hash(state),
PredicateKind::ConstEquate(c1, c2) => {
c1.hash(state);
c2.hash(state);
}
PredicateKind::Ambiguous => {}
PredicateKind::AliasRelate(t1, t2, r) => {
t1.hash(state);
t2.hash(state);
r.hash(state);
}
}
}
}

impl<CTX: HashStableContext, I: Interner> HashStable<CTX> for PredicateKind<I>
where
I::DefId: HashStable<CTX>,
Expand Down
Loading