Auto merge of #56977 - pietroalbini:rollup, r=pietroalbini

Rollup of 15 pull requests

Successful merges:

 - #56363 (Defactored Bytes::read)
 - #56663 (Remove lifetime from Resolver)
 - #56689 (add a lint group for lints emitted by rustdoc)
 - #56772 (fix issue 54153 by not testing issue-18804 on Windows nor OS X.)
 - #56820 (format-related tweaks)
 - #56881 (Implement Eq, PartialEq and Hash for atomic::Ordering)
 - #56907 (Fix grammar in compiler error for array iterators)
 - #56908 (rustc: Don't ICE on usage of two new target features)
 - #56910 (Do not point at delim spans for complete correct blocks)
 - #56913 (Enable stack probes for UEFI images)
 - #56918 (Profiler: simplify total_duration, improve readability)
 - #56931 (Update release notes for Rust 1.31.1)
 - #56947 (Add targets thumbv7neon-linux-androideabi and thumbv7neon-unknown-linux-gnueabihf)
 - #56948 (Update LLVM submodule)
 - #56959 (Fix mobile menu rendering collision with tooltip.)

Failed merges:

 - #56914 (Ignore ui/target-feature-gate on sparc, sparc64, powerpc, powerpc64 and powerpc64le)

r? @ghost
This commit is contained in:
bors 2018-12-19 12:49:32 +00:00
commit 6f839fbb0d
53 changed files with 474 additions and 258 deletions

View File

@ -1,3 +1,14 @@
Version 1.31.1 (2018-12-20)
===========================
- [Fix Rust failing to build on `powerpc-unknown-netbsd`][56562]
- [Fix broken go-to-definition in RLS][rls/1171]
- [Fix infinite loop on hover in RLS][rls/1170]
[56562]: https://github.com/rust-lang/rust/pull/56562
[rls/1171]: https://github.com/rust-lang/rls/issues/1171
[rls/1170]: https://github.com/rust-lang/rls/pull/1170
Version 1.31.0 (2018-12-06)
==========================

View File

@ -143,7 +143,10 @@ fn set_compiler(cfg: &mut cc::Build,
// compiler already takes into account the triple in question.
t if t.contains("android") => {
if let Some(ndk) = config.and_then(|c| c.ndk.as_ref()) {
let target = target.replace("armv7", "arm");
let target = target.replace("armv7neon", "arm")
.replace("armv7", "arm")
.replace("thumbv7neon", "arm")
.replace("thumbv7", "arm");
let compiler = format!("{}-{}", target, compiler.clang());
cfg.compiler(ndk.join("bin").join(compiler));
}

View File

@ -107,6 +107,8 @@ v("arm-linux-androideabi-ndk", "target.arm-linux-androideabi.android-ndk",
"arm-linux-androideabi NDK standalone path")
v("armv7-linux-androideabi-ndk", "target.armv7-linux-androideabi.android-ndk",
"armv7-linux-androideabi NDK standalone path")
v("thumbv7neon-linux-androideabi-ndk", "target.thumbv7neon-linux-androideabi.android-ndk",
"thumbv7neon-linux-androideabi NDK standalone path")
v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
"aarch64-linux-android NDK standalone path")
v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",

View File

@ -16,6 +16,7 @@ RUN . /scripts/android-ndk.sh && \
# env
ENV TARGETS=arm-linux-androideabi
ENV TARGETS=$TARGETS,armv7-linux-androideabi
ENV TARGETS=$TARGETS,thumbv7neon-linux-androideabi
ENV TARGETS=$TARGETS,i686-linux-android
ENV TARGETS=$TARGETS,aarch64-linux-android
ENV TARGETS=$TARGETS,x86_64-linux-android
@ -24,6 +25,7 @@ ENV RUST_CONFIGURE_ARGS \
--enable-extended \
--arm-linux-androideabi-ndk=/android/ndk/arm-14 \
--armv7-linux-androideabi-ndk=/android/ndk/arm-14 \
--thumbv7neon-linux-androideabi-ndk=/android/ndk/arm-14 \
--i686-linux-android-ndk=/android/ndk/x86-14 \
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \

View File

@ -87,7 +87,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
on(
_Self="[]",
label="borrow the array with `&` or call `.iter()` on it to iterate over it",
note="arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`"
note="arrays are not iterators, but slices like the following are: `&[1, 2, 3]`"
),
on(
_Self="{integral}",

View File

@ -188,7 +188,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
/// [Ordering::Relaxed]: #variant.Relaxed
/// [Ordering::SeqCst]: #variant.SeqCst
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub enum Ordering {
/// No ordering constraints, only atomic operations.

View File

@ -315,19 +315,19 @@ declare_lint! {
declare_lint! {
pub INTRA_DOC_LINK_RESOLUTION_FAILURE,
Warn,
"warn about documentation intra links resolution failure"
"failures in resolving intra-doc link targets"
}
declare_lint! {
pub MISSING_DOC_CODE_EXAMPLES,
Allow,
"warn about missing code example in an item's documentation"
"detects publicly-exported items without code samples in their documentation"
}
declare_lint! {
pub PRIVATE_DOC_TESTS,
Allow,
"warn about doc test in private item"
"detects code samples in docs of private items not documented by rustdoc"
}
declare_lint! {

View File

@ -730,9 +730,9 @@ pub struct ExpansionResult {
pub hir_forest: hir_map::Forest,
}
pub struct InnerExpansionResult<'a, 'b: 'a> {
pub struct InnerExpansionResult<'a> {
pub expanded_crate: ast::Crate,
pub resolver: Resolver<'a, 'b>,
pub resolver: Resolver<'a>,
pub hir_forest: hir_map::Forest,
}
@ -811,7 +811,7 @@ where
/// Same as phase_2_configure_and_expand, but doesn't let you keep the resolver
/// around
pub fn phase_2_configure_and_expand_inner<'a, 'b: 'a, F>(
pub fn phase_2_configure_and_expand_inner<'a, F>(
sess: &'a Session,
cstore: &'a CStore,
mut krate: ast::Crate,
@ -820,9 +820,9 @@ pub fn phase_2_configure_and_expand_inner<'a, 'b: 'a, F>(
addl_plugins: Option<Vec<String>>,
make_glob_map: MakeGlobMap,
resolver_arenas: &'a ResolverArenas<'a>,
crate_loader: &'a mut CrateLoader<'b>,
crate_loader: &'a mut CrateLoader<'a>,
after_expand: F,
) -> Result<InnerExpansionResult<'a, 'b>, CompileIncomplete>
) -> Result<InnerExpansionResult<'a>, CompileIncomplete>
where
F: FnOnce(&ast::Crate) -> CompileResult,
{

View File

@ -64,9 +64,7 @@ struct StackFrame {
}
fn total_duration(traces: &[trace::Rec]) -> Duration {
let mut sum : Duration = Duration::new(0, 0);
for t in traces.iter() { sum += t.dur_total; }
return sum
Duration::new(0, 0) + traces.iter().map(|t| t.dur_total).sum()
}
// profiling thread; retains state (in local variables) and dump traces, upon request.
@ -93,40 +91,38 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
ProfileQueriesMsg::Dump(params) => {
assert!(stack.is_empty());
assert!(frame.parse_st == ParseState::Clear);
{
// write log of all messages
if params.dump_profq_msg_log {
let mut log_file =
File::create(format!("{}.log.txt", params.path)).unwrap();
for m in profq_msgs.iter() {
writeln!(&mut log_file, "{:?}", m).unwrap()
};
}
// write HTML file, and counts file
let html_path = format!("{}.html", params.path);
let mut html_file = File::create(&html_path).unwrap();
let counts_path = format!("{}.counts.txt", params.path);
let mut counts_file = File::create(&counts_path).unwrap();
writeln!(html_file,
"<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">",
"profile_queries.css").unwrap();
writeln!(html_file, "<style>").unwrap();
trace::write_style(&mut html_file);
writeln!(html_file, "</style>\n</head>\n<body>").unwrap();
trace::write_traces(&mut html_file, &mut counts_file, &frame.traces);
writeln!(html_file, "</body>\n</html>").unwrap();
let ack_path = format!("{}.ack", params.path);
let ack_file = File::create(&ack_path).unwrap();
drop(ack_file);
// Tell main thread that we are done, e.g., so it can exit
params.ack.send(()).unwrap();
// write log of all messages
if params.dump_profq_msg_log {
let mut log_file =
File::create(format!("{}.log.txt", params.path)).unwrap();
for m in profq_msgs.iter() {
writeln!(&mut log_file, "{:?}", m).unwrap()
};
}
continue
// write HTML file, and counts file
let html_path = format!("{}.html", params.path);
let mut html_file = File::create(&html_path).unwrap();
let counts_path = format!("{}.counts.txt", params.path);
let mut counts_file = File::create(&counts_path).unwrap();
writeln!(html_file,
"<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">",
"profile_queries.css").unwrap();
writeln!(html_file, "<style>").unwrap();
trace::write_style(&mut html_file);
writeln!(html_file, "</style>\n</head>\n<body>").unwrap();
trace::write_traces(&mut html_file, &mut counts_file, &frame.traces);
writeln!(html_file, "</body>\n</html>").unwrap();
let ack_path = format!("{}.ack", params.path);
let ack_file = File::create(&ack_path).unwrap();
drop(ack_file);
// Tell main thread that we are done, e.g., so it can exit
params.ack.send(()).unwrap();
}
// Actual query message:
msg => {
@ -134,9 +130,9 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
profq_msgs.push(msg.clone());
// Respond to the message, knowing that we've already handled Halt and Dump, above.
match (frame.parse_st.clone(), msg) {
(_,ProfileQueriesMsg::Halt) => unreachable!(),
(_,ProfileQueriesMsg::Dump(_)) => unreachable!(),
(_, ProfileQueriesMsg::Halt) | (_, ProfileQueriesMsg::Dump(_)) => {
unreachable!();
},
// Parse State: Clear
(ParseState::Clear,
ProfileQueriesMsg::QueryBegin(span, querymsg)) => {
@ -163,8 +159,8 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
ParseState::HaveQuery(q, start) => {
let duration = start.elapsed();
frame = StackFrame{
parse_st:ParseState::Clear,
traces:old_frame.traces
parse_st: ParseState::Clear,
traces: old_frame.traces
};
let dur_extent = total_duration(&provider_extent);
let trace = Rec {
@ -181,18 +177,16 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
}
}
},
(ParseState::Clear,
ProfileQueriesMsg::TimeBegin(msg)) => {
let start = Instant::now();
frame.parse_st = ParseState::HaveTimeBegin(msg, start);
stack.push(frame);
frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]};
frame = StackFrame{parse_st: ParseState::Clear, traces: vec![]};
},
(_, ProfileQueriesMsg::TimeBegin(_)) => {
panic!("parse error; did not expect time begin here");
},
(_, ProfileQueriesMsg::TimeBegin(_)) =>
panic!("parse error; did not expect time begin here"),
(ParseState::Clear,
ProfileQueriesMsg::TimeEnd) => {
let provider_extent = frame.traces;
@ -204,8 +198,8 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
ParseState::HaveTimeBegin(msg, start) => {
let duration = start.elapsed();
frame = StackFrame{
parse_st:ParseState::Clear,
traces:old_frame.traces
parse_st: ParseState::Clear,
traces: old_frame.traces
};
let dur_extent = total_duration(&provider_extent);
let trace = Rec {
@ -222,18 +216,19 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
}
}
},
(_, ProfileQueriesMsg::TimeEnd) => { panic!("parse error") }
(_, ProfileQueriesMsg::TimeEnd) => {
panic!("parse error")
},
(ParseState::Clear,
ProfileQueriesMsg::TaskBegin(key)) => {
let start = Instant::now();
frame.parse_st = ParseState::HaveTaskBegin(key, start);
stack.push(frame);
frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]};
frame = StackFrame{ parse_st: ParseState::Clear, traces: vec![] };
},
(_, ProfileQueriesMsg::TaskBegin(_)) => {
panic!("parse error; did not expect time begin here");
},
(_, ProfileQueriesMsg::TaskBegin(_)) =>
panic!("parse error; did not expect time begin here"),
(ParseState::Clear,
ProfileQueriesMsg::TaskEnd) => {
let provider_extent = frame.traces;
@ -245,8 +240,8 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
ParseState::HaveTaskBegin(key, start) => {
let duration = start.elapsed();
frame = StackFrame{
parse_st:ParseState::Clear,
traces:old_frame.traces
parse_st: ParseState::Clear,
traces: old_frame.traces
};
let dur_extent = total_duration(&provider_extent);
let trace = Rec {
@ -263,8 +258,9 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
}
}
},
(_, ProfileQueriesMsg::TaskEnd) => { panic!("parse error") }
(_, ProfileQueriesMsg::TaskEnd) => {
panic!("parse error")
},
// Parse State: HaveQuery
(ParseState::HaveQuery(q,start),
ProfileQueriesMsg::CacheHit) => {
@ -279,26 +275,25 @@ fn profile_queries_thread(r: Receiver<ProfileQueriesMsg>) {
frame.traces.push( trace );
frame.parse_st = ParseState::Clear;
},
(ParseState::HaveQuery(_,_),
(ParseState::HaveQuery(_, _),
ProfileQueriesMsg::ProviderBegin) => {
stack.push(frame);
frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]};
frame = StackFrame{ parse_st: ParseState::Clear, traces: vec![] };
},
// Parse errors:
(ParseState::HaveQuery(q,_),
(ParseState::HaveQuery(q, _),
ProfileQueriesMsg::ProviderEnd) => {
panic!("parse error: unexpected ProviderEnd; \
expected something else to follow BeginQuery for {:?}", q)
},
(ParseState::HaveQuery(q1,_),
ProfileQueriesMsg::QueryBegin(span2,querymsg2)) => {
(ParseState::HaveQuery(q1, _),
ProfileQueriesMsg::QueryBegin(span2, querymsg2)) => {
panic!("parse error: unexpected QueryBegin; \
earlier query is unfinished: {:?} and now {:?}",
q1, Query{span:span2, msg:querymsg2})
q1, Query{span:span2, msg: querymsg2})
},
(ParseState::HaveTimeBegin(_, _), _) => {
unreachable!()
},

View File

@ -53,6 +53,9 @@ use rustc::lint::builtin::{
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
ELIDED_LIFETIMES_IN_PATHS,
EXPLICIT_OUTLIVES_REQUIREMENTS,
INTRA_DOC_LINK_RESOLUTION_FAILURE,
MISSING_DOC_CODE_EXAMPLES,
PRIVATE_DOC_TESTS,
parser::QUESTION_MARK_MACRO_SEP
};
use rustc::session;
@ -204,6 +207,12 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
// MACRO_USE_EXTERN_CRATE,
);
add_lint_group!(sess,
"rustdoc",
INTRA_DOC_LINK_RESOLUTION_FAILURE,
MISSING_DOC_CODE_EXAMPLES,
PRIVATE_DOC_TESTS);
// Guidelines for creating a future incompatibility lint:
//
// - Create a lint defaulting to warn as normal, with ideally the same error

View File

@ -83,7 +83,7 @@ impl<'a> ToNameBinding<'a> for (Def, ty::Visibility, Span, Mark, IsMacroExport)
}
}
impl<'a, 'cl> Resolver<'a, 'cl> {
impl<'a> Resolver<'a> {
/// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
/// otherwise, reports an error.
pub fn define<T>(&mut self, parent: Module<'a>, ident: Ident, ns: Namespace, def: T)
@ -888,13 +888,13 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
}
}
pub struct BuildReducedGraphVisitor<'a, 'b: 'a, 'c: 'b> {
pub resolver: &'a mut Resolver<'b, 'c>,
pub struct BuildReducedGraphVisitor<'a, 'b: 'a> {
pub resolver: &'a mut Resolver<'b>,
pub current_legacy_scope: LegacyScope<'b>,
pub expansion: Mark,
}
impl<'a, 'b, 'cl> BuildReducedGraphVisitor<'a, 'b, 'cl> {
impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
fn visit_invoc(&mut self, id: ast::NodeId) -> &'b InvocationData<'b> {
let mark = id.placeholder_to_mark();
self.resolver.current_module.unresolved_invocations.borrow_mut().insert(mark);
@ -917,7 +917,7 @@ macro_rules! method {
}
}
impl<'a, 'b, 'cl> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b, 'cl> {
impl<'a, 'b> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b> {
method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item);
method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr);
method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat);

View File

@ -31,8 +31,8 @@ use syntax::visit::{self, Visitor};
use syntax_pos::{Span, MultiSpan, DUMMY_SP};
struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> {
resolver: &'a mut Resolver<'b, 'd>,
struct UnusedImportCheckVisitor<'a, 'b: 'a> {
resolver: &'a mut Resolver<'b>,
/// All the (so far) unused imports, grouped path list
unused_imports: NodeMap<NodeMap<Span>>,
base_id: ast::NodeId,
@ -40,21 +40,21 @@ struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> {
}
// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
impl<'a, 'b, 'd> Deref for UnusedImportCheckVisitor<'a, 'b, 'd> {
type Target = Resolver<'b, 'd>;
impl<'a, 'b> Deref for UnusedImportCheckVisitor<'a, 'b> {
type Target = Resolver<'b>;
fn deref<'c>(&'c self) -> &'c Resolver<'b, 'd> {
fn deref<'c>(&'c self) -> &'c Resolver<'b> {
&*self.resolver
}
}
impl<'a, 'b, 'd> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'd> {
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'd> {
impl<'a, 'b> DerefMut for UnusedImportCheckVisitor<'a, 'b> {
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b> {
&mut *self.resolver
}
}
impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> {
impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> {
// We have information about whether `use` (import) directives are actually
// used now. If an import is not used at all, we signal a lint error.
fn check_import(&mut self, item_id: ast::NodeId, id: ast::NodeId, span: Span) {
@ -77,7 +77,7 @@ impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> {
}
}
impl<'a, 'b, 'cl> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'cl> {
impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> {
fn visit_item(&mut self, item: &'a ast::Item) {
self.item_span = item.span;

View File

@ -17,7 +17,7 @@ use syntax_pos::Span;
use resolve_imports::ImportResolver;
use std::cmp::Reverse;
impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
impl<'a, 'b:'a> ImportResolver<'a, 'b> {
/// Add suggestions for a path that cannot be resolved.
pub(crate) fn make_path_suggestion(
&mut self,

View File

@ -742,7 +742,7 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder {
}
/// This thing walks the whole crate in DFS manner, visiting each item, resolving names as it goes.
impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> {
impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
fn visit_item(&mut self, item: &'tcx Item) {
self.resolve_item(item);
}
@ -1476,7 +1476,7 @@ pub struct ExternPreludeEntry<'a> {
/// The main resolver class.
///
/// This is the visitor that walks the whole crate.
pub struct Resolver<'a, 'b: 'a> {
pub struct Resolver<'a> {
session: &'a Session,
cstore: &'a CStore,
@ -1580,7 +1580,7 @@ pub struct Resolver<'a, 'b: 'a> {
arenas: &'a ResolverArenas<'a>,
dummy_binding: &'a NameBinding<'a>,
crate_loader: &'a mut CrateLoader<'b>,
crate_loader: &'a mut CrateLoader<'a>,
macro_names: FxHashSet<Ident>,
builtin_macros: FxHashMap<Name, &'a NameBinding<'a>>,
macro_use_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
@ -1654,7 +1654,7 @@ impl<'a> ResolverArenas<'a> {
}
}
impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> {
impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> {
fn parent(self, id: DefId) -> Option<DefId> {
match id.krate {
LOCAL_CRATE => self.definitions.def_key(id.index).parent,
@ -1665,7 +1665,7 @@ impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> {
/// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that
/// the resolver is no longer needed as all the relevant information is inline.
impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
impl<'a> hir::lowering::Resolver for Resolver<'a> {
fn resolve_hir_path(
&mut self,
path: &ast::Path,
@ -1711,7 +1711,7 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
}
}
impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
impl<'a> Resolver<'a> {
/// Rustdoc uses this to resolve things in a recoverable way. ResolutionError<'a>
/// isn't something that can be returned because it can't be made to live that long,
/// and also it's a private type. Fortunately rustdoc doesn't need to know the error,
@ -1800,15 +1800,15 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
}
}
impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
impl<'a> Resolver<'a> {
pub fn new(session: &'a Session,
cstore: &'a CStore,
krate: &Crate,
crate_name: &str,
make_glob_map: MakeGlobMap,
crate_loader: &'a mut CrateLoader<'crateloader>,
crate_loader: &'a mut CrateLoader<'a>,
arenas: &'a ResolverArenas<'a>)
-> Resolver<'a, 'crateloader> {
-> Resolver<'a> {
let root_def_id = DefId::local(CRATE_DEF_INDEX);
let root_module_kind = ModuleKind::Def(Def::Mod(root_def_id), keywords::Invalid.name());
let graph_root = arenas.alloc_module(ModuleData {

View File

@ -121,7 +121,7 @@ fn sub_namespace_match(candidate: Option<MacroKind>, requirement: Option<MacroKi
candidate.is_none() || requirement.is_none() || candidate == requirement
}
impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
impl<'a> base::Resolver for Resolver<'a> {
fn next_node_id(&mut self) -> ast::NodeId {
self.session.next_node_id()
}
@ -139,11 +139,11 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
}
fn eliminate_crate_var(&mut self, item: P<ast::Item>) -> P<ast::Item> {
struct EliminateCrateVar<'b, 'a: 'b, 'crateloader: 'a>(
&'b mut Resolver<'a, 'crateloader>, Span
struct EliminateCrateVar<'b, 'a: 'b>(
&'b mut Resolver<'a>, Span
);
impl<'a, 'b, 'crateloader> Folder for EliminateCrateVar<'a, 'b, 'crateloader> {
impl<'a, 'b> Folder for EliminateCrateVar<'a, 'b> {
fn fold_path(&mut self, path: ast::Path) -> ast::Path {
match self.fold_qpath(None, path) {
(None, path) => path,
@ -290,7 +290,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
}
}
impl<'a, 'cl> Resolver<'a, 'cl> {
impl<'a> Resolver<'a> {
pub fn dummy_parent_scope(&self) -> ParentScope<'a> {
self.invoc_parent_scope(Mark::root(), Vec::new())
}

View File

@ -134,7 +134,7 @@ impl<'a> NameResolution<'a> {
}
}
impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
impl<'a> Resolver<'a> {
fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
-> &'a RefCell<NameResolution<'a>> {
*module.resolutions.borrow_mut().entry((ident.modern(), ns))
@ -541,7 +541,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
// If the resolution becomes a success, define it in the module's glob importers.
fn update_resolution<T, F>(&mut self, module: Module<'a>, ident: Ident, ns: Namespace, f: F)
-> T
where F: FnOnce(&mut Resolver<'a, 'crateloader>, &mut NameResolution<'a>) -> T
where F: FnOnce(&mut Resolver<'a>, &mut NameResolution<'a>) -> T
{
// Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
// during which the resolution might end up getting re-defined via a glob cycle.
@ -592,30 +592,30 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
}
}
pub struct ImportResolver<'a, 'b: 'a, 'c: 'a + 'b> {
pub resolver: &'a mut Resolver<'b, 'c>,
pub struct ImportResolver<'a, 'b: 'a> {
pub resolver: &'a mut Resolver<'b>,
}
impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::Deref for ImportResolver<'a, 'b, 'c> {
type Target = Resolver<'b, 'c>;
fn deref(&self) -> &Resolver<'b, 'c> {
impl<'a, 'b: 'a> ::std::ops::Deref for ImportResolver<'a, 'b> {
type Target = Resolver<'b>;
fn deref(&self) -> &Resolver<'b> {
self.resolver
}
}
impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::DerefMut for ImportResolver<'a, 'b, 'c> {
fn deref_mut(&mut self) -> &mut Resolver<'b, 'c> {
impl<'a, 'b: 'a> ::std::ops::DerefMut for ImportResolver<'a, 'b> {
fn deref_mut(&mut self) -> &mut Resolver<'b> {
self.resolver
}
}
impl<'a, 'b: 'a, 'c: 'a + 'b> ty::DefIdTree for &'a ImportResolver<'a, 'b, 'c> {
impl<'a, 'b: 'a> ty::DefIdTree for &'a ImportResolver<'a, 'b> {
fn parent(self, id: DefId) -> Option<DefId> {
self.resolver.parent(id)
}
}
impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
impl<'a, 'b:'a> ImportResolver<'a, 'b> {
// Import resolution
//
// This is a fixed-point algorithm. We resolve imports until our efforts

View File

@ -10,6 +10,11 @@
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// This target if is for the baseline of the Android v7a ABI
// in thumb mode. It's named armv7-* instead of thumbv7-*
// for historical reasons. See the thumbv7neon variant for
// enabling NEON.
// See https://developer.android.com/ndk/guides/abis.html#v7a
// for target ABI requirements.

View File

@ -10,6 +10,9 @@
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// This target is for glibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both.
pub fn target() -> TargetResult {
let base = super::linux_base::opts();
Ok(Target {

View File

@ -10,6 +10,8 @@
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
pub fn target() -> TargetResult {
let base = super::linux_musl_base::opts();
Ok(Target {

View File

@ -314,6 +314,7 @@ supported_targets! {
("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi),
("armv5te-unknown-linux-musleabi", armv5te_unknown_linux_musleabi),
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
("thumbv7neon-unknown-linux-gnueabihf", thumbv7neon_unknown_linux_gnueabihf),
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
@ -331,6 +332,7 @@ supported_targets! {
("x86_64-linux-android", x86_64_linux_android),
("arm-linux-androideabi", arm_linux_androideabi),
("armv7-linux-androideabi", armv7_linux_androideabi),
("thumbv7neon-linux-androideabi", thumbv7neon_linux_androideabi),
("aarch64-linux-android", aarch64_linux_android),
("aarch64-unknown-freebsd", aarch64_unknown_freebsd),

View File

@ -0,0 +1,44 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// This target if is for the Android v7a ABI in thumb mode with
// NEON unconditionally enabled and, therefore, with 32 FPU registers
// enabled as well. See section A2.6.2 on page A2-56 in
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
// See https://developer.android.com/ndk/guides/abis.html#v7a
// for target ABI requirements.
pub fn target() -> TargetResult {
let mut base = super::android_base::opts();
base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args
.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string());
Ok(Target {
llvm_target: "armv7-none-linux-android".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "android".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
},
})
}

View File

@ -0,0 +1,42 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// This target is for glibc Linux on ARMv7 with thumb mode enabled
// (for consistency with Android and Debian-based distributions)
// and with NEON unconditionally enabled and, therefore, with 32 FPU
// registers enabled as well. See section A2.6.2 on page A2-56 in
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
pub fn target() -> TargetResult {
let base = super::linux_base::opts();
Ok(Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
}
})
}

View File

@ -62,6 +62,7 @@ pub fn opts() -> TargetOptions {
exe_suffix: ".efi".to_string(),
allows_weak_linkage: false,
panic_strategy: PanicStrategy::Abort,
stack_probes: true,
singlethread: true,
emit_debug_gdb_scripts: false,

View File

@ -2207,6 +2207,8 @@ fn from_target_feature(
Some("sse4a_target_feature") => rust_features.sse4a_target_feature,
Some("tbm_target_feature") => rust_features.tbm_target_feature,
Some("wasm_target_feature") => rust_features.wasm_target_feature,
Some("cmpxchg16b_target_feature") => rust_features.cmpxchg16b_target_feature,
Some("adx_target_feature") => rust_features.adx_target_feature,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};

View File

@ -17,13 +17,13 @@ use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
use super::*;
pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> {
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
pub f: auto::AutoTraitFinder<'a, 'tcx>,
}
impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self {
let f = auto::AutoTraitFinder::new(&cx.tcx);
AutoTraitFinder { cx, f }

View File

@ -21,12 +21,12 @@ use super::*;
use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> {
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
}
impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self {
BlanketImplFinder { cx }
}

View File

@ -149,7 +149,7 @@ pub struct Crate {
pub masked_crates: FxHashSet<CrateNum>,
}
impl<'a, 'tcx, 'rcx, 'cstore> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> {
fn clean(&self, cx: &DocContext) -> Crate {
use ::visit_lib::LibEmbargoVisitor;

View File

@ -55,9 +55,9 @@ pub use rustc::session::search_paths::SearchPath;
pub type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub resolver: &'a RefCell<resolve::Resolver<'rcx, 'cstore>>,
pub resolver: &'a RefCell<resolve::Resolver<'rcx>>,
/// The stack of module NodeIds up till this point
pub crate_name: Option<String>,
pub cstore: Rc<CStore>,
@ -88,7 +88,7 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
pub all_traits: Vec<DefId>,
}
impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> {
pub fn sess(&self) -> &session::Session {
&self.tcx.sess
}

View File

@ -997,7 +997,7 @@ span.since {
margin-left: -15px;
padding: 0 15px;
position: static;
z-index: 1;
z-index: 11;
}
.sidebar > .location {

View File

@ -53,14 +53,14 @@ enum PathKind {
Type,
}
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a> {
cx: &'a DocContext<'a, 'tcx, 'rcx>,
mod_ids: Vec<NodeId>,
is_nightly_build: bool,
}
impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
LinkCollector {
cx,
mod_ids: Vec::new(),
@ -213,7 +213,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
}
}
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
fn fold_item(&mut self, mut item: Item) -> Option<Item> {
let item_node_id = if item.is_mod() {
if let Some(id) = self.cx.tcx.hir().as_local_node_id(item.def_id) {

View File

@ -147,13 +147,13 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext) -> Crate {
krate
}
struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a> {
cx: &'a DocContext<'a, 'tcx, 'rcx>,
impls: Vec<Item>,
}
impl<'a, 'tcx, 'rcx, 'cstore> SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
SyntheticImplCollector {
cx,
impls: Vec::new(),
@ -161,7 +161,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
}
}
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx> {
fn fold_item(&mut self, i: Item) -> Option<Item> {
if i.is_struct() || i.is_enum() || i.is_union() {
if let (Some(node_id), Some(name)) =

View File

@ -361,8 +361,8 @@ impl fold::DocFolder for ImportStripper {
}
}
pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>(
cx: &'a DocContext<'a, 'tcx, 'rcx>,
dox: &str,
item: &Item,
check_missing_code: bool,

View File

@ -19,12 +19,12 @@ pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass =
Pass::early("check-private-items-doc-tests", check_private_items_doc_tests,
"check private items doc tests");
struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> {
cx: &'a DocContext<'a, 'tcx, 'rcx>,
}
impl<'a, 'tcx, 'rcx, 'cstore> PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
impl<'a, 'tcx, 'rcx> PrivateItemDocTestLinter<'a, 'tcx, 'rcx> {
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
PrivateItemDocTestLinter {
cx,
}
@ -37,7 +37,7 @@ pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext) -> Crate {
coll.fold_crate(krate)
}
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx> {
fn fold_item(&mut self, item: Item) -> Option<Item> {
let cx = self.cx;
let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new);

View File

@ -36,10 +36,10 @@ use doctree::*;
// Also, is there some reason that this doesn't use the 'visit'
// framework from syntax?.
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
pub module: Module,
pub attrs: hir::HirVec<ast::Attribute>,
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
view_item_stack: FxHashSet<ast::NodeId>,
inlining: bool,
/// Are the current module and all of its parents public?
@ -47,10 +47,10 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
exact_paths: Option<FxHashMap<DefId, Vec<String>>>,
}
impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
pub fn new(
cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>
) -> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
cx: &'a core::DocContext<'a, 'tcx, 'rcx>
) -> RustdocVisitor<'a, 'tcx, 'rcx> {
// If the root is re-exported, terminate all recursion.
let mut stack = FxHashSet::default();
stack.insert(ast::CRATE_NODE_ID);

View File

@ -22,8 +22,8 @@ use clean::{AttributesExt, NestedAttributesExt};
/// Similar to `librustc_privacy::EmbargoVisitor`, but also takes
/// specific rustdoc annotations into account (i.e., `doc(hidden)`)
pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx>,
// Accessibility levels for reachable nodes
access_levels: RefMut<'a, AccessLevels<DefId>>,
// Previous accessibility level, None means unreachable
@ -32,10 +32,10 @@ pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
visited_mods: FxHashSet<DefId>,
}
impl<'a, 'tcx, 'rcx, 'cstore> LibEmbargoVisitor<'a, 'tcx, 'rcx, 'cstore> {
impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
pub fn new(
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx, 'cstore>
) -> LibEmbargoVisitor<'a, 'tcx, 'rcx, 'cstore> {
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx>
) -> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
LibEmbargoVisitor {
cx,
access_levels: RefMut::map(cx.renderinfo.borrow_mut(), |ri| &mut ri.access_levels),

View File

@ -271,6 +271,7 @@
use cmp;
use fmt;
use slice;
use str;
use memchr;
use ptr;
@ -1936,18 +1937,6 @@ impl<T: BufRead> BufRead for Take<T> {
}
}
fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
let mut buf = [0];
loop {
return match reader.read(&mut buf) {
Ok(0) => None,
Ok(..) => Some(Ok(buf[0])),
Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
Err(e) => Some(Err(e)),
};
}
}
/// An iterator over `u8` values of a reader.
///
/// This struct is generally created by calling [`bytes`] on a reader.
@ -1965,7 +1954,15 @@ impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>;
fn next(&mut self) -> Option<Result<u8>> {
read_one_byte(&mut self.inner)
let mut byte = 0;
loop {
return match self.inner.read(slice::from_mut(&mut byte)) {
Ok(0) => None,
Ok(..) => Some(Ok(byte)),
Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
Err(e) => Some(Err(e)),
};
}
}
}

View File

@ -417,6 +417,8 @@ declare_features! (
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
(active, tbm_target_feature, "1.27.0", Some(44839), None),
(active, wasm_target_feature, "1.30.0", Some(44839), None),
(active, adx_target_feature, "1.32.0", Some(44839), None),
(active, cmpxchg16b_target_feature, "1.32.0", Some(44839), None),
// Allows macro invocations on modules expressions and statements and
// procedural macros to expand to non-items.

View File

@ -97,7 +97,15 @@ impl<'a> StringReader<'a> {
// Correct delimiter.
token::CloseDelim(d) if d == delim => {
let (open_brace, open_brace_span) = self.open_braces.pop().unwrap();
self.matching_delim_spans.push((open_brace, open_brace_span, self.span));
if self.open_braces.len() == 0 {
// Clear up these spans to avoid suggesting them as we've found
// properly matched delimiters so far for an entire block.
self.matching_delim_spans.clear();
} else {
self.matching_delim_spans.push(
(open_brace, open_brace_span, self.span),
);
}
// Parse the close delimiter.
self.real_token();
}

View File

@ -3062,6 +3062,7 @@ impl<'a> Parser<'a> {
///
/// This parses an expression accounting for associativity and precedence of the operators in
/// the expression.
#[inline]
fn parse_assoc_expr(&mut self,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>> {
@ -3722,6 +3723,7 @@ impl<'a> Parser<'a> {
}
/// Parse an expression
#[inline]
pub fn parse_expr(&mut self) -> PResult<'a, P<Expr>> {
self.parse_expr_res(Restrictions::empty(), None)
}
@ -3741,6 +3743,7 @@ impl<'a> Parser<'a> {
}
/// Parse an expression, subject to the given restrictions
#[inline]
fn parse_expr_res(&mut self, r: Restrictions,
already_parsed_attrs: Option<ThinVec<Attribute>>)
-> PResult<'a, P<Expr>> {

View File

@ -158,28 +158,15 @@ fn parse_args(ecx: &mut ExtCtxt,
} // accept trailing commas
if named || (p.token.is_ident() && p.look_ahead(1, |t| *t == token::Eq)) {
named = true;
let ident = match p.token {
token::Ident(i, _) => {
p.bump();
i
}
_ if named => {
ecx.span_err(
p.span,
"expected ident, positional arguments cannot follow named arguments",
);
return None;
}
_ => {
ecx.span_err(
p.span,
&format!(
"expected ident for named argument, found `{}`",
p.this_token_to_string()
),
);
return None;
}
let ident = if let token::Ident(i, _) = p.token {
p.bump();
i
} else {
ecx.span_err(
p.span,
"expected ident, positional arguments cannot follow named arguments",
);
return None;
};
let name: &str = &ident.as_str();
@ -286,11 +273,11 @@ impl<'a, 'b> Context<'a, 'b> {
} else {
MultiSpan::from_span(self.fmtsp)
};
let mut refs: Vec<_> = self
let refs_len = self.invalid_refs.len();
let mut refs = self
.invalid_refs
.iter()
.map(|(r, pos)| (r.to_string(), self.arg_spans.get(*pos)))
.collect();
.map(|(r, pos)| (r.to_string(), self.arg_spans.get(*pos)));
if self.names.is_empty() && !numbered_position_args {
e = self.ecx.mut_span_err(
@ -303,28 +290,24 @@ impl<'a, 'b> Context<'a, 'b> {
),
);
} else {
let (arg_list, mut sp) = match refs.len() {
1 => {
let (reg, pos) = refs.pop().unwrap();
(
format!("argument {}", reg),
MultiSpan::from_span(*pos.unwrap_or(&self.fmtsp)),
)
}
_ => {
let pos =
MultiSpan::from_spans(refs.iter().map(|(_, p)| *p.unwrap()).collect());
let mut refs: Vec<String> = refs.iter().map(|(s, _)| s.to_owned()).collect();
let reg = refs.pop().unwrap();
(
format!(
"arguments {head} and {tail}",
tail = reg,
head = refs.join(", ")
),
pos,
)
}
let (arg_list, mut sp) = if refs_len == 1 {
let (reg, pos) = refs.next().unwrap();
(
format!("argument {}", reg),
MultiSpan::from_span(*pos.unwrap_or(&self.fmtsp)),
)
} else {
let (mut refs, spans): (Vec<_>, Vec<_>) = refs.unzip();
let pos = MultiSpan::from_spans(spans.into_iter().map(|s| *s.unwrap()).collect());
let reg = refs.pop().unwrap();
(
format!(
"arguments {head} and {tail}",
head = refs.join(", "),
tail = reg,
),
pos,
)
};
if !self.is_literal {
sp = MultiSpan::from_span(self.fmtsp);
@ -353,33 +336,30 @@ impl<'a, 'b> Context<'a, 'b> {
Placeholder(_) => {
// record every (position, type) combination only once
let ref mut seen_ty = self.arg_unique_types[arg];
let i = match seen_ty.iter().position(|x| *x == ty) {
Some(i) => i,
None => {
let i = seen_ty.len();
seen_ty.push(ty);
i
}
};
let i = seen_ty.iter().position(|x| *x == ty).unwrap_or_else(|| {
let i = seen_ty.len();
seen_ty.push(ty);
i
});
self.arg_types[arg].push(i);
}
Count => {
match self.count_positions.entry(arg) {
Entry::Vacant(e) => {
let i = self.count_positions_count;
e.insert(i);
self.count_args.push(Exact(arg));
self.count_positions_count += 1;
}
Entry::Occupied(_) => {}
if let Entry::Vacant(e) = self.count_positions.entry(arg) {
let i = self.count_positions_count;
e.insert(i);
self.count_args.push(Exact(arg));
self.count_positions_count += 1;
}
}
}
}
Named(name) => {
let idx = match self.names.get(&name) {
Some(e) => *e,
match self.names.get(&name) {
Some(idx) => {
// Treat as positional arg.
self.verify_arg_type(Exact(*idx), ty)
}
None => {
let msg = format!("there is no argument named `{}`", name);
let sp = if self.is_literal {
@ -389,11 +369,8 @@ impl<'a, 'b> Context<'a, 'b> {
};
let mut err = self.ecx.struct_span_err(sp, &msg[..]);
err.emit();
return;
}
};
// Treat as positional arg.
self.verify_arg_type(Exact(idx), ty)
}
}
}
}
@ -436,12 +413,10 @@ impl<'a, 'b> Context<'a, 'b> {
parse::CountIs(i) => count("Is", Some(self.ecx.expr_usize(sp, i))),
parse::CountIsParam(i) => {
// This needs mapping too, as `i` is referring to a macro
// argument.
let i = match self.count_positions.get(&i) {
Some(&i) => i,
None => 0, // error already emitted elsewhere
};
let i = i + self.count_args_index_offset;
// argument. If `i` is not found in `count_positions` then
// the error had already been emitted elsewhere.
let i = self.count_positions.get(&i).cloned().unwrap_or(0)
+ self.count_args_index_offset;
count("Param", Some(self.ecx.expr_usize(sp, i)))
}
parse::CountImplied => count("Implied", None),
@ -526,10 +501,7 @@ impl<'a, 'b> Context<'a, 'b> {
},
};
let fill = match arg.format.fill {
Some(c) => c,
None => ' ',
};
let fill = arg.format.fill.unwrap_or(' ');
if *arg != simple_arg || fill != ' ' {
self.all_pieces_simple = false;
@ -828,8 +800,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
if !parser.errors.is_empty() {
let err = parser.errors.remove(0);
let sp = fmt.span.from_inner_byte_pos(err.start, err.end);
let mut e = ecx.struct_span_err(sp, &format!("invalid format string: {}",
err.description));
let mut e = ecx.struct_span_err(sp, &format!("invalid format string: {}", err.description));
e.span_label(sp, err.label + " in format string");
if let Some(note) = err.note {
e.note(&note);

@ -1 +1 @@
Subproject commit 95185c8c801c765ac1072392d081d265af9fb310
Subproject commit f4728ed8fa2296c5b009bb85550e157e1e57ed0b

View File

@ -18,6 +18,8 @@ ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm)
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
$(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
endif
ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64)
$(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs

View File

@ -14,9 +14,14 @@
// ignore-asmjs no weak symbol support
// ignore-emscripten no weak symbol support
// ignore-windows no extern_weak linkage
// ignore-macos no extern_weak linkage
// aux-build:lib.rs
// rust-lang/rust#56772: nikic says we need this to be proper test.
// compile-flags: -C no-prepopulate-passes -C passes=name-anon-globals
extern crate lib;
fn main() {

View File

@ -0,0 +1,34 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Documenting the kinds of lints emitted by rustdoc.
//!
//! ```
//! println!("sup");
//! ```
#![deny(rustdoc)]
/// what up, let's make an [error]
///
/// ```
/// println!("sup");
/// ```
pub fn link_error() {} //~^^^^^ ERROR cannot be resolved, ignoring it
/// wait, this doesn't have a doctest?
pub fn no_doctest() {} //~^ ERROR Missing code example in this documentation
/// wait, this *does* have a doctest?
///
/// ```
/// println!("sup");
/// ```
fn private_doctest() {} //~^^^^^ ERROR Documentation test in private item

View File

@ -0,0 +1,44 @@
error: Documentation test in private item
--> $DIR/lint-group.rs:29:1
|
LL | / /// wait, this *does* have a doctest?
LL | | ///
LL | | /// ```
LL | | /// println!("sup");
LL | | /// ```
| |_______^
|
note: lint level defined here
--> $DIR/lint-group.rs:17:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: #[deny(private_doc_tests)] implied by #[deny(rustdoc)]
error: `[error]` cannot be resolved, ignoring it...
--> $DIR/lint-group.rs:19:29
|
LL | /// what up, let's make an [error]
| ^^^^^ cannot be resolved, ignoring
|
note: lint level defined here
--> $DIR/lint-group.rs:17:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: #[deny(intra_doc_link_resolution_failure)] implied by #[deny(rustdoc)]
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
error: Missing code example in this documentation
--> $DIR/lint-group.rs:26:1
|
LL | /// wait, this doesn't have a doctest?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-group.rs:17:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: #[deny(missing_doc_code_examples)] implied by #[deny(rustdoc)]

View File

@ -75,7 +75,7 @@ LL | for _ in [0..1, 2..3] {}
| ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]`
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator

View File

@ -5,7 +5,7 @@ LL | for _ in [1, 2] {}
| ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]`
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[{integer}; 2]` is not an iterator
@ -15,7 +15,7 @@ LL | for _ in x {}
| ^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]`
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required by `std::iter::IntoIterator::into_iter`
error[E0277]: `[{float}; 2]` is not an iterator
@ -25,7 +25,7 @@ LL | for _ in [1.0, 2.0] {}
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `std::iter::Iterator` is not implemented for `[{float}; 2]`
= note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required by `std::iter::IntoIterator::into_iter`
error: aborting due to 3 previous errors

View File

@ -0,0 +1,11 @@
struct S {
x: usize,
y: usize,
}
fn main() {
S { x: 4,
y: 5 };
}
fn foo() { //~ ERROR this file contains an un-closed delimiter

View File

@ -0,0 +1,8 @@
error: this file contains an un-closed delimiter
--> $DIR/unmatched-delimiter-at-end-of-file.rs:11:64
|
LL | fn foo() { //~ ERROR this file contains an un-closed delimiter
| - un-closed delimiter ^
error: aborting due to previous error

View File

@ -24,6 +24,9 @@
// gate-test-mips_target_feature
// gate-test-mmx_target_feature
// gate-test-wasm_target_feature
// gate-test-adx_target_feature
// gate-test-cmpxchg16b_target_feature
// min-llvm-version 6.0
#[target_feature(enable = "avx512bw")]
//~^ ERROR: currently unstable

View File

@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
--> $DIR/target-feature-gate.rs:28:18
--> $DIR/target-feature-gate.rs:31:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^

View File

@ -61,7 +61,9 @@ static TARGETS: &'static [&'static str] = &[
"armv5te-unknown-linux-musleabi",
"armv7-apple-ios",
"armv7-linux-androideabi",
"thumbv7neon-linux-androideabi",
"armv7-unknown-linux-gnueabihf",
"thumbv7neon-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"armebv7r-none-eabi",
"armebv7r-none-eabihf",

View File

@ -168,7 +168,10 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
match &*config.target {
"arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
"arm-linux-androideabi"
| "armv7-linux-androideabi"
| "thumbv7neon-linux-androideabi"
| "aarch64-linux-android" => {
if !config.adb_device_status {
panic!("android device not available");
}