Skip to content

Commit fdd4856

Browse files
committed
Auto merge of #64438 - cuviper:beta-rollup, r=Mark-Simulacrum
[beta] Rollup backports Cherry-picked: - Permit unwinding through FFI by default #62603 - pprust: Do not print spaces before some tokens #63897 - Account for doc comments coming from proc macros without spans #63930 - Support "soft" feature-gating using a lint #64066 - Update xLTO compatibility table in rustc book. #64092 - Include compiler-rt in the source tarball #64240 - Update LLVM submodule #64317 r? @Mark-Simulacrum
2 parents d097af1 + e086278 commit fdd4856

File tree

32 files changed

+151
-60
lines changed

32 files changed

+151
-60
lines changed

src/bootstrap/dist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]
808808
"llvm-project/lld", "llvm-project\\lld",
809809
"llvm-project/lldb", "llvm-project\\lldb",
810810
"llvm-project/llvm", "llvm-project\\llvm",
811+
"llvm-project/compiler-rt", "llvm-project\\compiler-rt",
811812
];
812813
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
813814
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))

src/doc/rustc/src/linker-plugin-lto.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,6 @@ The following table shows known good combinations of toolchain versions.
105105
| Rust 1.34 |||
106106
| Rust 1.35 |||
107107
| Rust 1.36 |||
108+
| Rust 1.37 |||
108109

109110
Note that the compatibility policy for this feature might change in the future.

src/libcore/macros.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,8 +1281,10 @@ pub(crate) mod builtin {
12811281
pub macro test($item:item) { /* compiler built-in */ }
12821282

12831283
/// Attribute macro applied to a function to turn it into a benchmark test.
1284-
#[unstable(feature = "test", issue = "50297",
1285-
reason = "`bench` is a part of custom test frameworks which are unstable")]
1284+
#[cfg_attr(not(boostrap_stdarch_ignore_this), unstable(soft, feature = "test", issue = "50297",
1285+
reason = "`bench` is a part of custom test frameworks which are unstable"))]
1286+
#[cfg_attr(boostrap_stdarch_ignore_this, unstable(feature = "test", issue = "50297",
1287+
reason = "`bench` is a part of custom test frameworks which are unstable"))]
12861288
#[allow_internal_unstable(test, rustc_attrs)]
12871289
#[rustc_builtin_macro]
12881290
#[rustc_macro_transparency = "semitransparent"]

src/librustc/ich/impls_syntax.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ for ::syntax::attr::StabilityLevel {
136136
hasher: &mut StableHasher<W>) {
137137
mem::discriminant(self).hash_stable(hcx, hasher);
138138
match *self {
139-
::syntax::attr::StabilityLevel::Unstable { ref reason, ref issue } => {
139+
::syntax::attr::StabilityLevel::Unstable { ref reason, ref issue, ref is_soft } => {
140140
reason.hash_stable(hcx, hasher);
141141
issue.hash_stable(hcx, hasher);
142+
is_soft.hash_stable(hcx, hasher);
142143
}
143144
::syntax::attr::StabilityLevel::Stable { ref since } => {
144145
since.hash_stable(hcx, hasher);

src/librustc/lint/builtin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ declare_lint! {
395395
"reservation of a two-phased borrow conflicts with other shared borrows"
396396
}
397397

398+
declare_lint! {
399+
pub SOFT_UNSTABLE,
400+
Deny,
401+
"a feature gate that doesn't break dependent crates"
402+
}
403+
398404
declare_lint_pass! {
399405
/// Does nothing as a lint pass, but registers some `Lint`s
400406
/// that are used by other parts of the compiler.
@@ -460,6 +466,7 @@ declare_lint_pass! {
460466
NESTED_IMPL_TRAIT,
461467
MUTABLE_BORROW_RESERVATION_CONFLICT,
462468
INDIRECT_STRUCTURAL_MATCH,
469+
SOFT_UNSTABLE,
463470
]
464471
}
465472

src/librustc/middle/stability.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ impl<'tcx> Index<'tcx> {
438438
level: attr::StabilityLevel::Unstable {
439439
reason: Some(Symbol::intern(reason)),
440440
issue: 27812,
441+
is_soft: false,
441442
},
442443
feature: sym::rustc_private,
443444
rustc_depr: None,
@@ -480,7 +481,7 @@ pub fn provide(providers: &mut Providers<'_>) {
480481
}
481482

482483
pub fn report_unstable(
483-
sess: &Session, feature: Symbol, reason: Option<Symbol>, issue: u32, span: Span
484+
sess: &Session, feature: Symbol, reason: Option<Symbol>, issue: u32, is_soft: bool, span: Span
484485
) {
485486
let msg = match reason {
486487
Some(r) => format!("use of unstable library feature '{}': {}", feature, r),
@@ -505,7 +506,13 @@ pub fn report_unstable(
505506
let error_id = (DiagnosticMessageId::StabilityId(issue), span_key, msg.clone());
506507
let fresh = sess.one_time_diagnostics.borrow_mut().insert(error_id);
507508
if fresh {
508-
emit_feature_err(&sess.parse_sess, feature, span, GateIssue::Library(Some(issue)), &msg);
509+
if is_soft {
510+
sess.buffer_lint(lint::builtin::SOFT_UNSTABLE, CRATE_NODE_ID, span, &msg);
511+
} else {
512+
emit_feature_err(
513+
&sess.parse_sess, feature, span, GateIssue::Library(Some(issue)), &msg
514+
);
515+
}
509516
}
510517
}
511518

@@ -621,6 +628,7 @@ pub enum EvalResult {
621628
feature: Symbol,
622629
reason: Option<Symbol>,
623630
issue: u32,
631+
is_soft: bool,
624632
},
625633
/// The item does not have the `#[stable]` or `#[unstable]` marker assigned.
626634
Unmarked,
@@ -720,7 +728,9 @@ impl<'tcx> TyCtxt<'tcx> {
720728
}
721729

722730
match stability {
723-
Some(&Stability { level: attr::Unstable { reason, issue }, feature, .. }) => {
731+
Some(&Stability {
732+
level: attr::Unstable { reason, issue, is_soft }, feature, ..
733+
}) => {
724734
if span.allows_unstable(feature) {
725735
debug!("stability: skipping span={:?} since it is internal", span);
726736
return EvalResult::Allow;
@@ -744,7 +754,7 @@ impl<'tcx> TyCtxt<'tcx> {
744754
}
745755
}
746756

747-
EvalResult::Deny { feature, reason, issue }
757+
EvalResult::Deny { feature, reason, issue, is_soft }
748758
}
749759
Some(_) => {
750760
// Stable APIs are always ok to call and deprecated APIs are
@@ -767,8 +777,8 @@ impl<'tcx> TyCtxt<'tcx> {
767777
pub fn check_stability(self, def_id: DefId, id: Option<HirId>, span: Span) {
768778
match self.eval_stability(def_id, id, span) {
769779
EvalResult::Allow => {}
770-
EvalResult::Deny { feature, reason, issue } =>
771-
report_unstable(self.sess, feature, reason, issue, span),
780+
EvalResult::Deny { feature, reason, issue, is_soft } =>
781+
report_unstable(self.sess, feature, reason, issue, is_soft, span),
772782
EvalResult::Unmarked => {
773783
// The API could be uncallable for other reasons, for example when a private module
774784
// was referenced.

src/librustc_lint/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,12 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
433433
id: LintId::of(INDIRECT_STRUCTURAL_MATCH),
434434
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
435435
edition: None,
436-
}
436+
},
437+
FutureIncompatibleInfo {
438+
id: LintId::of(SOFT_UNSTABLE),
439+
reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
440+
edition: None,
441+
},
437442
]);
438443

439444
// Register renamed and removed lints.

src/librustc_mir/build/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ fn should_abort_on_panic(tcx: TyCtxt<'_>, fn_def_id: DefId, abi: Abi) -> bool {
502502
// This is a special case: some functions have a C abi but are meant to
503503
// unwind anyway. Don't stop them.
504504
match unwind_attr {
505-
None => true,
505+
None => false, // FIXME(#58794)
506506
Some(UnwindAttr::Allowed) => false,
507507
Some(UnwindAttr::Aborts) => true,
508508
}

src/librustc_resolve/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,10 @@ impl<'a> Resolver<'a> {
797797
fn check_stability_and_deprecation(&self, ext: &SyntaxExtension, path: &ast::Path) {
798798
let span = path.span;
799799
if let Some(stability) = &ext.stability {
800-
if let StabilityLevel::Unstable { reason, issue } = stability.level {
800+
if let StabilityLevel::Unstable { reason, issue, is_soft } = stability.level {
801801
let feature = stability.feature;
802802
if !self.active_features.contains(&feature) && !span.allows_unstable(feature) {
803-
stability::report_unstable(self.session, feature, reason, issue, span);
803+
stability::report_unstable(self.session, feature, reason, issue, is_soft, span);
804804
}
805805
}
806806
if let Some(depr) = &stability.rustc_depr {

src/librustdoc/passes/check_code_block_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
6969
// We couldn't calculate the span of the markdown block that had the error, so our
7070
// diagnostics are going to be a bit lacking.
7171
let mut diag = self.cx.sess().struct_span_warn(
72-
super::span_of_attrs(&item.attrs),
72+
super::span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
7373
"doc comment contains an invalid Rust code block",
7474
);
7575

0 commit comments

Comments
 (0)