Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #83880

Merged
merged 22 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1ec9057
Use FromStr trait for number option parsing
tmiasko Feb 24, 2021
a421cfe
Add regression test to ensure `#[allow(unstable_name_collisions)]` works
magurotuna Feb 6, 2021
120e5bd
Pass HirId of expr in question instead of function body
magurotuna Feb 9, 2021
06b3636
Remove unnecessary passing of scope_expr_id
magurotuna Feb 27, 2021
8a05892
List trait impls before methods from deref in the sidebar of Rustdoc'…
slightlyoutofphase Apr 3, 2021
72502e8
Remove trailing whitespace
slightlyoutofphase Apr 3, 2021
a3d0fa8
Add `#[inline]` to IpAddr methods
AngelicosPhosphoros Apr 3, 2021
14406df
Use the beta compiler for building bootstrap tools when `download-rus…
jyn514 Feb 10, 2021
82b2863
Render destructured struct function param names as underscore.
eggyal Apr 4, 2021
45ccd50
Don't report disambiguator error if link would have been ignored
camelid Apr 4, 2021
01be6dd
Merge branch 'master' of github.com:rust-lang/rust into issue-83852
eggyal Apr 4, 2021
14fac68
Renamed test
eggyal Apr 4, 2021
29fed9a
Update Source Serif to release 4.004
tspiteri Mar 29, 2021
70b0874
change SourceSerifPro to SourceSerif4 in emit-shared-files test
tspiteri Apr 5, 2021
54ea8e1
Rollup merge of #81922 - magurotuna:issue81522, r=matthewjasper
Dylan-DPC Apr 5, 2021
e64dbb1
Rollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper
Dylan-DPC Apr 5, 2021
ca9cbea
Rollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simula…
Dylan-DPC Apr 5, 2021
ad0a995
Rollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez
Dylan-DPC Apr 5, 2021
d60cf78
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shu…
Dylan-DPC Apr 5, 2021
445aa40
Rollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-i…
Dylan-DPC Apr 5, 2021
98e7a4e
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514
Dylan-DPC Apr 5, 2021
3ca197e
Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514
Dylan-DPC Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ pub unsafe fn with_llvm_pmb(
// thresholds copied from clang.
match (opt_level, opt_size, inline_threshold) {
(.., Some(t)) => {
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t as u32);
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t);
}
(llvm::CodeGenOptLevel::Aggressive, ..) => {
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 275);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub struct ModuleConfig {
pub vectorize_loop: bool,
pub vectorize_slp: bool,
pub merge_functions: bool,
pub inline_threshold: Option<usize>,
pub inline_threshold: Option<u32>,
pub new_llvm_pass_manager: bool,
pub emit_lifetime_markers: bool,
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,7 @@ crate mod dep_tracking {
impl_dep_tracking_hash_via_hash!(PathBuf);
impl_dep_tracking_hash_via_hash!(lint::Level);
impl_dep_tracking_hash_via_hash!(Option<bool>);
impl_dep_tracking_hash_via_hash!(Option<u32>);
impl_dep_tracking_hash_via_hash!(Option<usize>);
impl_dep_tracking_hash_via_hash!(Option<NonZeroUsize>);
impl_dep_tracking_hash_via_hash!(Option<String>);
Expand Down
28 changes: 14 additions & 14 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ macro_rules! options {
pub const parse_list: &str = "a space-separated list of strings";
pub const parse_opt_list: &str = parse_list;
pub const parse_opt_comma_list: &str = "a comma-separated list of strings";
pub const parse_uint: &str = "a number";
pub const parse_opt_uint: &str = parse_uint;
pub const parse_threads: &str = parse_uint;
pub const parse_number: &str = "a number";
pub const parse_opt_number: &str = parse_number;
pub const parse_threads: &str = parse_number;
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
pub const parse_panic_strategy: &str = "either `unwind` or `abort`";
pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
Expand Down Expand Up @@ -417,16 +417,16 @@ macro_rules! options {
}
}

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

/// Use this for any uint option that lacks a static default.
fn parse_opt_uint(slot: &mut Option<usize>, v: Option<&str>) -> bool {
/// Use this for any numeric option that lacks a static default.
fn parse_opt_number<T: Copy + FromStr>(slot: &mut Option<T>, v: Option<&str>) -> bool {
match v {
Some(s) => { *slot = s.parse().ok(); slot.is_some() }
None => false
Expand Down Expand Up @@ -787,13 +787,13 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"this option is deprecated and does nothing"),
code_model: Option<CodeModel> = (None, parse_code_model, [TRACKED],
"choose the code model to use (`rustc --print code-models` for details)"),
codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
codegen_units: Option<usize> = (None, parse_opt_number, [UNTRACKED],
"divide crate into N units to optimize in parallel"),
control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [TRACKED],
"use Windows Control Flow Guard (default: no)"),
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
"explicitly enable the `cfg(debug_assertions)` directive"),
debuginfo: usize = (0, parse_uint, [TRACKED],
debuginfo: usize = (0, parse_number, [TRACKED],
"debug info emission level (0 = no debug info, 1 = line tables only, \
2 = full debug info with variable and type information; default: 0)"),
default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
Expand All @@ -808,7 +808,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"force use of unwind tables"),
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
"enable incremental compilation"),
inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
"set the threshold for inlining a function"),
link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED],
"a single extra argument to append to the linker invocation (can be used several times)"),
Expand Down Expand Up @@ -996,9 +996,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"verify incr. comp. hashes of green query instances (default: no)"),
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],
"enable MIR inlining (default: no)"),
inline_mir_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
inline_mir_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
"a default MIR inlining threshold (default: 50)"),
inline_mir_hint_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
inline_mir_hint_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
"inlining threshold for functions with inline hint (default: 100)"),
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
"control whether `#[inline]` functions are in all CGUs"),
Expand Down Expand Up @@ -1034,7 +1034,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
(default: no)"),
mir_opt_level: Option<usize> = (None, parse_opt_uint, [TRACKED],
mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
Expand Down Expand Up @@ -1155,7 +1155,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
teach: bool = (false, parse_bool, [TRACKED],
"show extended diagnostic help (default: no)"),
terminal_width: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
"set the current terminal width"),
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
"select processor to schedule for (`rustc --print target-cpus` for details)"),
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_typeck/src/check/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ struct ProbeContext<'a, 'tcx> {
unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,

is_suggestion: IsSuggestion,

scope_expr_id: hir::HirId,
}

impl<'a, 'tcx> Deref for ProbeContext<'a, 'tcx> {
Expand Down Expand Up @@ -448,6 +450,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
orig_values,
steps.steps,
is_suggestion,
scope_expr_id,
);

probe_cx.assemble_inherent_candidates();
Expand Down Expand Up @@ -547,6 +550,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
orig_steps_var_values: OriginalQueryValues<'tcx>,
steps: Lrc<Vec<CandidateStep<'tcx>>>,
is_suggestion: IsSuggestion,
scope_expr_id: hir::HirId,
) -> ProbeContext<'a, 'tcx> {
ProbeContext {
fcx,
Expand All @@ -564,6 +568,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
private_candidate: None,
unsatisfied_predicates: Vec::new(),
is_suggestion,
scope_expr_id,
}
}

Expand Down Expand Up @@ -1312,7 +1317,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
) {
self.tcx.struct_span_lint_hir(
lint::builtin::UNSTABLE_NAME_COLLISIONS,
self.fcx.body_id,
self.scope_expr_id,
self.span,
|lint| {
let def_kind = stable_pick.item.kind.as_def_kind();
Expand Down Expand Up @@ -1594,6 +1599,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
self.orig_steps_var_values.clone(),
steps,
IsSuggestion(true),
self.scope_expr_id,
);
pcx.allow_similar_names = true;
pcx.assemble_inherent_candidates();
Expand Down
3 changes: 3 additions & 0 deletions library/std/src/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ impl Ord for Ipv4Addr {
}

impl IntoInner<c::in_addr> for Ipv4Addr {
#[inline]
fn into_inner(self) -> c::in_addr {
self.inner
}
Expand Down Expand Up @@ -1800,11 +1801,13 @@ impl Ord for Ipv6Addr {
}

impl AsInner<c::in6_addr> for Ipv6Addr {
#[inline]
fn as_inner(&self) -> &c::in6_addr {
&self.inner
}
}
impl FromInner<c::in6_addr> for Ipv6Addr {
#[inline]
fn from_inner(addr: c::in6_addr) -> Ipv6Addr {
Ipv6Addr { inner: addr }
}
Expand Down
Loading