Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 26b2b8d

Browse files
committedSep 10, 2024
Auto merge of #130179 - workingjubilee:rollup-l78cv44, r=workingjubilee
Rollup of 11 pull requests Successful merges: - #128316 (Stabilize most of `io_error_more`) - #129473 (use `download-ci-llvm=true` in the default compiler config) - #129529 (Add test to build crates used by r-a on stable) - #129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.) - #130094 (Inform the solver if evaluation is concurrent) - #130132 ([illumos] enable SIGSEGV handler to detect stack overflows) - #130146 (bootstrap `naked_asm!` for `compiler-builtins`) - #130149 (Helper function for formatting with `LifetimeSuggestionPosition`) - #130152 (adapt a test for llvm 20) - #130162 (bump download-ci-llvm-stamp) - #130164 (move some const fn out of the const_ptr_as_ref feature) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 304b7f8 + 9749a98 commit 26b2b8d

File tree

34 files changed

+265
-100
lines changed

34 files changed

+265
-100
lines changed
 

‎compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,44 @@ pub(super) fn expand_asm<'cx>(
812812
})
813813
}
814814

815+
pub(super) fn expand_naked_asm<'cx>(
816+
ecx: &'cx mut ExtCtxt<'_>,
817+
sp: Span,
818+
tts: TokenStream,
819+
) -> MacroExpanderResult<'cx> {
820+
ExpandResult::Ready(match parse_args(ecx, sp, tts, false) {
821+
Ok(args) => {
822+
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, args) else {
823+
return ExpandResult::Retry(());
824+
};
825+
let expr = match mac {
826+
Ok(mut inline_asm) => {
827+
// for future compatibility, we always set the NORETURN option.
828+
//
829+
// When we turn `asm!` into `naked_asm!` with this implementation, we can drop
830+
// the `options(noreturn)`, which makes the upgrade smooth when `naked_asm!`
831+
// starts disallowing the `noreturn` option in the future
832+
inline_asm.options |= ast::InlineAsmOptions::NORETURN;
833+
834+
P(ast::Expr {
835+
id: ast::DUMMY_NODE_ID,
836+
kind: ast::ExprKind::InlineAsm(P(inline_asm)),
837+
span: sp,
838+
attrs: ast::AttrVec::new(),
839+
tokens: None,
840+
})
841+
}
842+
Err(guar) => DummyResult::raw_expr(sp, Some(guar)),
843+
};
844+
MacEager::expr(expr)
845+
}
846+
Err(err) => {
847+
let guar = err.emit();
848+
DummyResult::any(sp, guar)
849+
}
850+
})
851+
}
852+
815853
pub(super) fn expand_global_asm<'cx>(
816854
ecx: &'cx mut ExtCtxt<'_>,
817855
sp: Span,

‎compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
9494
line: source_util::expand_line,
9595
log_syntax: log_syntax::expand_log_syntax,
9696
module_path: source_util::expand_mod,
97+
naked_asm: asm::expand_naked_asm,
9798
option_env: env::expand_option_env,
9899
pattern_type: pattern_type::expand,
99100
std_panic: edition_panic::expand_panic,

‎compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ fn fat_lto(
272272
}*/
273273
}
274274
};
275-
let mut serialized_bitcode = Vec::new();
276275
{
277276
info!("using {:?} as a base module", module.name);
278277

@@ -317,7 +316,6 @@ fn fat_lto(
317316
unimplemented!("from uncompressed file")
318317
}
319318
}
320-
serialized_bitcode.push(bc_decoded);
321319
}
322320
save_temp_bitcode(cgcx, &module, "lto.input");
323321

@@ -337,7 +335,7 @@ fn fat_lto(
337335
// of now.
338336
module.module_llvm.temp_dir = Some(tmp_path);
339337

340-
Ok(LtoModuleCodegen::Fat { module, _serialized_bitcode: serialized_bitcode })
338+
Ok(LtoModuleCodegen::Fat(module))
341339
}
342340

343341
pub struct ModuleBuffer(PathBuf);

‎compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ fn fat_lto(
314314
}
315315
}
316316
};
317-
let mut serialized_bitcode = Vec::new();
318317
{
319318
let (llcx, llmod) = {
320319
let llvm = &module.module_llvm;
@@ -342,9 +341,7 @@ fn fat_lto(
342341
serialized_modules.sort_by(|module1, module2| module1.1.cmp(&module2.1));
343342

344343
// For all serialized bitcode files we parse them and link them in as we did
345-
// above, this is all mostly handled in C++. Like above, though, we don't
346-
// know much about the memory management here so we err on the side of being
347-
// save and persist everything with the original module.
344+
// above, this is all mostly handled in C++.
348345
let mut linker = Linker::new(llmod);
349346
for (bc_decoded, name) in serialized_modules {
350347
let _timer = cgcx
@@ -355,7 +352,6 @@ fn fat_lto(
355352
info!("linking {:?}", name);
356353
let data = bc_decoded.data();
357354
linker.add(data).map_err(|()| write::llvm_err(dcx, LlvmError::LoadBitcode { name }))?;
358-
serialized_bitcode.push(bc_decoded);
359355
}
360356
drop(linker);
361357
save_temp_bitcode(cgcx, &module, "lto.input");
@@ -372,7 +368,7 @@ fn fat_lto(
372368
}
373369
}
374370

375-
Ok(LtoModuleCodegen::Fat { module, _serialized_bitcode: serialized_bitcode })
371+
Ok(LtoModuleCodegen::Fat(module))
376372
}
377373

378374
pub(crate) struct Linker<'a>(&'a mut llvm::Linker<'a>);

‎compiler/rustc_codegen_ssa/src/back/lto.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,14 @@ pub struct ThinShared<B: WriteBackendMethods> {
4141
}
4242

4343
pub enum LtoModuleCodegen<B: WriteBackendMethods> {
44-
Fat {
45-
module: ModuleCodegen<B::Module>,
46-
_serialized_bitcode: Vec<SerializedModule<B::ModuleBuffer>>,
47-
},
48-
44+
Fat(ModuleCodegen<B::Module>),
4945
Thin(ThinModule<B>),
5046
}
5147

5248
impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
5349
pub fn name(&self) -> &str {
5450
match *self {
55-
LtoModuleCodegen::Fat { .. } => "everything",
51+
LtoModuleCodegen::Fat(_) => "everything",
5652
LtoModuleCodegen::Thin(ref m) => m.name(),
5753
}
5854
}
@@ -68,7 +64,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
6864
cgcx: &CodegenContext<B>,
6965
) -> Result<ModuleCodegen<B::Module>, FatalError> {
7066
match self {
71-
LtoModuleCodegen::Fat { mut module, .. } => {
67+
LtoModuleCodegen::Fat(mut module) => {
7268
B::optimize_fat(cgcx, &mut module)?;
7369
Ok(module)
7470
}
@@ -81,7 +77,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
8177
pub fn cost(&self) -> u64 {
8278
match *self {
8379
// Only one module with fat LTO, so the cost doesn't matter.
84-
LtoModuleCodegen::Fat { .. } => 0,
80+
LtoModuleCodegen::Fat(_) => 0,
8581
LtoModuleCodegen::Thin(ref m) => m.cost(),
8682
}
8783
}

‎compiler/rustc_hir/src/hir.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ impl Lifetime {
168168
(LifetimeSuggestionPosition::Normal, self.ident.span)
169169
}
170170
}
171+
172+
pub fn suggestion(&self, new_lifetime: &str) -> (Span, String) {
173+
debug_assert!(new_lifetime.starts_with('\''));
174+
let (pos, span) = self.suggestion_position();
175+
let code = match pos {
176+
LifetimeSuggestionPosition::Normal => format!("{new_lifetime}"),
177+
LifetimeSuggestionPosition::Ampersand => format!("{new_lifetime} "),
178+
LifetimeSuggestionPosition::ElidedPath => format!("<{new_lifetime}>"),
179+
LifetimeSuggestionPosition::ElidedPathArgument => format!("{new_lifetime}, "),
180+
LifetimeSuggestionPosition::ObjectDefault => format!("+ {new_lifetime}"),
181+
};
182+
(span, code)
183+
}
171184
}
172185

173186
/// A `Path` is essentially Rust's notion of a name; for instance,

‎compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,23 +1191,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
11911191
(generics.span, "<'a>".to_owned())
11921192
};
11931193

1194-
let lifetime_sugg = match lifetime_ref.suggestion_position() {
1195-
(hir::LifetimeSuggestionPosition::Normal, span) => {
1196-
(span, "'a".to_owned())
1197-
}
1198-
(hir::LifetimeSuggestionPosition::Ampersand, span) => {
1199-
(span, "'a ".to_owned())
1200-
}
1201-
(hir::LifetimeSuggestionPosition::ElidedPath, span) => {
1202-
(span, "<'a>".to_owned())
1203-
}
1204-
(hir::LifetimeSuggestionPosition::ElidedPathArgument, span) => {
1205-
(span, "'a, ".to_owned())
1206-
}
1207-
(hir::LifetimeSuggestionPosition::ObjectDefault, span) => {
1208-
(span, "+ 'a".to_owned())
1209-
}
1210-
};
1194+
let lifetime_sugg = lifetime_ref.suggestion("'a");
12111195
let suggestions = vec![lifetime_sugg, new_param_sugg];
12121196

12131197
diag.span_label(

‎compiler/rustc_middle/src/ty/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
181181
}
182182
}
183183

184+
fn evaluation_is_concurrent(&self) -> bool {
185+
self.sess.threads() > 1
186+
}
187+
184188
fn expand_abstract_consts<T: TypeFoldable<TyCtxt<'tcx>>>(self, t: T) -> T {
185189
self.expand_abstract_consts(t)
186190
}

‎compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,7 @@ symbols! {
12551255
mut_preserve_binding_mode_2024,
12561256
mut_ref,
12571257
naked,
1258+
naked_asm,
12581259
naked_functions,
12591260
name,
12601261
names,

‎compiler/rustc_trait_selection/src/error_reporting/infer/region.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -852,18 +852,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
852852
impl<'hir, 'tcx> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'tcx, '_> {
853853
fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) {
854854
if lt.res == self.needle {
855-
let (pos, span) = lt.suggestion_position();
856-
let new_lt = &self.new_lt;
857-
let sugg = match pos {
858-
hir::LifetimeSuggestionPosition::Normal => format!("{new_lt}"),
859-
hir::LifetimeSuggestionPosition::Ampersand => format!("{new_lt} "),
860-
hir::LifetimeSuggestionPosition::ElidedPath => format!("<{new_lt}>"),
861-
hir::LifetimeSuggestionPosition::ElidedPathArgument => {
862-
format!("{new_lt}, ")
863-
}
864-
hir::LifetimeSuggestionPosition::ObjectDefault => format!("+ {new_lt}"),
865-
};
866-
self.add_lt_suggs.push((span, sugg));
855+
self.add_lt_suggs.push(lt.suggestion(self.new_lt));
867856
}
868857
}
869858

‎compiler/rustc_type_ir/src/elaborate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn supertrait_def_ids<I: Interner>(
237237
cx: I,
238238
trait_def_id: I::DefId,
239239
) -> impl Iterator<Item = I::DefId> {
240-
let mut set: HashSet<I::DefId> = HashSet::default();
240+
let mut set = HashSet::default();
241241
let mut stack = vec![trait_def_id];
242242

243243
set.insert(trait_def_id);

‎compiler/rustc_type_ir/src/interner.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ pub trait Interner:
137137
f: impl FnOnce(&mut search_graph::GlobalCache<Self>) -> R,
138138
) -> R;
139139

140+
fn evaluation_is_concurrent(&self) -> bool;
141+
140142
fn expand_abstract_consts<T: TypeFoldable<Self>>(self, t: T) -> T;
141143

142144
type GenericsOf: GenericsOf<Self>;
@@ -404,4 +406,7 @@ impl<I: Interner> search_graph::Cx for I {
404406
) -> R {
405407
I::with_global_cache(self, mode, f)
406408
}
409+
fn evaluation_is_concurrent(&self) -> bool {
410+
self.evaluation_is_concurrent()
411+
}
407412
}

‎compiler/rustc_type_ir/src/search_graph/global_cache.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,28 @@ impl<X: Cx> GlobalCache<X> {
4444
cx: X,
4545
input: X::Input,
4646

47-
result: X::Result,
47+
origin_result: X::Result,
4848
dep_node: X::DepNodeIndex,
4949

5050
additional_depth: usize,
5151
encountered_overflow: bool,
5252
nested_goals: NestedGoals<X>,
5353
) {
54-
let result = cx.mk_tracked(result, dep_node);
54+
let result = cx.mk_tracked(origin_result, dep_node);
5555
let entry = self.map.entry(input).or_default();
5656
if encountered_overflow {
5757
let with_overflow = WithOverflow { nested_goals, result };
5858
let prev = entry.with_overflow.insert(additional_depth, with_overflow);
59-
assert!(prev.is_none());
59+
if let Some(prev) = &prev {
60+
assert!(cx.evaluation_is_concurrent());
61+
assert_eq!(cx.get_tracked(&prev.result), origin_result);
62+
}
6063
} else {
6164
let prev = entry.success.replace(Success { additional_depth, nested_goals, result });
62-
assert!(prev.is_none());
65+
if let Some(prev) = &prev {
66+
assert!(cx.evaluation_is_concurrent());
67+
assert_eq!(cx.get_tracked(&prev.result), origin_result);
68+
}
6369
}
6470
}
6571

‎compiler/rustc_type_ir/src/search_graph/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ pub trait Cx: Copy {
5353
mode: SolverMode,
5454
f: impl FnOnce(&mut GlobalCache<Self>) -> R,
5555
) -> R;
56+
57+
fn evaluation_is_concurrent(&self) -> bool;
5658
}
5759

5860
pub trait Delegate {

‎config.example.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
# Unless you're developing for a target where Rust CI doesn't build a compiler
4343
# toolchain or changing LLVM locally, you probably want to leave this enabled.
4444
#
45+
# Set this to `true` to download if CI llvm available otherwise it builds
46+
# from `src/llvm-project`.
47+
#
4548
# Set this to `"if-unchanged"` to download only if the llvm-project has not
4649
# been modified. You can also use this if you are unsure whether you're on a
4750
# tier 1 target. All tier 1 targets are currently supported.
@@ -236,7 +239,7 @@
236239
# Instead of downloading the src/stage0 version of cargo-clippy specified,
237240
# use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy.
238241
#
239-
# Note that this option should be used with the same toolchain as the `rustc` option above.
242+
# Note that this option should be used with the same toolchain as the `rustc` option above.
240243
# Otherwise, clippy is likely to fail due to a toolchain conflict.
241244
#cargo-clippy = "/path/to/cargo-clippy"
242245

‎library/core/src/arch.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
1717
/* compiler built-in */
1818
}
1919

20+
/// Inline assembly used in combination with `#[naked]` functions.
21+
///
22+
/// Refer to [Rust By Example] for a usage guide and the [reference] for
23+
/// detailed information about the syntax and available options.
24+
///
25+
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
26+
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
27+
#[unstable(feature = "naked_functions", issue = "90957")]
28+
#[rustc_builtin_macro]
29+
#[cfg(not(bootstrap))]
30+
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
31+
/* compiler built-in */
32+
}
33+
2034
/// Module-level inline assembly.
2135
///
2236
/// Refer to [Rust By Example] for a usage guide and the [reference] for

‎library/core/src/ptr/const_ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<T: ?Sized> *const T {
270270
/// }
271271
/// ```
272272
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
273-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
273+
#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
274274
#[inline]
275275
pub const unsafe fn as_ref<'a>(self) -> Option<&'a T> {
276276
// SAFETY: the caller must guarantee that `self` is valid
@@ -302,7 +302,7 @@ impl<T: ?Sized> *const T {
302302
/// ```
303303
// FIXME: mention it in the docs for `as_ref` and `as_uninit_ref` once stabilized.
304304
#[unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
305-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
305+
#[rustc_const_unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
306306
#[inline]
307307
#[must_use]
308308
pub const unsafe fn as_ref_unchecked<'a>(self) -> &'a T {
@@ -336,7 +336,7 @@ impl<T: ?Sized> *const T {
336336
/// ```
337337
#[inline]
338338
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
339-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
339+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
340340
pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
341341
where
342342
T: Sized,
@@ -1664,7 +1664,7 @@ impl<T> *const [T] {
16641664
/// [allocated object]: crate::ptr#allocated-object
16651665
#[inline]
16661666
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
1667-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
1667+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
16681668
pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]> {
16691669
if self.is_null() {
16701670
None

‎library/core/src/ptr/mut_ptr.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<T: ?Sized> *mut T {
261261
/// }
262262
/// ```
263263
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
264-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
264+
#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
265265
#[inline]
266266
pub const unsafe fn as_ref<'a>(self) -> Option<&'a T> {
267267
// SAFETY: the caller must guarantee that `self` is valid for a
@@ -295,7 +295,7 @@ impl<T: ?Sized> *mut T {
295295
/// ```
296296
// FIXME: mention it in the docs for `as_ref` and `as_uninit_ref` once stabilized.
297297
#[unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
298-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
298+
#[rustc_const_unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
299299
#[inline]
300300
#[must_use]
301301
pub const unsafe fn as_ref_unchecked<'a>(self) -> &'a T {
@@ -334,7 +334,7 @@ impl<T: ?Sized> *mut T {
334334
/// ```
335335
#[inline]
336336
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
337-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
337+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
338338
pub const unsafe fn as_uninit_ref<'a>(self) -> Option<&'a MaybeUninit<T>>
339339
where
340340
T: Sized,
@@ -580,7 +580,7 @@ impl<T: ?Sized> *mut T {
580580
/// println!("{s:?}"); // It'll print: "[4, 2, 3]".
581581
/// ```
582582
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
583-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
583+
#[rustc_const_unstable(feature = "const_ptr_is_null", issue = "74939")]
584584
#[inline]
585585
pub const unsafe fn as_mut<'a>(self) -> Option<&'a mut T> {
586586
// SAFETY: the caller must guarantee that `self` is be valid for
@@ -616,7 +616,7 @@ impl<T: ?Sized> *mut T {
616616
/// ```
617617
// FIXME: mention it in the docs for `as_mut` and `as_uninit_mut` once stabilized.
618618
#[unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
619-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
619+
#[rustc_const_unstable(feature = "ptr_as_ref_unchecked", issue = "122034")]
620620
#[inline]
621621
#[must_use]
622622
pub const unsafe fn as_mut_unchecked<'a>(self) -> &'a mut T {
@@ -639,7 +639,7 @@ impl<T: ?Sized> *mut T {
639639
/// the pointer is [convertible to a reference](crate::ptr#pointer-to-reference-conversion).
640640
#[inline]
641641
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
642-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
642+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
643643
pub const unsafe fn as_uninit_mut<'a>(self) -> Option<&'a mut MaybeUninit<T>>
644644
where
645645
T: Sized,
@@ -2016,7 +2016,7 @@ impl<T> *mut [T] {
20162016
/// [allocated object]: crate::ptr#allocated-object
20172017
#[inline]
20182018
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
2019-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
2019+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
20202020
pub const unsafe fn as_uninit_slice<'a>(self) -> Option<&'a [MaybeUninit<T>]> {
20212021
if self.is_null() {
20222022
None
@@ -2068,7 +2068,7 @@ impl<T> *mut [T] {
20682068
/// [allocated object]: crate::ptr#allocated-object
20692069
#[inline]
20702070
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
2071-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
2071+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
20722072
pub const unsafe fn as_uninit_slice_mut<'a>(self) -> Option<&'a mut [MaybeUninit<T>]> {
20732073
if self.is_null() {
20742074
None

‎library/core/src/ptr/non_null.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<T: Sized> NonNull<T> {
133133
#[inline]
134134
#[must_use]
135135
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
136-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
136+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
137137
pub const unsafe fn as_uninit_ref<'a>(self) -> &'a MaybeUninit<T> {
138138
// SAFETY: the caller must guarantee that `self` meets all the
139139
// requirements for a reference.
@@ -157,7 +157,7 @@ impl<T: Sized> NonNull<T> {
157157
#[inline]
158158
#[must_use]
159159
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
160-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
160+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
161161
pub const unsafe fn as_uninit_mut<'a>(self) -> &'a mut MaybeUninit<T> {
162162
// SAFETY: the caller must guarantee that `self` meets all the
163163
// requirements for a reference.
@@ -1563,7 +1563,7 @@ impl<T> NonNull<[T]> {
15631563
#[inline]
15641564
#[must_use]
15651565
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
1566-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
1566+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
15671567
pub const unsafe fn as_uninit_slice<'a>(self) -> &'a [MaybeUninit<T>] {
15681568
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice`.
15691569
unsafe { slice::from_raw_parts(self.cast().as_ptr(), self.len()) }
@@ -1628,7 +1628,7 @@ impl<T> NonNull<[T]> {
16281628
#[inline]
16291629
#[must_use]
16301630
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
1631-
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
1631+
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
16321632
pub const unsafe fn as_uninit_slice_mut<'a>(self) -> &'a mut [MaybeUninit<T>] {
16331633
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice_mut`.
16341634
unsafe { slice::from_raw_parts_mut(self.cast().as_ptr(), self.len()) }

‎library/std/src/io/error.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ pub enum ErrorKind {
223223
#[stable(feature = "rust1", since = "1.0.0")]
224224
ConnectionReset,
225225
/// The remote host is not reachable.
226-
#[unstable(feature = "io_error_more", issue = "86442")]
226+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
227227
HostUnreachable,
228228
/// The network containing the remote host is not reachable.
229-
#[unstable(feature = "io_error_more", issue = "86442")]
229+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
230230
NetworkUnreachable,
231231
/// The connection was aborted (terminated) by the remote server.
232232
#[stable(feature = "rust1", since = "1.0.0")]
@@ -243,7 +243,7 @@ pub enum ErrorKind {
243243
#[stable(feature = "rust1", since = "1.0.0")]
244244
AddrNotAvailable,
245245
/// The system's networking is down.
246-
#[unstable(feature = "io_error_more", issue = "86442")]
246+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
247247
NetworkDown,
248248
/// The operation failed because a pipe was closed.
249249
#[stable(feature = "rust1", since = "1.0.0")]
@@ -259,18 +259,18 @@ pub enum ErrorKind {
259259
///
260260
/// For example, a filesystem path was specified where one of the intermediate directory
261261
/// components was, in fact, a plain file.
262-
#[unstable(feature = "io_error_more", issue = "86442")]
262+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
263263
NotADirectory,
264264
/// The filesystem object is, unexpectedly, a directory.
265265
///
266266
/// A directory was specified when a non-directory was expected.
267-
#[unstable(feature = "io_error_more", issue = "86442")]
267+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
268268
IsADirectory,
269269
/// A non-empty directory was specified where an empty directory was expected.
270-
#[unstable(feature = "io_error_more", issue = "86442")]
270+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
271271
DirectoryNotEmpty,
272272
/// The filesystem or storage medium is read-only, but a write operation was attempted.
273-
#[unstable(feature = "io_error_more", issue = "86442")]
273+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
274274
ReadOnlyFilesystem,
275275
/// Loop in the filesystem or IO subsystem; often, too many levels of symbolic links.
276276
///
@@ -285,7 +285,7 @@ pub enum ErrorKind {
285285
///
286286
/// With some network filesystems, notably NFS, an open file (or directory) can be invalidated
287287
/// by problems with the network or server.
288-
#[unstable(feature = "io_error_more", issue = "86442")]
288+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
289289
StaleNetworkFileHandle,
290290
/// A parameter was incorrect.
291291
#[stable(feature = "rust1", since = "1.0.0")]
@@ -319,13 +319,13 @@ pub enum ErrorKind {
319319
/// The underlying storage (typically, a filesystem) is full.
320320
///
321321
/// This does not include out of quota errors.
322-
#[unstable(feature = "io_error_more", issue = "86442")]
322+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
323323
StorageFull,
324324
/// Seek on unseekable file.
325325
///
326326
/// Seeking was attempted on an open file handle which is not suitable for seeking - for
327327
/// example, on Unix, a named pipe opened with `File::open`.
328-
#[unstable(feature = "io_error_more", issue = "86442")]
328+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
329329
NotSeekable,
330330
/// Filesystem quota was exceeded.
331331
#[unstable(feature = "io_error_more", issue = "86442")]
@@ -335,30 +335,30 @@ pub enum ErrorKind {
335335
/// This might arise from a hard limit of the underlying filesystem or file access API, or from
336336
/// an administratively imposed resource limitation. Simple disk full, and out of quota, have
337337
/// their own errors.
338-
#[unstable(feature = "io_error_more", issue = "86442")]
338+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
339339
FileTooLarge,
340340
/// Resource is busy.
341-
#[unstable(feature = "io_error_more", issue = "86442")]
341+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
342342
ResourceBusy,
343343
/// Executable file is busy.
344344
///
345345
/// An attempt was made to write to a file which is also in use as a running program. (Not all
346346
/// operating systems detect this situation.)
347-
#[unstable(feature = "io_error_more", issue = "86442")]
347+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
348348
ExecutableFileBusy,
349349
/// Deadlock (avoided).
350350
///
351351
/// A file locking operation would result in deadlock. This situation is typically detected, if
352352
/// at all, on a best-effort basis.
353-
#[unstable(feature = "io_error_more", issue = "86442")]
353+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
354354
Deadlock,
355355
/// Cross-device or cross-filesystem (hard) link or rename.
356356
#[unstable(feature = "io_error_more", issue = "86442")]
357357
CrossesDevices,
358358
/// Too many (hard) links to the same filesystem object.
359359
///
360360
/// The filesystem does not support making so many hardlinks to the same file.
361-
#[unstable(feature = "io_error_more", issue = "86442")]
361+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
362362
TooManyLinks,
363363
/// A filename was invalid.
364364
///
@@ -369,7 +369,7 @@ pub enum ErrorKind {
369369
///
370370
/// When trying to run an external program, a system or process limit on the size of the
371371
/// arguments would have been exceeded.
372-
#[unstable(feature = "io_error_more", issue = "86442")]
372+
#[stable(feature = "io_error_a_bit_more", since = "CURRENT_RUSTC_VERSION")]
373373
ArgumentListTooLong,
374374
/// This operation was interrupted.
375375
///

‎library/std/src/sys/pal/unix/stack_overflow.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ impl Drop for Handler {
3232
target_os = "macos",
3333
target_os = "netbsd",
3434
target_os = "openbsd",
35-
target_os = "solaris"
35+
target_os = "solaris",
36+
target_os = "illumos",
3637
))]
3738
mod imp {
3839
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
@@ -280,7 +281,7 @@ mod imp {
280281
libc::SIGSTKSZ
281282
}
282283

283-
#[cfg(target_os = "solaris")]
284+
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
284285
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
285286
let mut current_stack: libc::stack_t = crate::mem::zeroed();
286287
assert_eq!(libc::stack_getbounds(&mut current_stack), 0);
@@ -486,7 +487,12 @@ mod imp {
486487
Some(guardaddr..guardaddr + page_size)
487488
}
488489

489-
#[cfg(any(target_os = "macos", target_os = "openbsd", target_os = "solaris"))]
490+
#[cfg(any(
491+
target_os = "macos",
492+
target_os = "openbsd",
493+
target_os = "solaris",
494+
target_os = "illumos",
495+
))]
490496
// FIXME: I am probably not unsafe.
491497
unsafe fn current_guard() -> Option<Range<usize>> {
492498
let stackptr = get_stack_start()?;
@@ -569,7 +575,8 @@ mod imp {
569575
target_os = "macos",
570576
target_os = "netbsd",
571577
target_os = "openbsd",
572-
target_os = "solaris"
578+
target_os = "solaris",
579+
target_os = "illumos",
573580
)))]
574581
mod imp {
575582
pub unsafe fn init() {}

‎src/bootstrap/defaults/config.compiler.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ assertions = false
2727
# Enable warnings during the LLVM compilation (when LLVM is changed, causing a compilation)
2828
enable-warnings = true
2929
# Will download LLVM from CI if available on your platform.
30-
download-ci-llvm = "if-unchanged"
30+
# If you intend to modify `src/llvm-project`, use `"if-unchanged"` or `false` instead.
31+
download-ci-llvm = true

‎src/bootstrap/download-ci-llvm-stamp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Change this file to make users of the `download-ci-llvm` configuration download
22
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
33

4-
Last change is for: https://github.com/rust-lang/rust/pull/129116
4+
Last change is for: https://github.com/rust-lang/rust/pull/129788

‎src/bootstrap/src/core/config/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,8 @@ impl Config {
27662766
);
27672767
}
27682768

2769-
b
2769+
// If download-ci-llvm=true we also want to check that CI llvm is available
2770+
b && llvm::is_ci_llvm_available(self, asserts)
27702771
}
27712772
Some(StringOrBool::String(s)) if s == "if-unchanged" => if_unchanged(),
27722773
Some(StringOrBool::String(other)) => {

‎src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
250250
severity: ChangeSeverity::Info,
251251
summary: "New option `llvm.enzyme` to control whether the llvm based autodiff tool (Enzyme) is built.",
252252
},
253+
ChangeInfo {
254+
change_id: 129473,
255+
severity: ChangeSeverity::Warning,
256+
summary: "`download-ci-llvm = true` now checks if CI llvm is available and has become the default for the compiler profile",
257+
},
253258
];
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use crate::command::Command;
2+
use crate::env_var;
3+
4+
/// Returns a command that can be used to invoke Cargo.
5+
pub fn cargo() -> Command {
6+
Command::new(env_var("BOOTSTRAP_CARGO"))
7+
}

‎src/tools/run-make-support/src/external_deps/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! such as `cc` or `python`.
33
44
pub mod c_build;
5+
pub mod cargo;
56
pub mod cc;
67
pub mod clang;
78
pub mod htmldocck;

‎src/tools/run-make-support/src/external_deps/rustc.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ pub struct Rustc {
3636

3737
crate::macros::impl_common_helpers!(Rustc);
3838

39+
pub fn rustc_path() -> String {
40+
env_var("RUSTC")
41+
}
42+
3943
#[track_caller]
4044
fn setup_common() -> Command {
41-
let rustc = env_var("RUSTC");
42-
let mut cmd = Command::new(rustc);
45+
let mut cmd = Command::new(rustc_path());
4346
set_host_rpath(&mut cmd);
4447
cmd
4548
}

‎src/tools/run-make-support/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub use external_deps::{c_build, cc, clang, htmldocck, llvm, python, rustc, rust
5050
// These rely on external dependencies.
5151
pub use cc::{cc, cxx, extra_c_flags, extra_cxx_flags, Cc};
5252
pub use c_build::{build_native_dynamic_lib, build_native_static_lib, build_native_static_lib_optimized, build_native_static_lib_cxx};
53+
pub use cargo::cargo;
5354
pub use clang::{clang, Clang};
5455
pub use htmldocck::htmldocck;
5556
pub use llvm::{
@@ -58,7 +59,7 @@ pub use llvm::{
5859
LlvmProfdata, LlvmReadobj,
5960
};
6061
pub use python::python_command;
61-
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
62+
pub use rustc::{aux_build, bare_rustc, rustc, rustc_path, Rustc};
6263
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
6364

6465
/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
@@ -98,3 +99,4 @@ pub use assertion_helpers::{
9899
pub use string::{
99100
count_regex_matches_in_files_with_extension, invalid_utf8_contains, invalid_utf8_not_contains,
100101
};
102+
use crate::external_deps::cargo;

‎tests/codegen/naked-asan.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
2020

2121
// CHECK: #[[ATTRS]] =
2222
// CHECK-NOT: sanitize_address
23+
// CHECK: !llvm.module.flags
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//! Checks if selected rustc crates can be compiled on the stable channel (or a "simulation" of it).
2+
//! These crates are designed to be used by downstream users.
3+
4+
use run_make_support::{cargo, rustc_path, source_root};
5+
6+
fn main() {
7+
// Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we use)
8+
cargo()
9+
// Ensure `proc-macro2`'s nightly detection is disabled
10+
.env("RUSTC_STAGE", "0")
11+
.env("RUSTC", rustc_path())
12+
// We want to disallow all nightly features to simulate a stable build
13+
.env("RUSTFLAGS", "-Zallow-features=")
14+
.arg("build")
15+
.arg("--manifest-path")
16+
.arg(source_root().join("Cargo.toml"))
17+
.args(&[
18+
// Avoid depending on transitive rustc crates
19+
"--no-default-features",
20+
// Emit artifacts in this temporary directory, not in the source_root's `target` folder
21+
"--target-dir",
22+
"target",
23+
])
24+
// Check that these crates can be compiled on "stable"
25+
.args(&[
26+
"-p",
27+
"rustc_type_ir",
28+
"-p",
29+
"rustc_next_trait_solver",
30+
"-p",
31+
"rustc_pattern_analysis",
32+
"-p",
33+
"rustc_lexer",
34+
])
35+
.run();
36+
}

‎tests/ui/asm/naked-functions-inline.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22
#![feature(naked_functions)]
33
#![crate_type = "lib"]
44

5-
use std::arch::asm;
5+
use std::arch::naked_asm;
66

77
#[naked]
88
pub unsafe extern "C" fn inline_none() {
9-
asm!("", options(noreturn));
9+
naked_asm!("");
1010
}
1111

1212
#[naked]
1313
#[inline]
1414
//~^ ERROR [E0736]
1515
pub unsafe extern "C" fn inline_hint() {
16-
asm!("", options(noreturn));
16+
naked_asm!("");
1717
}
1818

1919
#[naked]
2020
#[inline(always)]
2121
//~^ ERROR [E0736]
2222
pub unsafe extern "C" fn inline_always() {
23-
asm!("", options(noreturn));
23+
naked_asm!("");
2424
}
2525

2626
#[naked]
2727
#[inline(never)]
2828
//~^ ERROR [E0736]
2929
pub unsafe extern "C" fn inline_never() {
30-
asm!("", options(noreturn));
30+
naked_asm!("");
3131
}
3232

3333
#[naked]
3434
#[cfg_attr(all(), inline(never))]
3535
//~^ ERROR [E0736]
3636
pub unsafe extern "C" fn conditional_inline_never() {
37-
asm!("", options(noreturn));
37+
naked_asm!("");
3838
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//@ compile-flags: -Zthreads=16
2+
3+
// original issue: https://github.com/rust-lang/rust/issues/129112
4+
// Previously, the "next" solver asserted that each successful solution is only obtained once.
5+
// This test exhibits a repro that, with next-solver + -Zthreads, triggered that old assert.
6+
// In the presence of multithreaded solving, it's possible to concurrently evaluate things twice,
7+
// which leads to replacing already-solved solutions in the global solution cache!
8+
// We assume this is fine if we check to make sure they are solved the same way each time.
9+
10+
// This test only nondeterministically fails but that's okay, as it will be rerun by CI many times,
11+
// so it should almost always fail before anything is merged. As other thread tests already exist,
12+
// we already face this difficulty, probably. If we need to fix this by reducing the error margin,
13+
// we should improve compiletest.
14+
15+
#[derive(Clone, Eq)] //~ ERROR [E0277]
16+
pub struct Struct<T>(T);
17+
18+
impl<T: Clone, U> PartialEq<U> for Struct<T>
19+
where
20+
U: Into<Struct<T>> + Clone
21+
{
22+
fn eq(&self, _other: &U) -> bool {
23+
todo!()
24+
}
25+
}
26+
27+
fn main() {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0277]: the trait bound `T: Clone` is not satisfied
2+
--> $DIR/global-cache-and-parallel-frontend.rs:15:17
3+
|
4+
LL | #[derive(Clone, Eq)]
5+
| ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq`
6+
|
7+
note: required for `Struct<T>` to implement `PartialEq`
8+
--> $DIR/global-cache-and-parallel-frontend.rs:18:19
9+
|
10+
LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
11+
| ----- ^^^^^^^^^^^^ ^^^^^^^^^
12+
| |
13+
| unsatisfied trait bound introduced here
14+
note: required by a bound in `Eq`
15+
--> $SRC_DIR/core/src/cmp.rs:LL:COL
16+
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
17+
help: consider restricting type parameter `T`
18+
|
19+
LL | pub struct Struct<T: std::clone::Clone>(T);
20+
| +++++++++++++++++++
21+
22+
error: aborting due to 1 previous error
23+
24+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)
Please sign in to comment.