Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a5cbb0

Browse files
committedJun 4, 2020
Auto merge of #72975 - Dylan-DPC:rollup-6zvco5x, r=Dylan-DPC
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
2 parents 6279571 + 26f0d7f commit 2a5cbb0

File tree

19 files changed

+253
-71
lines changed

19 files changed

+253
-71
lines changed
 

‎.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Brian Anderson <banderson@mozilla.com> <andersrb@gmail.com>
4444
Brian Anderson <banderson@mozilla.com> <banderson@mozilla.org>
4545
Brian Dawn <brian.t.dawn@gmail.com>
4646
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
47+
Camelid <camelidcamel@gmail.com> <37223377+camelid@users.noreply.github.com>
4748
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
4849
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <193874+carols10cents@users.noreply.github.com>
4950
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <carol.nichols@gmail.com>

‎Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,9 +1853,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
18531853

18541854
[[package]]
18551855
name = "libc"
1856-
version = "0.2.69"
1856+
version = "0.2.71"
18571857
source = "registry+https://github.com/rust-lang/crates.io-index"
1858-
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
1858+
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
18591859
dependencies = [
18601860
"rustc-std-workspace-core",
18611861
]

‎src/librustc_codegen_ssa/back/link.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,20 +1253,10 @@ fn add_post_link_objects(
12531253

12541254
/// Add arbitrary "pre-link" args defined by the target spec or from command line.
12551255
/// FIXME: Determine where exactly these args need to be inserted.
1256-
fn add_pre_link_args(
1257-
cmd: &mut dyn Linker,
1258-
sess: &Session,
1259-
flavor: LinkerFlavor,
1260-
crate_type: CrateType,
1261-
) {
1256+
fn add_pre_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
12621257
if let Some(args) = sess.target.target.options.pre_link_args.get(&flavor) {
12631258
cmd.args(args);
12641259
}
1265-
if let Some(args) = sess.target.target.options.pre_link_args_crt.get(&flavor) {
1266-
if sess.crt_static(Some(crate_type)) {
1267-
cmd.args(args);
1268-
}
1269-
}
12701260
cmd.args(&sess.opts.debugging_opts.pre_link_args);
12711261
}
12721262

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

15041494
// NO-OPT-OUT, OBJECT-FILES-MAYBE, CUSTOMIZATION-POINT
1505-
add_pre_link_args(cmd, sess, flavor, crate_type);
1495+
add_pre_link_args(cmd, sess, flavor);
15061496

15071497
// NO-OPT-OUT
15081498
add_link_script(cmd, sess, tmpdir, crate_type);

‎src/librustc_codegen_ssa/back/linker.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,21 @@ impl<'a> Linker for GccLinker<'a> {
315315
self.build_dylib(out_filename);
316316
}
317317
}
318+
// VxWorks compiler driver introduced `--static-crt` flag specifically for rustc,
319+
// it switches linking for libc and similar system libraries to static without using
320+
// any `#[link]` attributes in the `libc` crate, see #72782 for details.
321+
// FIXME: Switch to using `#[link]` attributes in the `libc` crate
322+
// similarly to other targets.
323+
if self.sess.target.target.target_os == "vxworks"
324+
&& matches!(
325+
output_kind,
326+
LinkOutputKind::StaticNoPicExe
327+
| LinkOutputKind::StaticPicExe
328+
| LinkOutputKind::StaticDylib
329+
)
330+
{
331+
self.cmd.arg("--static-crt");
332+
}
318333
}
319334

320335
fn link_dylib(&mut self, lib: Symbol) {

‎src/librustc_middle/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ pub struct FieldDef {
18461846

18471847
/// The definition of a user-defined type, e.g., a `struct`, `enum`, or `union`.
18481848
///
1849-
/// These are all interned (by `intern_adt_def`) into the `adt_defs` table.
1849+
/// These are all interned (by `alloc_adt_def`) into the global arena.
18501850
///
18511851
/// The initialism *ADT* stands for an [*algebraic data type (ADT)*][adt].
18521852
/// This is slightly wrong because `union`s are not ADTs.

‎src/librustc_resolve/diagnostics.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ crate fn show_candidates(
14751475
// This is `None` if all placement locations are inside expansions
14761476
use_placement_span: Option<Span>,
14771477
candidates: &[ImportSuggestion],
1478-
better: bool,
1478+
instead: bool,
14791479
found_use: bool,
14801480
) {
14811481
if candidates.is_empty() {
@@ -1486,6 +1486,7 @@ crate fn show_candidates(
14861486
// by iterating through a hash map, so make sure they are ordered:
14871487
let mut path_strings: Vec<_> =
14881488
candidates.iter().map(|c| path_names_to_string(&c.path)).collect();
1489+
14891490
path_strings.sort();
14901491
path_strings.dedup();
14911492

@@ -1494,8 +1495,9 @@ crate fn show_candidates(
14941495
} else {
14951496
("one of these", "items")
14961497
};
1497-
let instead = if better { " instead" } else { "" };
1498-
let msg = format!("consider importing {} {}{}", determiner, kind, instead);
1498+
1499+
let instead = if instead { " instead" } else { "" };
1500+
let mut msg = format!("consider importing {} {}{}", determiner, kind, instead);
14991501

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

15081510
err.span_suggestions(span, &msg, path_strings.into_iter(), Applicability::Unspecified);
15091511
} else {
1510-
let mut msg = msg;
15111512
msg.push(':');
1513+
15121514
for candidate in path_strings {
15131515
msg.push('\n');
15141516
msg.push_str(&candidate);
15151517
}
1518+
15161519
err.note(&msg);
15171520
}
15181521
}

‎src/librustc_resolve/late.rs

Lines changed: 116 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ use rustc_span::Span;
2929
use smallvec::{smallvec, SmallVec};
3030

3131
use log::debug;
32+
use rustc_span::source_map::{respan, Spanned};
3233
use std::collections::BTreeSet;
33-
use std::mem::replace;
34+
use std::mem::{replace, take};
3435

3536
mod diagnostics;
3637
crate mod lifetimes;
@@ -234,6 +235,13 @@ impl<'a> PathSource<'a> {
234235
}
235236
}
236237

238+
fn is_call(self) -> bool {
239+
match self {
240+
PathSource::Expr(Some(&Expr { kind: ExprKind::Call(..), .. })) => true,
241+
_ => false,
242+
}
243+
}
244+
237245
crate fn is_expected(self, res: Res) -> bool {
238246
match self {
239247
PathSource::Type => match res {
@@ -1620,14 +1628,83 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
16201628

16211629
let report_errors = |this: &mut Self, res: Option<Res>| {
16221630
let (err, candidates) = this.smart_resolve_report_errors(path, span, source, res);
1631+
16231632
let def_id = this.parent_scope.module.normal_ancestor_id;
1624-
let better = res.is_some();
1633+
let instead = res.is_some();
16251634
let suggestion =
16261635
if res.is_none() { this.report_missing_type_error(path) } else { None };
1627-
this.r.use_injections.push(UseError { err, candidates, def_id, better, suggestion });
1636+
1637+
this.r.use_injections.push(UseError { err, candidates, def_id, instead, suggestion });
1638+
16281639
PartialRes::new(Res::Err)
16291640
};
16301641

1642+
// For paths originating from calls (like in `HashMap::new()`), tries
1643+
// to enrich the plain `failed to resolve: ...` message with hints
1644+
// about possible missing imports.
1645+
//
1646+
// Similar thing, for types, happens in `report_errors` above.
1647+
let report_errors_for_call = |this: &mut Self, parent_err: Spanned<ResolutionError<'a>>| {
1648+
if !source.is_call() {
1649+
return Some(parent_err);
1650+
}
1651+
1652+
// Before we start looking for candidates, we have to get our hands
1653+
// on the type user is trying to perform invocation on; basically:
1654+
// we're transforming `HashMap::new` into just `HashMap`
1655+
let path = if let Some((_, path)) = path.split_last() {
1656+
path
1657+
} else {
1658+
return Some(parent_err);
1659+
};
1660+
1661+
let (mut err, candidates) =
1662+
this.smart_resolve_report_errors(path, span, PathSource::Type, None);
1663+
1664+
if candidates.is_empty() {
1665+
err.cancel();
1666+
return Some(parent_err);
1667+
}
1668+
1669+
// There are two different error messages user might receive at
1670+
// this point:
1671+
// - E0412 cannot find type `{}` in this scope
1672+
// - E0433 failed to resolve: use of undeclared type or module `{}`
1673+
//
1674+
// The first one is emitted for paths in type-position, and the
1675+
// latter one - for paths in expression-position.
1676+
//
1677+
// Thus (since we're in expression-position at this point), not to
1678+
// confuse the user, we want to keep the *message* from E0432 (so
1679+
// `parent_err`), but we want *hints* from E0412 (so `err`).
1680+
//
1681+
// And that's what happens below - we're just mixing both messages
1682+
// into a single one.
1683+
let mut parent_err = this.r.into_struct_error(parent_err.span, parent_err.node);
1684+
1685+
parent_err.cancel();
1686+
1687+
err.message = take(&mut parent_err.message);
1688+
err.code = take(&mut parent_err.code);
1689+
err.children = take(&mut parent_err.children);
1690+
1691+
drop(parent_err);
1692+
1693+
let def_id = this.parent_scope.module.normal_ancestor_id;
1694+
1695+
this.r.use_injections.push(UseError {
1696+
err,
1697+
candidates,
1698+
def_id,
1699+
instead: false,
1700+
suggestion: None,
1701+
});
1702+
1703+
// We don't return `Some(parent_err)` here, because the error will
1704+
// be already printed as part of the `use` injections
1705+
None
1706+
};
1707+
16311708
let partial_res = match self.resolve_qpath_anywhere(
16321709
id,
16331710
qself,
@@ -1637,14 +1714,15 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
16371714
source.defer_to_typeck(),
16381715
crate_lint,
16391716
) {
1640-
Some(partial_res) if partial_res.unresolved_segments() == 0 => {
1717+
Ok(Some(partial_res)) if partial_res.unresolved_segments() == 0 => {
16411718
if is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err {
16421719
partial_res
16431720
} else {
16441721
report_errors(self, Some(partial_res.base_res()))
16451722
}
16461723
}
1647-
Some(partial_res) if source.defer_to_typeck() => {
1724+
1725+
Ok(Some(partial_res)) if source.defer_to_typeck() => {
16481726
// Not fully resolved associated item `T::A::B` or `<T as Tr>::A::B`
16491727
// or `<T>::A::B`. If `B` should be resolved in value namespace then
16501728
// it needs to be added to the trait map.
@@ -1655,25 +1733,34 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
16551733
}
16561734

16571735
let mut std_path = vec![Segment::from_ident(Ident::with_dummy_span(sym::std))];
1736+
16581737
std_path.extend(path);
1738+
16591739
if self.r.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {
1660-
let cl = CrateLint::No;
1661-
let ns = Some(ns);
16621740
if let PathResult::Module(_) | PathResult::NonModule(_) =
1663-
self.resolve_path(&std_path, ns, false, span, cl)
1741+
self.resolve_path(&std_path, Some(ns), false, span, CrateLint::No)
16641742
{
1665-
// check if we wrote `str::from_utf8` instead of `std::str::from_utf8`
1743+
// Check if we wrote `str::from_utf8` instead of `std::str::from_utf8`
16661744
let item_span =
16671745
path.iter().last().map(|segment| segment.ident.span).unwrap_or(span);
1668-
debug!("accessed item from `std` submodule as a bare type {:?}", std_path);
1746+
16691747
let mut hm = self.r.session.confused_type_with_std_module.borrow_mut();
16701748
hm.insert(item_span, span);
1671-
// In some places (E0223) we only have access to the full path
16721749
hm.insert(span, span);
16731750
}
16741751
}
1752+
16751753
partial_res
16761754
}
1755+
1756+
Err(err) => {
1757+
if let Some(err) = report_errors_for_call(self, err) {
1758+
self.r.report_error(err.span, err.node);
1759+
}
1760+
1761+
PartialRes::new(Res::Err)
1762+
}
1763+
16771764
_ => report_errors(self, None),
16781765
};
16791766

@@ -1682,6 +1769,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
16821769
// Avoid recording definition of `A::B` in `<T as A>::B::C`.
16831770
self.r.record_partial_res(id, partial_res);
16841771
}
1772+
16851773
partial_res
16861774
}
16871775

@@ -1711,17 +1799,16 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
17111799
span: Span,
17121800
defer_to_typeck: bool,
17131801
crate_lint: CrateLint,
1714-
) -> Option<PartialRes> {
1802+
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
17151803
let mut fin_res = None;
1804+
17161805
for (i, ns) in [primary_ns, TypeNS, ValueNS].iter().cloned().enumerate() {
17171806
if i == 0 || ns != primary_ns {
1718-
match self.resolve_qpath(id, qself, path, ns, span, crate_lint) {
1719-
// If defer_to_typeck, then resolution > no resolution,
1720-
// otherwise full resolution > partial resolution > no resolution.
1807+
match self.resolve_qpath(id, qself, path, ns, span, crate_lint)? {
17211808
Some(partial_res)
17221809
if partial_res.unresolved_segments() == 0 || defer_to_typeck =>
17231810
{
1724-
return Some(partial_res);
1811+
return Ok(Some(partial_res));
17251812
}
17261813
partial_res => {
17271814
if fin_res.is_none() {
@@ -1732,19 +1819,19 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
17321819
}
17331820
}
17341821

1735-
// `MacroNS`
17361822
assert!(primary_ns != MacroNS);
1823+
17371824
if qself.is_none() {
17381825
let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident);
17391826
let path = Path { segments: path.iter().map(path_seg).collect(), span };
17401827
if let Ok((_, res)) =
17411828
self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false)
17421829
{
1743-
return Some(PartialRes::new(res));
1830+
return Ok(Some(PartialRes::new(res)));
17441831
}
17451832
}
17461833

1747-
fin_res
1834+
Ok(fin_res)
17481835
}
17491836

17501837
/// Handles paths that may refer to associated items.
@@ -1756,7 +1843,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
17561843
ns: Namespace,
17571844
span: Span,
17581845
crate_lint: CrateLint,
1759-
) -> Option<PartialRes> {
1846+
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
17601847
debug!(
17611848
"resolve_qpath(id={:?}, qself={:?}, path={:?}, ns={:?}, span={:?})",
17621849
id, qself, path, ns, span,
@@ -1767,10 +1854,10 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
17671854
// This is a case like `<T>::B`, where there is no
17681855
// trait to resolve. In that case, we leave the `B`
17691856
// segment to be resolved by type-check.
1770-
return Some(PartialRes::with_unresolved_segments(
1857+
return Ok(Some(PartialRes::with_unresolved_segments(
17711858
Res::Def(DefKind::Mod, DefId::local(CRATE_DEF_INDEX)),
17721859
path.len(),
1773-
));
1860+
)));
17741861
}
17751862

17761863
// Make sure `A::B` in `<T as A::B>::C` is a trait item.
@@ -1800,10 +1887,10 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
18001887
// The remaining segments (the `C` in our example) will
18011888
// have to be resolved by type-check, since that requires doing
18021889
// trait resolution.
1803-
return Some(PartialRes::with_unresolved_segments(
1890+
return Ok(Some(PartialRes::with_unresolved_segments(
18041891
partial_res.base_res(),
18051892
partial_res.unresolved_segments() + path.len() - qself.position - 1,
1806-
));
1893+
)));
18071894
}
18081895

18091896
let result = match self.resolve_path(&path, Some(ns), true, span, crate_lint) {
@@ -1838,11 +1925,10 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
18381925
PartialRes::new(module.res().unwrap())
18391926
}
18401927
PathResult::Failed { is_error_from_last_segment: false, span, label, suggestion } => {
1841-
self.r.report_error(span, ResolutionError::FailedToResolve { label, suggestion });
1842-
PartialRes::new(Res::Err)
1928+
return Err(respan(span, ResolutionError::FailedToResolve { label, suggestion }));
18431929
}
1844-
PathResult::Module(..) | PathResult::Failed { .. } => return None,
1845-
PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"),
1930+
PathResult::Module(..) | PathResult::Failed { .. } => return Ok(None),
1931+
PathResult::Indeterminate => bug!("indeterminate path result in resolve_qpath"),
18461932
};
18471933

18481934
if path.len() > 1
@@ -1862,7 +1948,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
18621948
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
18631949
module.res().unwrap()
18641950
}
1865-
_ => return Some(result),
1951+
_ => return Ok(Some(result)),
18661952
}
18671953
};
18681954
if result.base_res() == unqualified_result {
@@ -1871,7 +1957,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
18711957
}
18721958
}
18731959

1874-
Some(result)
1960+
Ok(Some(result))
18751961
}
18761962

18771963
fn with_resolved_label(&mut self, label: Option<Label>, id: NodeId, f: impl FnOnce(&mut Self)) {

‎src/librustc_resolve/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,13 +618,13 @@ struct PrivacyError<'a> {
618618

619619
struct UseError<'a> {
620620
err: DiagnosticBuilder<'a>,
621-
/// Attach `use` statements for these candidates.
621+
/// Candidates which user could `use` to access the missing type.
622622
candidates: Vec<ImportSuggestion>,
623-
/// The `NodeId` of the module to place the use-statements in.
623+
/// The `DefId` of the module to place the use-statements in.
624624
def_id: DefId,
625-
/// Whether the diagnostic should state that it's "better".
626-
better: bool,
627-
/// Extra free form suggestion. Currently used to suggest new type parameter.
625+
/// Whether the diagnostic should say "instead" (as in `consider importing ... instead`).
626+
instead: bool,
627+
/// Extra free-form suggestion.
628628
suggestion: Option<(Span, &'static str, String, Applicability)>,
629629
}
630630

@@ -2577,12 +2577,12 @@ impl<'a> Resolver<'a> {
25772577
}
25782578

25792579
fn report_with_use_injections(&mut self, krate: &Crate) {
2580-
for UseError { mut err, candidates, def_id, better, suggestion } in
2580+
for UseError { mut err, candidates, def_id, instead, suggestion } in
25812581
self.use_injections.drain(..)
25822582
{
25832583
let (span, found_use) = UsePlacementFinder::check(&self.definitions, krate, def_id);
25842584
if !candidates.is_empty() {
2585-
diagnostics::show_candidates(&mut err, span, &candidates, better, found_use);
2585+
diagnostics::show_candidates(&mut err, span, &candidates, instead, found_use);
25862586
} else if let Some((span, msg, sugg, appl)) = suggestion {
25872587
err.span_suggestion(span, msg, sugg, appl);
25882588
}

‎src/librustc_target/spec/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ pub struct TargetOptions {
733733
pub lld_flavor: LldFlavor,
734734

735735
/// Linker arguments that are passed *before* any user-defined libraries.
736-
pub pre_link_args: LinkArgs, // ... unconditionally
737-
pub pre_link_args_crt: LinkArgs, // ... when linking with a bundled crt
736+
pub pre_link_args: LinkArgs,
738737
/// Objects to link before and after all other object code.
739738
pub pre_link_objects: CrtObjects,
740739
pub post_link_objects: CrtObjects,
@@ -997,7 +996,6 @@ impl Default for TargetOptions {
997996
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
998997
lld_flavor: LldFlavor::Ld,
999998
pre_link_args: LinkArgs::new(),
1000-
pre_link_args_crt: LinkArgs::new(),
1001999
post_link_args: LinkArgs::new(),
10021000
link_script: None,
10031001
asm_args: Vec::new(),
@@ -1397,7 +1395,6 @@ impl Target {
13971395
key!(post_link_objects_fallback, link_objects);
13981396
key!(crt_objects_fallback, crt_objects_fallback)?;
13991397
key!(pre_link_args, link_args);
1400-
key!(pre_link_args_crt, link_args);
14011398
key!(late_link_args, link_args);
14021399
key!(late_link_args_dynamic, link_args);
14031400
key!(late_link_args_static, link_args);
@@ -1629,7 +1626,6 @@ impl ToJson for Target {
16291626
target_option_val!(post_link_objects_fallback);
16301627
target_option_val!(crt_objects_fallback);
16311628
target_option_val!(link_args - pre_link_args);
1632-
target_option_val!(link_args - pre_link_args_crt);
16331629
target_option_val!(link_args - late_link_args);
16341630
target_option_val!(link_args - late_link_args_dynamic);
16351631
target_option_val!(link_args - late_link_args_static);

‎src/librustc_target/spec/tests/tests_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ impl Target {
2525
);
2626
for args in &[
2727
&self.options.pre_link_args,
28-
&self.options.pre_link_args_crt,
2928
&self.options.late_link_args,
3029
&self.options.late_link_args_dynamic,
3130
&self.options.late_link_args_static,

‎src/librustc_target/spec/vxworks_base.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
22

33
pub fn opts() -> TargetOptions {
4-
let mut args_crt = LinkArgs::new();
5-
args_crt.insert(LinkerFlavor::Gcc, vec!["--static-crt".to_string()]);
64
let mut args = LinkArgs::new();
75
args.insert(
86
LinkerFlavor::Gcc,
@@ -29,7 +27,6 @@ pub fn opts() -> TargetOptions {
2927
pre_link_args: args,
3028
position_independent_executables: false,
3129
has_elf_tls: true,
32-
pre_link_args_crt: args_crt,
3330
crt_static_default: true,
3431
crt_static_respected: true,
3532
crt_static_allows_dylibs: true,

‎src/test/ui/derived-errors/issue-31997-1.stderr

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
22
--> $DIR/issue-31997-1.rs:20:19
33
|
44
LL | let mut map = HashMap::new();
5-
| ^^^^^^^ use of undeclared type or module `HashMap`
5+
| ^^^^^^^ not found in this scope
6+
|
7+
help: consider importing one of these items
8+
|
9+
LL | use std::collections::HashMap;
10+
|
11+
LL | use std::collections::hash_map::HashMap;
12+
|
613

714
error: aborting due to previous error
815

‎src/test/ui/error-codes/E0433.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fn main () {
2-
let map = HashMap::new(); //~ ERROR E0433
2+
let map = NonExistingMap::new(); //~ ERROR E0433
33
}

‎src/test/ui/error-codes/E0433.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
1+
error[E0433]: failed to resolve: use of undeclared type or module `NonExistingMap`
22
--> $DIR/E0433.rs:2:15
33
|
4-
LL | let map = HashMap::new();
5-
| ^^^^^^^ use of undeclared type or module `HashMap`
4+
LL | let map = NonExistingMap::new();
5+
| ^^^^^^^^^^^^^^ use of undeclared type or module `NonExistingMap`
66

77
error: aborting due to previous error
88

‎src/test/ui/hygiene/no_implicit_prelude.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ LL | fn f() { ::bar::m!(); }
1313
| ------------ in this macro invocation
1414
...
1515
LL | Vec::new();
16-
| ^^^ use of undeclared type or module `Vec`
16+
| ^^^ not found in this scope
1717
|
1818
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
19+
help: consider importing one of these items
20+
|
21+
LL | use std::prelude::v1::Vec;
22+
|
23+
LL | use std::vec::Vec;
24+
|
1925

2026
error[E0599]: no method named `clone` found for unit type `()` in the current scope
2127
--> $DIR/no_implicit_prelude.rs:12:12

‎src/test/ui/issues/issue-72554.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::collections::BTreeSet;
2+
3+
#[derive(Hash)]
4+
pub enum ElemDerived { //~ ERROR recursive type `ElemDerived` has infinite size
5+
A(ElemDerived)
6+
}
7+
8+
pub enum Elem {
9+
Derived(ElemDerived)
10+
}
11+
12+
pub struct Set(BTreeSet<Elem>);
13+
14+
impl Set {
15+
pub fn into_iter(self) -> impl Iterator<Item = Elem> {
16+
self.0.into_iter()
17+
}
18+
}
19+
20+
fn main() {}

‎src/test/ui/issues/issue-72554.stderr

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0072]: recursive type `ElemDerived` has infinite size
2+
--> $DIR/issue-72554.rs:4:1
3+
|
4+
LL | pub enum ElemDerived {
5+
| ^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
6+
LL | A(ElemDerived)
7+
| ----------- recursive without indirection
8+
|
9+
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ElemDerived` representable
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0072`.

‎src/test/ui/resolve/use_suggestion.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
let x1 = HashMap::new(); //~ ERROR failed to resolve
3+
let x2 = GooMap::new(); //~ ERROR failed to resolve
4+
5+
let y1: HashMap; //~ ERROR cannot find type
6+
let y2: GooMap; //~ ERROR cannot find type
7+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
error[E0433]: failed to resolve: use of undeclared type or module `GooMap`
2+
--> $DIR/use_suggestion.rs:3:14
3+
|
4+
LL | let x2 = GooMap::new();
5+
| ^^^^^^ use of undeclared type or module `GooMap`
6+
7+
error[E0433]: failed to resolve: use of undeclared type or module `HashMap`
8+
--> $DIR/use_suggestion.rs:2:14
9+
|
10+
LL | let x1 = HashMap::new();
11+
| ^^^^^^^ not found in this scope
12+
|
13+
help: consider importing one of these items
14+
|
15+
LL | use std::collections::HashMap;
16+
|
17+
LL | use std::collections::hash_map::HashMap;
18+
|
19+
20+
error[E0412]: cannot find type `HashMap` in this scope
21+
--> $DIR/use_suggestion.rs:5:13
22+
|
23+
LL | let y1: HashMap;
24+
| ^^^^^^^ not found in this scope
25+
|
26+
help: consider importing one of these items
27+
|
28+
LL | use std::collections::HashMap;
29+
|
30+
LL | use std::collections::hash_map::HashMap;
31+
|
32+
33+
error[E0412]: cannot find type `GooMap` in this scope
34+
--> $DIR/use_suggestion.rs:6:13
35+
|
36+
LL | let y2: GooMap;
37+
| ^^^^^^ not found in this scope
38+
39+
error: aborting due to 4 previous errors
40+
41+
Some errors have detailed explanations: E0412, E0433.
42+
For more information about an error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)
Please sign in to comment.