Skip to content

Commit 268a5f4

Browse files
authored
Merge pull request #4102 from rust-lang/rustup-2024-12-21
Automatic Rustup
2 parents fddff47 + 591c47b commit 268a5f4

File tree

94 files changed

+1148
-772
lines changed

Some content is hidden

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

94 files changed

+1148
-772
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
4747
calculate_matrix:
4848
name: Calculate job matrix
49-
runs-on: ubuntu-latest
49+
runs-on: ubuntu-24.04
5050
outputs:
5151
jobs: ${{ steps.jobs.outputs.jobs }}
5252
run_type: ${{ steps.jobs.outputs.run_type }}
@@ -243,7 +243,7 @@ jobs:
243243
# when a workflow is successful listening to webhooks only in our current bors implementation (homu).
244244
outcome:
245245
name: bors build finished
246-
runs-on: ubuntu-latest
246+
runs-on: ubuntu-24.04
247247
needs: [ calculate_matrix, job ]
248248
# !cancelled() executes the job regardless of whether the previous jobs passed or failed
249249
if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }}

.github/workflows/dependencies.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
not-waiting-on-bors:
2828
if: github.repository_owner == 'rust-lang'
2929
name: skip if S-waiting-on-bors
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
steps:
3232
- env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -47,7 +47,7 @@ jobs:
4747
if: github.repository_owner == 'rust-lang'
4848
name: update dependencies
4949
needs: not-waiting-on-bors
50-
runs-on: ubuntu-latest
50+
runs-on: ubuntu-24.04
5151
steps:
5252
- name: checkout the source code
5353
uses: actions/checkout@v4
@@ -94,7 +94,7 @@ jobs:
9494
if: github.repository_owner == 'rust-lang'
9595
name: amend PR
9696
needs: update
97-
runs-on: ubuntu-latest
97+
runs-on: ubuntu-24.04
9898
permissions:
9999
contents: write
100100
pull-requests: write

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -3722,6 +3722,7 @@ dependencies = [
37223722
"rustc_fluent_macro",
37233723
"rustc_hir",
37243724
"rustc_index",
3725+
"rustc_lexer",
37253726
"rustc_lint_defs",
37263727
"rustc_macros",
37273728
"rustc_serialize",

compiler/rustc_ast/src/ast.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1322,11 +1322,15 @@ impl Expr {
13221322
}
13231323

13241324
pub fn precedence(&self) -> ExprPrecedence {
1325-
match self.kind {
1326-
ExprKind::Closure(..) => ExprPrecedence::Closure,
1325+
match &self.kind {
1326+
ExprKind::Closure(closure) => {
1327+
match closure.fn_decl.output {
1328+
FnRetTy::Default(_) => ExprPrecedence::Jump,
1329+
FnRetTy::Ty(_) => ExprPrecedence::Unambiguous,
1330+
}
1331+
}
13271332

13281333
ExprKind::Break(..)
1329-
| ExprKind::Continue(..)
13301334
| ExprKind::Ret(..)
13311335
| ExprKind::Yield(..)
13321336
| ExprKind::Yeet(..)
@@ -1360,6 +1364,7 @@ impl Expr {
13601364
| ExprKind::Block(..)
13611365
| ExprKind::Call(..)
13621366
| ExprKind::ConstBlock(_)
1367+
| ExprKind::Continue(..)
13631368
| ExprKind::Field(..)
13641369
| ExprKind::ForLoop { .. }
13651370
| ExprKind::FormatArgs(..)

compiler/rustc_ast/src/util/parser.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ impl AssocOp {
231231

232232
#[derive(Clone, Copy, PartialEq, PartialOrd)]
233233
pub enum ExprPrecedence {
234-
Closure,
235-
// return, break, yield
234+
// return, break, yield, closures
236235
Jump,
237236
// = += -= *= /= %= &= |= ^= <<= >>=
238237
Assign,

compiler/rustc_borrowck/src/region_infer/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
795795

796796
// If the member region lives in a higher universe, we currently choose
797797
// the most conservative option by leaving it unchanged.
798-
799798
if !self.constraint_sccs().annotation(scc).min_universe().is_root() {
800799
return;
801800
}
@@ -823,12 +822,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
823822
}
824823
debug!(?choice_regions, "after ub");
825824

826-
// At this point we can pick any member of `choice_regions`, but to avoid potential
827-
// non-determinism we will pick the *unique minimum* choice.
825+
// At this point we can pick any member of `choice_regions` and would like to choose
826+
// it to be a small as possible. To avoid potential non-determinism we will pick the
827+
// smallest such choice.
828828
//
829829
// Because universal regions are only partially ordered (i.e, not every two regions are
830830
// comparable), we will ignore any region that doesn't compare to all others when picking
831831
// the minimum choice.
832+
//
832833
// For example, consider `choice_regions = ['static, 'a, 'b, 'c, 'd, 'e]`, where
833834
// `'static: 'a, 'static: 'b, 'a: 'c, 'b: 'c, 'c: 'd, 'c: 'e`.
834835
// `['d, 'e]` are ignored because they do not compare - the same goes for `['a, 'b]`.
@@ -853,6 +854,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
853854
return;
854855
};
855856

857+
// As we require `'scc: 'min_choice`, we have definitely already computed
858+
// its `scc_values` at this point.
856859
let min_choice_scc = self.constraint_sccs.scc(min_choice);
857860
debug!(?min_choice, ?min_choice_scc);
858861
if self.scc_values.add_region(scc, min_choice_scc) {

compiler/rustc_codegen_cranelift/src/driver/jit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ fn dep_symbol_lookup_fn(
294294
// search path.
295295
for &cnum in crate_info.used_crates.iter().rev() {
296296
let src = &crate_info.used_crate_source[&cnum];
297-
match data[cnum.as_usize() - 1] {
297+
match data[cnum] {
298298
Linkage::NotLinked | Linkage::IncludedFromDylib => {}
299299
Linkage::Static => {
300300
let name = crate_info.crate_name[&cnum];

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-28
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,6 @@ pub enum LLVMRustResult {
5656
Failure,
5757
}
5858

59-
// Rust version of the C struct with the same name in rustc_llvm/llvm-wrapper/RustWrapper.cpp.
60-
#[repr(C)]
61-
pub struct LLVMRustCOFFShortExport {
62-
pub name: *const c_char,
63-
pub ordinal_present: bool,
64-
/// value of `ordinal` only important when `ordinal_present` is true
65-
pub ordinal: u16,
66-
}
67-
68-
impl LLVMRustCOFFShortExport {
69-
pub fn new(name: *const c_char, ordinal: Option<u16>) -> LLVMRustCOFFShortExport {
70-
LLVMRustCOFFShortExport {
71-
name,
72-
ordinal_present: ordinal.is_some(),
73-
ordinal: ordinal.unwrap_or(0),
74-
}
75-
}
76-
}
77-
7859
/// Translation of LLVM's MachineTypes enum, defined in llvm\include\llvm\BinaryFormat\COFF.h.
7960
///
8061
/// We include only architectures supported on Windows.
@@ -2347,15 +2328,6 @@ unsafe extern "C" {
23472328
) -> &'a mut RustArchiveMember<'a>;
23482329
pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
23492330

2350-
pub fn LLVMRustWriteImportLibrary(
2351-
ImportName: *const c_char,
2352-
Path: *const c_char,
2353-
Exports: *const LLVMRustCOFFShortExport,
2354-
NumExports: usize,
2355-
Machine: u16,
2356-
MinGW: bool,
2357-
) -> LLVMRustResult;
2358-
23592331
pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
23602332

23612333
pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);

compiler/rustc_codegen_ssa/src/back/link.rs

+13-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_ast::CRATE_NODE_ID;
1515
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
1616
use rustc_data_structures::memmap::Mmap;
1717
use rustc_data_structures::temp_dir::MaybeTempDir;
18-
use rustc_errors::{DiagCtxtHandle, FatalError};
18+
use rustc_errors::DiagCtxtHandle;
1919
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
2020
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
2121
use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
@@ -234,8 +234,6 @@ pub fn each_linked_rlib(
234234
crate_type: Option<CrateType>,
235235
f: &mut dyn FnMut(CrateNum, &Path),
236236
) -> Result<(), errors::LinkRlibError> {
237-
let crates = info.used_crates.iter();
238-
239237
let fmts = if let Some(crate_type) = crate_type {
240238
let Some(fmts) = info.dependency_formats.get(&crate_type) else {
241239
return Err(errors::LinkRlibError::MissingFormat);
@@ -261,8 +259,9 @@ pub fn each_linked_rlib(
261259
info.dependency_formats.first().unwrap().1
262260
};
263261

264-
for &cnum in crates {
265-
match fmts.get(cnum.as_usize() - 1) {
262+
let used_dep_crates = info.used_crates.iter();
263+
for &cnum in used_dep_crates {
264+
match fmts.get(cnum) {
266265
Some(&Linkage::NotLinked | &Linkage::Dynamic | &Linkage::IncludedFromDylib) => continue,
267266
Some(_) => {}
268267
None => return Err(errors::LinkRlibError::MissingFormat),
@@ -624,7 +623,7 @@ fn link_staticlib(
624623

625624
let mut all_rust_dylibs = vec![];
626625
for &cnum in crates {
627-
match fmts.get(cnum.as_usize() - 1) {
626+
match fmts.get(cnum) {
628627
Some(&Linkage::Dynamic) => {}
629628
_ => continue,
630629
}
@@ -1039,22 +1038,22 @@ fn link_natively(
10391038
Err(e) => {
10401039
let linker_not_found = e.kind() == io::ErrorKind::NotFound;
10411040

1042-
if linker_not_found {
1043-
sess.dcx().emit_err(errors::LinkerNotFound { linker_path, error: e });
1041+
let err = if linker_not_found {
1042+
sess.dcx().emit_err(errors::LinkerNotFound { linker_path, error: e })
10441043
} else {
10451044
sess.dcx().emit_err(errors::UnableToExeLinker {
10461045
linker_path,
10471046
error: e,
10481047
command_formatted: format!("{cmd:?}"),
1049-
});
1050-
}
1048+
})
1049+
};
10511050

10521051
if sess.target.is_like_msvc && linker_not_found {
10531052
sess.dcx().emit_note(errors::MsvcMissingLinker);
10541053
sess.dcx().emit_note(errors::CheckInstalledVisualStudio);
10551054
sess.dcx().emit_note(errors::InsufficientVSCodeProduct);
10561055
}
1057-
FatalError.raise();
1056+
err.raise_fatal();
10581057
}
10591058
}
10601059

@@ -2361,8 +2360,8 @@ fn linker_with_args(
23612360
.crate_info
23622361
.native_libraries
23632362
.iter()
2364-
.filter_map(|(cnum, libraries)| {
2365-
(dependency_linkage[cnum.as_usize() - 1] != Linkage::Static).then_some(libraries)
2363+
.filter_map(|(&cnum, libraries)| {
2364+
(dependency_linkage[cnum] != Linkage::Static).then_some(libraries)
23662365
})
23672366
.flatten()
23682367
.collect::<Vec<_>>();
@@ -2754,7 +2753,7 @@ fn add_upstream_rust_crates(
27542753
// (e.g. `libstd` when `-C prefer-dynamic` is used).
27552754
// FIXME: `dependency_formats` can report `profiler_builtins` as `NotLinked` for some
27562755
// reason, it shouldn't do that because `profiler_builtins` should indeed be linked.
2757-
let linkage = data[cnum.as_usize() - 1];
2756+
let linkage = data[cnum];
27582757
let link_static_crate = linkage == Linkage::Static
27592758
|| (linkage == Linkage::IncludedFromDylib || linkage == Linkage::NotLinked)
27602759
&& (codegen_results.crate_info.compiler_builtins == Some(cnum)

compiler/rustc_codegen_ssa/src/back/linker.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1744,15 +1744,10 @@ fn for_each_exported_symbols_include_dep<'tcx>(
17441744
crate_type: CrateType,
17451745
mut callback: impl FnMut(ExportedSymbol<'tcx>, SymbolExportInfo, CrateNum),
17461746
) {
1747-
for &(symbol, info) in tcx.exported_symbols(LOCAL_CRATE).iter() {
1748-
callback(symbol, info, LOCAL_CRATE);
1749-
}
1750-
17511747
let formats = tcx.dependency_formats(());
17521748
let deps = &formats[&crate_type];
17531749

1754-
for (index, dep_format) in deps.iter().enumerate() {
1755-
let cnum = CrateNum::new(index + 1);
1750+
for (cnum, dep_format) in deps.iter_enumerated() {
17561751
// For each dependency that we are linking to statically ...
17571752
if *dep_format == Linkage::Static {
17581753
for &(symbol, info) in tcx.exported_symbols(cnum).iter() {

compiler/rustc_driver_impl/src/pretty.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::cell::Cell;
44
use std::fmt::Write;
55

66
use rustc_ast_pretty::pprust as pprust_ast;
7-
use rustc_errors::FatalError;
87
use rustc_middle::bug;
98
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
109
use rustc_middle::ty::{self, TyCtxt};
@@ -311,9 +310,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
311310
let tcx = ex.tcx();
312311
let mut out = String::new();
313312
rustc_hir_analysis::check_crate(tcx);
314-
if tcx.dcx().has_errors().is_some() {
315-
FatalError.raise();
316-
}
313+
tcx.dcx().abort_if_errors();
317314
debug!("pretty printing THIR tree");
318315
for did in tcx.hir().body_owners() {
319316
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_tree(did));
@@ -324,9 +321,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
324321
let tcx = ex.tcx();
325322
let mut out = String::new();
326323
rustc_hir_analysis::check_crate(tcx);
327-
if tcx.dcx().has_errors().is_some() {
328-
FatalError.raise();
329-
}
324+
tcx.dcx().abort_if_errors();
330325
debug!("pretty printing THIR flat");
331326
for did in tcx.hir().body_owners() {
332327
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_flat(did));

compiler/rustc_errors/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ rustc_error_messages = { path = "../rustc_error_messages" }
1616
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1717
rustc_hir = { path = "../rustc_hir" }
1818
rustc_index = { path = "../rustc_index" }
19+
rustc_lexer = { path = "../rustc_lexer" }
1920
rustc_lint_defs = { path = "../rustc_lint_defs" }
2021
rustc_macros = { path = "../rustc_macros" }
2122
rustc_serialize = { path = "../rustc_serialize" }

compiler/rustc_errors/src/emitter.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use derive_setters::Setters;
1919
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
2020
use rustc_data_structures::sync::{DynSend, IntoDynSyncSend, Lrc};
2121
use rustc_error_messages::{FluentArgs, SpanLabel};
22+
use rustc_lexer;
2223
use rustc_lint_defs::pluralize;
2324
use rustc_span::hygiene::{ExpnKind, MacroKind};
2425
use rustc_span::source_map::SourceMap;
@@ -1698,9 +1699,14 @@ impl HumanEmitter {
16981699
if let Some(source_string) =
16991700
line.line_index.checked_sub(1).and_then(|l| file.get_line(l))
17001701
{
1702+
// Whitespace can only be removed (aka considered leading)
1703+
// if the lexer considers it whitespace.
1704+
// non-rustc_lexer::is_whitespace() chars are reported as an
1705+
// error (ex. no-break-spaces \u{a0}), and thus can't be considered
1706+
// for removal during error reporting.
17011707
let leading_whitespace = source_string
17021708
.chars()
1703-
.take_while(|c| c.is_whitespace())
1709+
.take_while(|c| rustc_lexer::is_whitespace(*c))
17041710
.map(|c| {
17051711
match c {
17061712
// Tabs are displayed as 4 spaces
@@ -1709,7 +1715,7 @@ impl HumanEmitter {
17091715
}
17101716
})
17111717
.sum();
1712-
if source_string.chars().any(|c| !c.is_whitespace()) {
1718+
if source_string.chars().any(|c| !rustc_lexer::is_whitespace(c)) {
17131719
whitespace_margin = min(whitespace_margin, leading_whitespace);
17141720
}
17151721
}

compiler/rustc_feature/src/builtin_attrs.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -912,11 +912,20 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
912912
rustc_attr!(
913913
rustc_deny_explicit_impl,
914914
AttributeType::Normal,
915-
template!(List: "implement_via_object = (true|false)"),
915+
template!(Word),
916916
ErrorFollowing,
917917
EncodeCrossCrate::No,
918918
"#[rustc_deny_explicit_impl] enforces that a trait can have no user-provided impls"
919919
),
920+
rustc_attr!(
921+
rustc_do_not_implement_via_object,
922+
AttributeType::Normal,
923+
template!(Word),
924+
ErrorFollowing,
925+
EncodeCrossCrate::No,
926+
"#[rustc_do_not_implement_via_object] opts out of the automatic trait impl for trait objects \
927+
(`impl Trait for dyn Trait`)"
928+
),
920929
rustc_attr!(
921930
rustc_has_incoherent_inherent_impls, AttributeType::Normal, template!(Word),
922931
ErrorFollowing, EncodeCrossCrate::Yes,

0 commit comments

Comments
 (0)