Skip to content

Commit ef54f57

Browse files
committed
Auto merge of #64246 - Centril:rollup-zey4o09, r=Centril
Rollup of 10 pull requests Successful merges: - #63919 (Use hygiene for AST passes) - #63927 (Filter linkcheck spurious failure) - #64149 (rustc_codegen_llvm: give names to non-alloca variable values.) - #64192 (Bail out when encountering likely missing turbofish in parser) - #64231 (Move the HIR CFG to `rustc_ast_borrowck`) - #64233 (Correct pluralisation of various diagnostic messages) - #64236 (reduce visibility) - #64240 (Include compiler-rt in the source tarball) - #64241 ([doc] Added more prereqs and note about default directory) - #64243 (Move injection of attributes from command line to `libsyntax_ext`) Failed merges: r? @ghost
2 parents da13f06 + 3d4cb50 commit ef54f57

File tree

90 files changed

+857
-749
lines changed

Some content is hidden

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

90 files changed

+857
-749
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ or reading the [rustc guide][rustcguidebuild].
3232
* `cmake` 3.4.3 or later
3333
* `curl`
3434
* `git`
35+
* `ssl` which comes in `libssl-dev` or `openssl-devel`
3536

3637
2. Clone the [source] with `git`:
3738

@@ -56,6 +57,8 @@ or reading the [rustc guide][rustcguidebuild].
5657
an installation (using `./x.py install`) that you set the `prefix` value
5758
in the `[install]` section to a directory that you have write permissions.
5859

60+
Create install directory if you are not installing in default directory
61+
5962
4. Build and install:
6063

6164
```sh

src/bootstrap/dist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]
808808
"llvm-project/lld", "llvm-project\\lld",
809809
"llvm-project/lldb", "llvm-project\\lldb",
810810
"llvm-project/llvm", "llvm-project\\llvm",
811+
"llvm-project/compiler-rt", "llvm-project\\compiler-rt",
811812
];
812813
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
813814
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))

src/librustc/ich/impls_syntax.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,17 @@ impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnData {
390390
impl_stable_hash_for!(enum ::syntax_pos::hygiene::ExpnKind {
391391
Root,
392392
Macro(kind, descr),
393+
AstPass(kind),
393394
Desugaring(kind)
394395
});
395396

397+
impl_stable_hash_for!(enum ::syntax_pos::hygiene::AstPass {
398+
StdImports,
399+
TestHarness,
400+
ProcMacroHarness,
401+
PluginMacroDefs,
402+
});
403+
396404
impl_stable_hash_for!(enum ::syntax_pos::hygiene::DesugaringKind {
397405
CondTemporary,
398406
Async,

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ pub mod query;
9797

9898
#[macro_use]
9999
pub mod arena;
100-
pub mod cfg;
101100
pub mod dep_graph;
102101
pub mod hir;
103102
pub mod ich;

src/librustc/lint/mod.rs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,30 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
646646
(Level::Forbid, None) => sess.struct_err(msg),
647647
};
648648

649+
// Check for future incompatibility lints and issue a stronger warning.
650+
let lints = sess.lint_store.borrow();
651+
let lint_id = LintId::of(lint);
652+
let future_incompatible = lints.future_incompatible(lint_id);
653+
654+
// If this code originates in a foreign macro, aka something that this crate
655+
// did not itself author, then it's likely that there's nothing this crate
656+
// can do about it. We probably want to skip the lint entirely.
657+
if err.span.primary_spans().iter().any(|s| in_external_macro(sess, *s)) {
658+
// Any suggestions made here are likely to be incorrect, so anything we
659+
// emit shouldn't be automatically fixed by rustfix.
660+
err.allow_suggestions(false);
661+
662+
// If this is a future incompatible lint it'll become a hard error, so
663+
// we have to emit *something*. Also allow lints to whitelist themselves
664+
// on a case-by-case basis for emission in a foreign macro.
665+
if future_incompatible.is_none() && !lint.report_in_external_macro {
666+
err.cancel();
667+
// Don't continue further, since we don't want to have
668+
// `diag_span_note_once` called for a diagnostic that isn't emitted.
669+
return err;
670+
}
671+
}
672+
649673
let name = lint.name_lower();
650674
match src {
651675
LintSource::Default => {
@@ -695,10 +719,6 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
695719

696720
err.code(DiagnosticId::Lint(name));
697721

698-
// Check for future incompatibility lints and issue a stronger warning.
699-
let lints = sess.lint_store.borrow();
700-
let lint_id = LintId::of(lint);
701-
let future_incompatible = lints.future_incompatible(lint_id);
702722
if let Some(future_incompatible) = future_incompatible {
703723
const STANDARD_MESSAGE: &str =
704724
"this was previously accepted by the compiler but is being phased out; \
@@ -723,22 +743,6 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
723743
err.note(&citation);
724744
}
725745

726-
// If this code originates in a foreign macro, aka something that this crate
727-
// did not itself author, then it's likely that there's nothing this crate
728-
// can do about it. We probably want to skip the lint entirely.
729-
if err.span.primary_spans().iter().any(|s| in_external_macro(sess, *s)) {
730-
// Any suggestions made here are likely to be incorrect, so anything we
731-
// emit shouldn't be automatically fixed by rustfix.
732-
err.allow_suggestions(false);
733-
734-
// If this is a future incompatible lint it'll become a hard error, so
735-
// we have to emit *something*. Also allow lints to whitelist themselves
736-
// on a case-by-case basis for emission in a foreign macro.
737-
if future_incompatible.is_none() && !lint.report_in_external_macro {
738-
err.cancel()
739-
}
740-
}
741-
742746
return err
743747
}
744748

@@ -868,7 +872,7 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
868872
let expn_data = span.ctxt().outer_expn_data();
869873
match expn_data.kind {
870874
ExpnKind::Root | ExpnKind::Desugaring(DesugaringKind::ForLoop) => false,
871-
ExpnKind::Desugaring(_) => true, // well, it's "external"
875+
ExpnKind::AstPass(_) | ExpnKind::Desugaring(_) => true, // well, it's "external"
872876
ExpnKind::Macro(MacroKind::Bang, _) => {
873877
if expn_data.def_site.is_dummy() {
874878
// dummy span for the def_site means it's an external macro

src/librustc/ty/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ impl<'tcx> ty::TyS<'tcx> {
200200
ty::Array(_, n) => {
201201
let n = tcx.lift_to_global(&n).unwrap();
202202
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
203-
Some(n) => format!("array of {} elements", n).into(),
203+
Some(n) => {
204+
format!("array of {} element{}", n, if n != 1 { "s" } else { "" }).into()
205+
}
204206
None => "array".into(),
205207
}
206208
}

src/librustc_ast_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use InteriorKind::*;
99

1010
use rustc::hir::HirId;
1111
use rustc::hir::Node;
12-
use rustc::cfg;
1312
use rustc::middle::borrowck::{BorrowCheckResult, SignalledError};
1413
use rustc::hir::def_id::{DefId, LocalDefId};
1514
use rustc::middle::mem_categorization as mc;
@@ -28,6 +27,7 @@ use log::debug;
2827

2928
use rustc::hir;
3029

30+
use crate::cfg;
3131
use crate::dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
3232

3333
pub mod check_loans;

src/librustc_ast_borrowck/borrowck/move_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use crate::dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
55

66
use crate::borrowck::*;
7-
use rustc::cfg;
7+
use crate::cfg;
88
use rustc::ty::{self, TyCtxt};
99
use rustc::util::nodemap::FxHashMap;
1010

src/librustc/cfg/construct.rs renamed to src/librustc_ast_borrowck/cfg/construct.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::cfg::*;
2-
use crate::middle::region;
32
use rustc_data_structures::graph::implementation as graph;
4-
use crate::ty::{self, TyCtxt};
3+
use rustc::middle::region;
4+
use rustc::ty::{self, TyCtxt};
55

6-
use crate::hir::{self, PatKind};
7-
use crate::hir::def_id::DefId;
8-
use crate::hir::ptr::P;
6+
use rustc::hir::{self, PatKind};
7+
use rustc::hir::def_id::DefId;
8+
use rustc::hir::ptr::P;
99

1010
struct CFGBuilder<'a, 'tcx> {
1111
tcx: TyCtxt<'tcx>,
@@ -30,7 +30,7 @@ struct LoopScope {
3030
break_index: CFGIndex, // where to go on a `break`
3131
}
3232

33-
pub fn construct(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
33+
pub(super) fn construct(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
3434
let mut graph = graph::Graph::new();
3535
let entry = graph.add_node(CFGNodeData::Entry);
3636

src/librustc/cfg/graphviz.rs renamed to src/librustc_ast_borrowck/cfg/graphviz.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
/// This module provides linkage between rustc::middle::graph and
22
/// libgraphviz traits.
33
4-
// For clarity, rename the graphviz crate locally to dot.
5-
use graphviz as dot;
6-
74
use crate::cfg;
8-
use crate::hir;
9-
use crate::ty::TyCtxt;
5+
use rustc::hir;
6+
use rustc::ty::TyCtxt;
107

11-
pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
12-
pub type Edge<'a> = &'a cfg::CFGEdge;
8+
pub(crate) type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
9+
pub(crate) type Edge<'a> = &'a cfg::CFGEdge;
1310

1411
pub struct LabelledCFG<'a, 'tcx> {
1512
pub tcx: TyCtxt<'tcx>,

0 commit comments

Comments
 (0)