Skip to content

Commit 39eee17

Browse files
committed
Auto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function) - #82483 (Use FromStr trait for number option parsing) - #82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set) - #83650 (Update Source Serif to release 4.004) - #83826 (List trait impls before deref methods in doc's sidebar) - #83831 (Add `#[inline]` to IpAddr methods) - #83863 (Render destructured struct function param names as underscore) - #83865 (Don't report disambiguator error if link would have been ignored) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 58e7189 + 3ca197e commit 39eee17

File tree

31 files changed

+323
-194
lines changed

31 files changed

+323
-194
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ pub unsafe fn with_llvm_pmb(
10471047
// thresholds copied from clang.
10481048
match (opt_level, opt_size, inline_threshold) {
10491049
(.., Some(t)) => {
1050-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t as u32);
1050+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t);
10511051
}
10521052
(llvm::CodeGenOptLevel::Aggressive, ..) => {
10531053
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 275);

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub struct ModuleConfig {
107107
pub vectorize_loop: bool,
108108
pub vectorize_slp: bool,
109109
pub merge_functions: bool,
110-
pub inline_threshold: Option<usize>,
110+
pub inline_threshold: Option<u32>,
111111
pub new_llvm_pass_manager: bool,
112112
pub emit_lifetime_markers: bool,
113113
}

compiler/rustc_session/src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,7 @@ crate mod dep_tracking {
23322332
impl_dep_tracking_hash_via_hash!(PathBuf);
23332333
impl_dep_tracking_hash_via_hash!(lint::Level);
23342334
impl_dep_tracking_hash_via_hash!(Option<bool>);
2335+
impl_dep_tracking_hash_via_hash!(Option<u32>);
23352336
impl_dep_tracking_hash_via_hash!(Option<usize>);
23362337
impl_dep_tracking_hash_via_hash!(Option<NonZeroUsize>);
23372338
impl_dep_tracking_hash_via_hash!(Option<String>);

compiler/rustc_session/src/options.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ macro_rules! options {
251251
pub const parse_list: &str = "a space-separated list of strings";
252252
pub const parse_opt_list: &str = parse_list;
253253
pub const parse_opt_comma_list: &str = "a comma-separated list of strings";
254-
pub const parse_uint: &str = "a number";
255-
pub const parse_opt_uint: &str = parse_uint;
256-
pub const parse_threads: &str = parse_uint;
254+
pub const parse_number: &str = "a number";
255+
pub const parse_opt_number: &str = parse_number;
256+
pub const parse_threads: &str = parse_number;
257257
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
258258
pub const parse_panic_strategy: &str = "either `unwind` or `abort`";
259259
pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
@@ -417,16 +417,16 @@ macro_rules! options {
417417
}
418418
}
419419

420-
/// Use this for any uint option that has a static default.
421-
fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool {
420+
/// Use this for any numeric option that has a static default.
421+
fn parse_number<T: Copy + FromStr>(slot: &mut T, v: Option<&str>) -> bool {
422422
match v.and_then(|s| s.parse().ok()) {
423423
Some(i) => { *slot = i; true },
424424
None => false
425425
}
426426
}
427427

428-
/// Use this for any uint option that lacks a static default.
429-
fn parse_opt_uint(slot: &mut Option<usize>, v: Option<&str>) -> bool {
428+
/// Use this for any numeric option that lacks a static default.
429+
fn parse_opt_number<T: Copy + FromStr>(slot: &mut Option<T>, v: Option<&str>) -> bool {
430430
match v {
431431
Some(s) => { *slot = s.parse().ok(); slot.is_some() }
432432
None => false
@@ -787,13 +787,13 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
787787
"this option is deprecated and does nothing"),
788788
code_model: Option<CodeModel> = (None, parse_code_model, [TRACKED],
789789
"choose the code model to use (`rustc --print code-models` for details)"),
790-
codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
790+
codegen_units: Option<usize> = (None, parse_opt_number, [UNTRACKED],
791791
"divide crate into N units to optimize in parallel"),
792792
control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [TRACKED],
793793
"use Windows Control Flow Guard (default: no)"),
794794
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
795795
"explicitly enable the `cfg(debug_assertions)` directive"),
796-
debuginfo: usize = (0, parse_uint, [TRACKED],
796+
debuginfo: usize = (0, parse_number, [TRACKED],
797797
"debug info emission level (0 = no debug info, 1 = line tables only, \
798798
2 = full debug info with variable and type information; default: 0)"),
799799
default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
@@ -808,7 +808,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
808808
"force use of unwind tables"),
809809
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
810810
"enable incremental compilation"),
811-
inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
811+
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
812812
"set the threshold for inlining a function"),
813813
link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED],
814814
"a single extra argument to append to the linker invocation (can be used several times)"),
@@ -996,9 +996,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
996996
"verify incr. comp. hashes of green query instances (default: no)"),
997997
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],
998998
"enable MIR inlining (default: no)"),
999-
inline_mir_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
999+
inline_mir_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
10001000
"a default MIR inlining threshold (default: 50)"),
1001-
inline_mir_hint_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
1001+
inline_mir_hint_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
10021002
"inlining threshold for functions with inline hint (default: 100)"),
10031003
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
10041004
"control whether `#[inline]` functions are in all CGUs"),
@@ -1034,7 +1034,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
10341034
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
10351035
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
10361036
(default: no)"),
1037-
mir_opt_level: Option<usize> = (None, parse_opt_uint, [TRACKED],
1037+
mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
10381038
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
10391039
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
10401040
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
@@ -1155,7 +1155,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
11551155
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
11561156
teach: bool = (false, parse_bool, [TRACKED],
11571157
"show extended diagnostic help (default: no)"),
1158-
terminal_width: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
1158+
terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
11591159
"set the current terminal width"),
11601160
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
11611161
"select processor to schedule for (`rustc --print target-cpus` for details)"),

compiler/rustc_typeck/src/check/method/probe.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ struct ProbeContext<'a, 'tcx> {
8383
unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,
8484

8585
is_suggestion: IsSuggestion,
86+
87+
scope_expr_id: hir::HirId,
8688
}
8789

8890
impl<'a, 'tcx> Deref for ProbeContext<'a, 'tcx> {
@@ -448,6 +450,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
448450
orig_values,
449451
steps.steps,
450452
is_suggestion,
453+
scope_expr_id,
451454
);
452455

453456
probe_cx.assemble_inherent_candidates();
@@ -547,6 +550,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
547550
orig_steps_var_values: OriginalQueryValues<'tcx>,
548551
steps: Lrc<Vec<CandidateStep<'tcx>>>,
549552
is_suggestion: IsSuggestion,
553+
scope_expr_id: hir::HirId,
550554
) -> ProbeContext<'a, 'tcx> {
551555
ProbeContext {
552556
fcx,
@@ -564,6 +568,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
564568
private_candidate: None,
565569
unsatisfied_predicates: Vec::new(),
566570
is_suggestion,
571+
scope_expr_id,
567572
}
568573
}
569574

@@ -1312,7 +1317,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
13121317
) {
13131318
self.tcx.struct_span_lint_hir(
13141319
lint::builtin::UNSTABLE_NAME_COLLISIONS,
1315-
self.fcx.body_id,
1320+
self.scope_expr_id,
13161321
self.span,
13171322
|lint| {
13181323
let def_kind = stable_pick.item.kind.as_def_kind();
@@ -1594,6 +1599,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
15941599
self.orig_steps_var_values.clone(),
15951600
steps,
15961601
IsSuggestion(true),
1602+
self.scope_expr_id,
15971603
);
15981604
pcx.allow_similar_names = true;
15991605
pcx.assemble_inherent_candidates();

library/std/src/net/ip.rs

+3
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ impl Ord for Ipv4Addr {
993993
}
994994

995995
impl IntoInner<c::in_addr> for Ipv4Addr {
996+
#[inline]
996997
fn into_inner(self) -> c::in_addr {
997998
self.inner
998999
}
@@ -1800,11 +1801,13 @@ impl Ord for Ipv6Addr {
18001801
}
18011802

18021803
impl AsInner<c::in6_addr> for Ipv6Addr {
1804+
#[inline]
18031805
fn as_inner(&self) -> &c::in6_addr {
18041806
&self.inner
18051807
}
18061808
}
18071809
impl FromInner<c::in6_addr> for Ipv6Addr {
1810+
#[inline]
18081811
fn from_inner(addr: c::in6_addr) -> Ipv6Addr {
18091812
Ipv6Addr { inner: addr }
18101813
}

0 commit comments

Comments
 (0)