Skip to content

Commit 930451e

Browse files
authored
Merge pull request rust-lang#20761 from rust-lang/rustc-pull
Rustc pull update
2 parents c0e45c8 + 24f6f94 commit 930451e

File tree

734 files changed

+9694
-4307
lines changed

Some content is hidden

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

734 files changed

+9694
-4307
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bootstrapping, the compiler architecture, source code representation, and more.
3131

3232
## [Getting help](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions)
3333

34-
There are many ways you can get help when you're stuck. Rust has many platforms for this:
35-
[internals], [rust-zulip], and [rust-discord]. It is recommended to ask for help on
34+
There are many ways you can get help when you're stuck. Rust has two platforms for this:
35+
[internals] and [rust-zulip]. It is recommended to ask for help on
3636
the [rust-zulip], but any of these platforms are great ways to seek help and even
3737
find a mentor! You can learn more about asking questions and getting help in the
3838
[Asking Questions](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions) chapter of the [rustc-dev-guide].
@@ -47,5 +47,4 @@ refer to [this section][contributing-bug-reports] and [open an issue][issue temp
4747
[contributing-bug-reports]: https://rustc-dev-guide.rust-lang.org/contributing.html#bug-reports
4848
[issue template]: https://github.com/rust-lang/rust/issues/new/choose
4949
[internals]: https://internals.rust-lang.org
50-
[rust-discord]: http://discord.gg/rust-lang
5150
[rust-zulip]: https://rust-lang.zulipchat.com

Cargo.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ dependencies = [
334334
"anyhow",
335335
"build_helper",
336336
"curl",
337+
"hex",
337338
"indexmap",
338339
"serde",
340+
"sha2",
339341
"toml 0.8.23",
340342
]
341343

@@ -5239,9 +5241,9 @@ dependencies = [
52395241

52405242
[[package]]
52415243
name = "stringdex"
5242-
version = "0.0.1-alpha9"
5244+
version = "0.0.1-alpha10"
52435245
source = "registry+https://github.com/rust-lang/crates.io-index"
5244-
checksum = "7081029913fd7d591c0112182aba8c98ae886b4f12edb208130496cd17dc3c15"
5246+
checksum = "0fa846a7d509d1828a4f90962dc09810e161abcada7fc6a921e92c168d0811d7"
52455247
dependencies = [
52465248
"stacker",
52475249
]

bootstrap.example.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,16 +768,15 @@
768768
# make this default to false.
769769
#rust.lld = false in all cases, except on `x86_64-unknown-linux-gnu` as described above, where it is true
770770

771-
# Indicates whether LLD will be used to link Rust crates during bootstrap on
772-
# supported platforms.
771+
# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD.
773772
# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH
774773
# will be used.
775774
# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used.
776775
#
777776
# On MSVC, LLD will not be used if we're cross linking.
778777
#
779778
# Explicitly setting the linker for a target will override this option when targeting MSVC.
780-
#rust.use-lld = false
779+
#rust.bootstrap-override-lld = false
781780

782781
# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
783782
# sysroot.
@@ -950,7 +949,7 @@
950949
# Linker to be used to bootstrap Rust code. Note that the
951950
# default value is platform specific, and if not specified it may also depend on
952951
# what platform is crossing to what platform.
953-
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
952+
# Setting this will override the `bootstrap-override-lld` option for Rust code when targeting MSVC.
954953
#linker = "cc" (path)
955954

956955
# Should rustc and the standard library be built with split debuginfo? Default

compiler/rustc_ast/src/expand/autodiff_attrs.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use std::fmt::{self, Display, Formatter};
77
use std::str::FromStr;
88

9+
use crate::expand::typetree::TypeTree;
910
use crate::expand::{Decodable, Encodable, HashStable_Generic};
1011
use crate::{Ty, TyKind};
1112

@@ -84,6 +85,8 @@ pub struct AutoDiffItem {
8485
/// The name of the function being generated
8586
pub target: String,
8687
pub attrs: AutoDiffAttrs,
88+
pub inputs: Vec<TypeTree>,
89+
pub output: TypeTree,
8790
}
8891

8992
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
@@ -275,14 +278,22 @@ impl AutoDiffAttrs {
275278
!matches!(self.mode, DiffMode::Error | DiffMode::Source)
276279
}
277280

278-
pub fn into_item(self, source: String, target: String) -> AutoDiffItem {
279-
AutoDiffItem { source, target, attrs: self }
281+
pub fn into_item(
282+
self,
283+
source: String,
284+
target: String,
285+
inputs: Vec<TypeTree>,
286+
output: TypeTree,
287+
) -> AutoDiffItem {
288+
AutoDiffItem { source, target, inputs, output, attrs: self }
280289
}
281290
}
282291

283292
impl fmt::Display for AutoDiffItem {
284293
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
285294
write!(f, "Differentiating {} -> {}", self.source, self.target)?;
286-
write!(f, " with attributes: {:?}", self.attrs)
295+
write!(f, " with attributes: {:?}", self.attrs)?;
296+
write!(f, " with inputs: {:?}", self.inputs)?;
297+
write!(f, " with output: {:?}", self.output)
287298
}
288299
}

compiler/rustc_ast/src/expand/typetree.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum Kind {
3131
Half,
3232
Float,
3333
Double,
34+
F128,
3435
Unknown,
3536
}
3637

compiler/rustc_ast_lowering/src/format.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -487,26 +487,6 @@ fn expand_format_args<'hir>(
487487
// Generate:
488488
// []
489489
(vec![], ctx.arena.alloc(ctx.expr(macsp, hir::ExprKind::Array(&[]))))
490-
} else if argmap.len() == 1 && arguments.len() == 1 {
491-
// Only one argument, so we don't need to make the `args` tuple.
492-
//
493-
// Generate:
494-
// super let args = [<core::fmt::Argument>::new_display(&arg)];
495-
let args = ctx.arena.alloc_from_iter(argmap.iter().map(
496-
|(&(arg_index, ty), &placeholder_span)| {
497-
let arg = &arguments[arg_index];
498-
let placeholder_span =
499-
placeholder_span.unwrap_or(arg.expr.span).with_ctxt(macsp.ctxt());
500-
let arg = ctx.lower_expr(&arg.expr);
501-
let ref_arg = ctx.arena.alloc(ctx.expr_ref(arg.span.with_ctxt(macsp.ctxt()), arg));
502-
make_argument(ctx, placeholder_span, ref_arg, ty)
503-
},
504-
));
505-
let args = ctx.arena.alloc(ctx.expr(macsp, hir::ExprKind::Array(args)));
506-
let args_ident = Ident::new(sym::args, macsp);
507-
let (args_pat, args_hir_id) = ctx.pat_ident(macsp, args_ident);
508-
let let_statement = ctx.stmt_super_let_pat(macsp, args_pat, Some(args));
509-
(vec![let_statement], ctx.arena.alloc(ctx.expr_ident_mut(macsp, args_ident, args_hir_id)))
510490
} else {
511491
// Generate:
512492
// super let args = (&arg0, &arg1, &…);

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
183183
gate_doc!(
184184
"experimental" {
185185
cfg => doc_cfg
186-
cfg_hide => doc_cfg_hide
186+
auto_cfg => doc_cfg
187187
masked => doc_masked
188188
notable_trait => doc_notable_trait
189189
}

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,4 @@
1-
use std::num::IntErrorKind;
2-
3-
use rustc_hir::limit::Limit;
4-
51
use super::prelude::*;
6-
use crate::session_diagnostics::LimitInvalid;
7-
8-
impl<S: Stage> AcceptContext<'_, '_, S> {
9-
fn parse_limit_int(&self, nv: &NameValueParser) -> Option<Limit> {
10-
let Some(limit) = nv.value_as_str() else {
11-
self.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
12-
return None;
13-
};
14-
15-
let error_str = match limit.as_str().parse() {
16-
Ok(i) => return Some(Limit::new(i)),
17-
Err(e) => match e.kind() {
18-
IntErrorKind::PosOverflow => "`limit` is too large",
19-
IntErrorKind::Empty => "`limit` must be a non-negative integer",
20-
IntErrorKind::InvalidDigit => "not a valid integer",
21-
IntErrorKind::NegOverflow => {
22-
panic!(
23-
"`limit` should never negatively overflow since we're parsing into a usize and we'd get Empty instead"
24-
)
25-
}
26-
IntErrorKind::Zero => {
27-
panic!("zero is a valid `limit` so should have returned Ok() when parsing")
28-
}
29-
kind => panic!("unimplemented IntErrorKind variant: {:?}", kind),
30-
},
31-
};
32-
33-
self.emit_err(LimitInvalid { span: self.attr_span, value_span: nv.value_span, error_str });
34-
35-
None
36-
}
37-
}
382

393
pub(crate) struct CrateNameParser;
404

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
use rustc_hir::attrs::{DebugVisualizer, DebuggerVisualizerType};
2+
3+
use super::prelude::*;
4+
5+
pub(crate) struct DebuggerViualizerParser;
6+
7+
impl<S: Stage> CombineAttributeParser<S> for DebuggerViualizerParser {
8+
const PATH: &[Symbol] = &[sym::debugger_visualizer];
9+
const ALLOWED_TARGETS: AllowedTargets =
10+
AllowedTargets::AllowList(&[Allow(Target::Mod), Allow(Target::Crate)]);
11+
const TEMPLATE: AttributeTemplate = template!(
12+
List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
13+
"https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
14+
);
15+
16+
type Item = DebugVisualizer;
17+
const CONVERT: ConvertFn<Self::Item> = |v, _| AttributeKind::DebuggerVisualizer(v);
18+
19+
fn extend<'c>(
20+
cx: &'c mut AcceptContext<'_, '_, S>,
21+
args: &'c ArgParser<'_>,
22+
) -> impl IntoIterator<Item = Self::Item> + 'c {
23+
let Some(l) = args.list() else {
24+
cx.expected_list(args.span().unwrap_or(cx.attr_span));
25+
return None;
26+
};
27+
let Some(single) = l.single() else {
28+
cx.expected_single_argument(l.span);
29+
return None;
30+
};
31+
let Some(mi) = single.meta_item() else {
32+
cx.expected_name_value(single.span(), None);
33+
return None;
34+
};
35+
let path = mi.path().word_sym();
36+
let visualizer_type = match path {
37+
Some(sym::natvis_file) => DebuggerVisualizerType::Natvis,
38+
Some(sym::gdb_script_file) => DebuggerVisualizerType::GdbPrettyPrinter,
39+
_ => {
40+
cx.expected_specific_argument(
41+
mi.path().span(),
42+
&[sym::natvis_file, sym::gdb_script_file],
43+
);
44+
return None;
45+
}
46+
};
47+
48+
let Some(path) = mi.args().name_value() else {
49+
cx.expected_name_value(single.span(), path);
50+
return None;
51+
};
52+
53+
let Some(path) = path.value_as_str() else {
54+
cx.expected_string_literal(path.value_span, Some(path.value_as_lit()));
55+
return None;
56+
};
57+
58+
Some(DebugVisualizer { span: mi.span(), visualizer_type, path })
59+
}
60+
}

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub(crate) mod cfg_old;
3636
pub(crate) mod codegen_attrs;
3737
pub(crate) mod confusables;
3838
pub(crate) mod crate_level;
39+
pub(crate) mod debugger;
3940
pub(crate) mod deprecation;
4041
pub(crate) mod dummy;
4142
pub(crate) mod inline;

0 commit comments

Comments
 (0)