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 all 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,17 @@ dependencies = [
"rusticata-macros",
]

[[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 @@ -5420,6 +5431,7 @@ name = "rustc_type_ir"
version = "0.0.0"
dependencies = [
"bitflags 1.3.2",
"derivative",
"rustc_data_structures",
"rustc_index",
"rustc_macros",
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
closure_node_id: NodeId,
ret_ty: Option<hir::FnRetTy<'hir>>,
span: Span,
async_gen_kind: hir::CoroutineSource,
async_coroutine_source: hir::CoroutineSource,
body: impl FnOnce(&mut Self) -> hir::Expr<'hir>,
) -> hir::ExprKind<'hir> {
let output = ret_ty.unwrap_or_else(|| hir::FnRetTy::DefaultReturn(self.lower_span(span)));
Expand Down Expand Up @@ -645,7 +645,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let params = arena_vec![self; param];

let body = self.lower_body(move |this| {
this.coroutine_kind = Some(hir::CoroutineKind::Async(async_gen_kind));
this.coroutine_kind = Some(hir::CoroutineKind::Async(async_coroutine_source));

let old_ctx = this.task_context;
this.task_context = Some(task_context_hid);
Expand Down Expand Up @@ -684,7 +684,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
closure_node_id: NodeId,
_yield_ty: Option<hir::FnRetTy<'hir>>,
span: Span,
gen_kind: hir::CoroutineSource,
coroutine_source: hir::CoroutineSource,
body: impl FnOnce(&mut Self) -> hir::Expr<'hir>,
) -> hir::ExprKind<'hir> {
let output = hir::FnRetTy::DefaultReturn(self.lower_span(span));
Expand All @@ -699,7 +699,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
});

let body = self.lower_body(move |this| {
this.coroutine_kind = Some(hir::CoroutineKind::Gen(gen_kind));
this.coroutine_kind = Some(hir::CoroutineKind::Gen(coroutine_source));

let res = body(this);
(&[], res)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
f: impl FnOnce(&mut Self) -> (&'hir [hir::Param<'hir>], hir::Expr<'hir>),
) -> hir::BodyId {
let prev_gen_kind = self.coroutine_kind.take();
let prev_coroutine_kind = self.coroutine_kind.take();
let task_context = self.task_context.take();
let (parameters, result) = f(self);
let body_id = self.record_body(parameters, result);
self.task_context = task_context;
self.coroutine_kind = prev_gen_kind;
self.coroutine_kind = prev_coroutine_kind;
body_id
}

Expand Down
84 changes: 62 additions & 22 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub enum StabilityLevel {
/// `#[stable]`
Stable {
/// Rust release which stabilized this feature.
since: Since,
since: StableSince,
/// Is this item allowed to be referred to on stable, despite being contained in unstable
/// modules?
allowed_through_unstable_modules: bool,
Expand All @@ -149,7 +149,7 @@ pub enum StabilityLevel {
/// Rust release in which a feature is stabilized.
#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic)]
pub enum Since {
pub enum StableSince {
Version(RustcVersion),
/// Stabilized in the upcoming version, whatever number that is.
Current,
Expand Down Expand Up @@ -378,16 +378,16 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit

let since = if let Some(since) = since {
if since.as_str() == VERSION_PLACEHOLDER {
Since::Current
StableSince::Current
} else if let Some(version) = parse_version(since) {
Since::Version(version)
StableSince::Version(version)
} else {
sess.emit_err(session_diagnostics::InvalidSince { span: attr.span });
Since::Err
StableSince::Err
}
} else {
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
Since::Err
StableSince::Err
};

match feature {
Expand Down Expand Up @@ -720,17 +720,49 @@ pub fn eval_condition(

#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic)]
pub struct Deprecation {
pub since: Option<Symbol>,
pub since: DeprecatedSince,
/// The note to issue a reason.
pub note: Option<Symbol>,
/// A text snippet used to completely replace any use of the deprecated item in an expression.
///
/// This is currently unstable.
pub suggestion: Option<Symbol>,
}

/// Release in which an API is deprecated.
#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic)]
pub enum DeprecatedSince {
RustcVersion(RustcVersion),
/// Deprecated in the future ("to be determined").
Future,
/// `feature(staged_api)` is off. Deprecation versions outside the standard
/// library are allowed to be arbitrary strings, for better or worse.
NonStandard(Symbol),
/// Deprecation version is unspecified but optional.
Unspecified,
/// Failed to parse a deprecation version, or the deprecation version is
/// unspecified and required. An error has already been emitted.
Err,
}

impl Deprecation {
/// Whether an item marked with #[deprecated(since = "X")] is currently
/// deprecated (i.e., whether X is not greater than the current rustc
/// version).
pub fn is_in_effect(&self) -> bool {
match self.since {
DeprecatedSince::RustcVersion(since) => since <= RustcVersion::CURRENT,
DeprecatedSince::Future => false,
// The `since` field doesn't have semantic purpose without `#![staged_api]`.
DeprecatedSince::NonStandard(_) => true,
// Assume deprecation is in effect if "since" field is absent or invalid.
DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
}
}

/// Whether to treat the since attribute as being a Rust version identifier
/// (rather than an opaque string).
pub is_since_rustc_version: bool,
pub fn is_since_rustc_version(&self) -> bool {
matches!(self.since, DeprecatedSince::RustcVersion(_))
}
}

/// Finds the deprecation attribute. `None` if none exists.
Expand Down Expand Up @@ -839,22 +871,30 @@ pub fn find_deprecation(
}
}

if is_rustc {
if since.is_none() {
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
continue;
let since = if let Some(since) = since {
if since.as_str() == "TBD" {
DeprecatedSince::Future
} else if !is_rustc {
DeprecatedSince::NonStandard(since)
} else if let Some(version) = parse_version(since) {
DeprecatedSince::RustcVersion(version)
} else {
sess.emit_err(session_diagnostics::InvalidSince { span: attr.span });
DeprecatedSince::Err
}
} else if is_rustc {
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
DeprecatedSince::Err
} else {
DeprecatedSince::Unspecified
};

if note.is_none() {
sess.emit_err(session_diagnostics::MissingNote { span: attr.span });
continue;
}
if is_rustc && note.is_none() {
sess.emit_err(session_diagnostics::MissingNote { span: attr.span });
continue;
}

depr = Some((
Deprecation { since, note, suggestion, is_since_rustc_version: is_rustc },
attr.span,
));
depr = Some((Deprecation { since, note, suggestion }, attr.span));
}

depr
Expand Down
14 changes: 8 additions & 6 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
&mut borrowck_context,
);

// FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
// predefined opaques in the typeck root.
if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
checker.register_predefined_opaques_in_new_solver();
}
checker.check_user_type_annotations();

let mut verifier = TypeVerifier::new(&mut checker, promoted);
verifier.visit_body(&body);
Expand Down Expand Up @@ -1021,7 +1017,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
borrowck_context,
reported_errors: Default::default(),
};
checker.check_user_type_annotations();

// FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
// predefined opaques in the typeck root.
if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
checker.register_predefined_opaques_in_new_solver();
}

checker
}

Expand Down