Skip to content

Commit

Permalink
Auto merge of #72975 - Dylan-DPC:rollup-6zvco5x, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #72718 (Add regression test for #72554)
 - #72782 (rustc_target: Remove `pre_link_args_crt`)
 - #72923 (Improve E0433, so that it suggests missing imports)
 - #72950 (fix `AdtDef` docs)
 - #72951 (Add Camelid per request)
 - #72964 (Bump libc dependency to latest version (0.2.71))

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jun 4, 2020
2 parents 6279571 + 26f0d7f commit 2a5cbb0
Show file tree
Hide file tree
Showing 19 changed files with 253 additions and 71 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Brian Anderson <banderson@mozilla.com> <andersrb@gmail.com>
Brian Anderson <banderson@mozilla.com> <banderson@mozilla.org>
Brian Dawn <brian.t.dawn@gmail.com>
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
Camelid <camelidcamel@gmail.com> <37223377+camelid@users.noreply.github.com>
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <193874+carols10cents@users.noreply.github.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <carol.nichols@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1853,9 +1853,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"

[[package]]
name = "libc"
version = "0.2.69"
version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down
14 changes: 2 additions & 12 deletions src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,20 +1253,10 @@ fn add_post_link_objects(

/// Add arbitrary "pre-link" args defined by the target spec or from command line.
/// FIXME: Determine where exactly these args need to be inserted.
fn add_pre_link_args(
cmd: &mut dyn Linker,
sess: &Session,
flavor: LinkerFlavor,
crate_type: CrateType,
) {
fn add_pre_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
if let Some(args) = sess.target.target.options.pre_link_args.get(&flavor) {
cmd.args(args);
}
if let Some(args) = sess.target.target.options.pre_link_args_crt.get(&flavor) {
if sess.crt_static(Some(crate_type)) {
cmd.args(args);
}
}
cmd.args(&sess.opts.debugging_opts.pre_link_args);
}

Expand Down Expand Up @@ -1502,7 +1492,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
let crt_objects_fallback = crt_objects_fallback(sess, crate_type);

// NO-OPT-OUT, OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT
add_pre_link_args(cmd, sess, flavor, crate_type);
add_pre_link_args(cmd, sess, flavor);

// NO-OPT-OUT
add_link_script(cmd, sess, tmpdir, crate_type);
Expand Down
15 changes: 15 additions & 0 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ impl<'a> Linker for GccLinker<'a> {
self.build_dylib(out_filename);
}
}
// VxWorks compiler driver introduced `--static-crt` flag specifically for rustc,
// it switches linking for libc and similar system libraries to static without using
// any `#[link]` attributes in the `libc` crate, see #72782 for details.
// FIXME: Switch to using `#[link]` attributes in the `libc` crate
// similarly to other targets.
if self.sess.target.target.target_os == "vxworks"
&& matches!(
output_kind,
LinkOutputKind::StaticNoPicExe
| LinkOutputKind::StaticPicExe
| LinkOutputKind::StaticDylib
)
{
self.cmd.arg("--static-crt");
}
}

fn link_dylib(&mut self, lib: Symbol) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ pub struct FieldDef {

/// The definition of a user-defined type, e.g., a `struct`, `enum`, or `union`.
///
/// These are all interned (by `intern_adt_def`) into the `adt_defs` table.
/// These are all interned (by `alloc_adt_def`) into the global arena.
///
/// The initialism *ADT* stands for an [*algebraic data type (ADT)*][adt].
/// This is slightly wrong because `union`s are not ADTs.
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ crate fn show_candidates(
// This is `None` if all placement locations are inside expansions
use_placement_span: Option<Span>,
candidates: &[ImportSuggestion],
better: bool,
instead: bool,
found_use: bool,
) {
if candidates.is_empty() {
Expand All @@ -1486,6 +1486,7 @@ crate fn show_candidates(
// by iterating through a hash map, so make sure they are ordered:
let mut path_strings: Vec<_> =
candidates.iter().map(|c| path_names_to_string(&c.path)).collect();

path_strings.sort();
path_strings.dedup();

Expand All @@ -1494,8 +1495,9 @@ crate fn show_candidates(
} else {
("one of these", "items")
};
let instead = if better { " instead" } else { "" };
let msg = format!("consider importing {} {}{}", determiner, kind, instead);

let instead = if instead { " instead" } else { "" };
let mut msg = format!("consider importing {} {}{}", determiner, kind, instead);

if let Some(span) = use_placement_span {
for candidate in &mut path_strings {
Expand All @@ -1507,12 +1509,13 @@ crate fn show_candidates(

err.span_suggestions(span, &msg, path_strings.into_iter(), Applicability::Unspecified);
} else {
let mut msg = msg;
msg.push(':');

for candidate in path_strings {
msg.push('\n');
msg.push_str(&candidate);
}

err.note(&msg);
}
}
Loading

0 comments on commit 2a5cbb0

Please sign in to comment.