Skip to content

Commit

Permalink
Auto merge of #61602 - pietroalbini:beta-rollup, r=pietroalbini
Browse files Browse the repository at this point in the history
[beta] Rollup backports

Rolled up:

* [beta] Permit unwinding through FFI by default #61569

Cherry-picked:

* upgrade rustdoc's `pulldown-cmark` to 0.5.2 #60802
* Fix overflowing literal lint in loops #61098
* Revert edition-guide toolstate override #61110
* Turn turbo 🐟 🍨 into an error #61189
* Bump hashbrown to 0.4.0 #61388
* Fix regression 61475 #61500

r? @ghost
  • Loading branch information
bors committed Jun 7, 2019
2 parents 0ff088c + 60dae64 commit 07a9dae
Show file tree
Hide file tree
Showing 22 changed files with 165 additions and 93 deletions.
31 changes: 10 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1068,7 +1068,7 @@ dependencies = [

[[package]]
name = "hashbrown"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2001,23 +2001,13 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "pulldown-cmark"
version = "0.5.0"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -3062,7 +3052,7 @@ version = "0.0.0"
dependencies = [
"minifier 0.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

Expand Down Expand Up @@ -3302,7 +3292,7 @@ dependencies = [
"core 0.0.0",
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_abort 0.0.0",
"panic_unwind 0.0.0",
Expand Down Expand Up @@ -3824,7 +3814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "unicase"
version = "2.3.0"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -4147,7 +4137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454"
"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
"checksum handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166"
"checksum hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "570178d5e4952010d138b0f1d581271ff3a02406d990f887d1e87e3d6e43b0ac"
"checksum hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9529213c67695ca2d146e6f263b7b72df8fa973368beadf767e8ed80c03f2f36"
"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
"checksum home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "80dff82fb58cfbbc617fb9a9184b010be0529201553cda50ad04372bc2333aff"
Expand Down Expand Up @@ -4241,8 +4231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
"checksum proptest 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24f5844db2f839e97e3021980975f6ebf8691d9b9b2ca67ed3feb38dc3edb52c"
"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
"checksum pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1b74cc784b038a9921fd1a48310cc2e238101aa8ae0b94201e2d85121dd68b5"
"checksum pulldown-cmark 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157737d41407de9c5e0563a991d085117d60ae729af2cc1bf28d6dfbc97bcc1f"
"checksum pulldown-cmark 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "051e60ace841b3bfecd402fe5051c06cb3bec4a6e6fdd060a37aa8eb829a1db3"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
Expand Down Expand Up @@ -4354,7 +4343,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
"checksum ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71a9c5b1fe77426cf144cc30e49e955270f5086e31a6441dfa8b32efc09b9d77"
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
"checksum unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41d17211f887da8e4a70a45b9536f26fc5de166b81e2d5d80de4a17fd22553bd"
"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
Expand Down
4 changes: 1 addition & 3 deletions src/ci/docker/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ status_check() {
check_dispatch $1 beta nomicon src/doc/nomicon
check_dispatch $1 beta reference src/doc/reference
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
# Temporarily disabled until
# https://github.com/rust-lang/rust/issues/60459 is fixed.
# check_dispatch $1 beta edition-guide src/doc/edition-guide
check_dispatch $1 beta edition-guide src/doc/edition-guide
check_dispatch $1 beta rls src/tools/rls
check_dispatch $1 beta rustfmt src/tools/rustfmt
check_dispatch $1 beta clippy-driver src/tools/clippy
Expand Down
31 changes: 16 additions & 15 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::util::nodemap::NodeMap;
use errors::{DiagnosticBuilder, DiagnosticId};
use std::{hash, ptr};
use syntax::ast;
use syntax::source_map::{MultiSpan, ExpnFormat};
use syntax::source_map::{MultiSpan, ExpnFormat, CompilerDesugaringKind};
use syntax::early_buffered_lints::BufferedEarlyLintId;
use syntax::edition::Edition;
use syntax::symbol::{Symbol, sym};
Expand Down Expand Up @@ -881,21 +881,22 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
};

match info.format {
ExpnFormat::MacroAttribute(..) => return true, // definitely a plugin
ExpnFormat::CompilerDesugaring(_) => return true, // well, it's "external"
ExpnFormat::MacroBang(..) => {} // check below
}

let def_site = match info.def_site {
Some(span) => span,
// no span for the def_site means it's an external macro
None => return true,
};
ExpnFormat::MacroAttribute(..) => true, // definitely a plugin
ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::ForLoop) => false,
ExpnFormat::CompilerDesugaring(_) => true, // well, it's "external"
ExpnFormat::MacroBang(..) => {
let def_site = match info.def_site {
Some(span) => span,
// no span for the def_site means it's an external macro
None => return true,
};

match sess.source_map().span_to_snippet(def_site) {
Ok(code) => !code.starts_with("macro_rules"),
// no snippet = external macro or compiler-builtin expansion
Err(_) => true,
match sess.source_map().span_to_snippet(def_site) {
Ok(code) => !code.starts_with("macro_rules"),
// no snippet = external macro or compiler-builtin expansion
Err(_) => true,
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
// This is a special case: some functions have a C abi but are meant to
// unwind anyway. Don't stop them.
match unwind_attr {
None => true,
None => false, // FIXME(#58794)
Some(UnwindAttr::Allowed) => false,
Some(UnwindAttr::Aborts) => true,
}
Expand Down
67 changes: 33 additions & 34 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5195,7 +5195,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
&self,
res: Res,
span: Span,
) -> Result<(DefKind, DefId, Ty<'tcx>), ErrorReported> {
) -> Result<Res, ErrorReported> {
let tcx = self.tcx;
if let Res::SelfCtor(impl_def_id) = res {
let ty = self.impl_self_ty(span, impl_def_id).ty;
Expand All @@ -5205,11 +5205,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
Some(adt_def) if adt_def.has_ctor() => {
let variant = adt_def.non_enum_variant();
let ctor_def_id = variant.ctor_def_id.unwrap();
Ok((
DefKind::Ctor(CtorOf::Struct, variant.ctor_kind),
ctor_def_id,
tcx.type_of(ctor_def_id),
))
Ok(Res::Def(DefKind::Ctor(CtorOf::Struct, variant.ctor_kind), ctor_def_id))
}
_ => {
let mut err = tcx.sess.struct_span_err(span,
Expand All @@ -5236,15 +5232,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
}
} else {
match res {
Res::Def(kind, def_id) => {
// The things we are substituting into the type should not contain
// escaping late-bound regions, and nor should the base type scheme.
let ty = tcx.type_of(def_id);
Ok((kind, def_id, ty))
}
_ => span_bug!(span, "unexpected res in rewrite_self_ctor: {:?}", res),
}
Ok(res)
}
}

Expand All @@ -5267,27 +5255,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

let tcx = self.tcx;

match res {
Res::Local(hid) | Res::Upvar(hid, ..) => {
let ty = self.local_ty(span, hid).decl_ty;
let ty = self.normalize_associated_types_in(span, &ty);
self.write_ty(hir_id, ty);
return (ty, res);
}
_ => {}
}

let (kind, def_id, ty) = match self.rewrite_self_ctor(res, span) {
Ok(result) => result,
let res = match self.rewrite_self_ctor(res, span) {
Ok(res) => res,
Err(ErrorReported) => return (tcx.types.err, res),
};
let path_segs =
AstConv::def_ids_for_value_path_segments(self, segments, self_ty, kind, def_id);
let path_segs = match res {
Res::Local(_) | Res::Upvar(..) => Vec::new(),
Res::Def(kind, def_id) =>
AstConv::def_ids_for_value_path_segments(self, segments, self_ty, kind, def_id),
_ => bug!("instantiate_value_path on {:?}", res),
};

let mut user_self_ty = None;
let mut is_alias_variant_ctor = false;
match kind {
DefKind::Ctor(CtorOf::Variant, _) => {
match res {
Res::Def(DefKind::Ctor(CtorOf::Variant, _), _) => {
if let Some(self_ty) = self_ty {
let adt_def = self_ty.ty_adt_def().unwrap();
user_self_ty = Some(UserSelfTy {
Expand All @@ -5297,8 +5279,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
is_alias_variant_ctor = true;
}
}
DefKind::Method
| DefKind::AssociatedConst => {
Res::Def(DefKind::Method, def_id)
| Res::Def(DefKind::AssociatedConst, def_id) => {
let container = tcx.associated_item(def_id).container;
debug!("instantiate_value_path: def_id={:?} container={:?}", def_id, container);
match container {
Expand Down Expand Up @@ -5338,6 +5320,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
None
}
}));

match res {
Res::Local(hid) | Res::Upvar(hid, ..) => {
let ty = self.local_ty(span, hid).decl_ty;
let ty = self.normalize_associated_types_in(span, &ty);
self.write_ty(hir_id, ty);
return (ty, res);
}
_ => {}
}

if generics_has_err {
// Don't try to infer type parameters when prohibited generic arguments were given.
user_self_ty = None;
Expand Down Expand Up @@ -5375,6 +5368,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
tcx.generics_of(*def_id).has_self
}).unwrap_or(false);

let def_id = res.def_id();

// The things we are substituting into the type should not contain
// escaping late-bound regions, and nor should the base type scheme.
let ty = tcx.type_of(def_id);

let substs = AstConv::create_substs_for_generic_args(
tcx,
def_id,
Expand Down Expand Up @@ -5491,7 +5490,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
ty_substituted);
self.write_substs(hir_id, substs);

(ty_substituted, Res::Def(kind, def_id))
(ty_substituted, res)
}

fn check_rustc_args_require_const(&self,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "rustdoc"
path = "lib.rs"

[dependencies]
pulldown-cmark = { version = "0.4.1", default-features = false }
pulldown-cmark = { version = "0.5.2", default-features = false }
minifier = "0.0.30"
tempfile = "3"
parking_lot = "0.7"
10 changes: 5 additions & 5 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,11 @@ impl<'a, 'b, 'ids, I: Iterator<Item = Event<'a>>> Iterator for HeadingLinks<'a,
if let Some(Event::Start(Tag::Header(level))) = event {
let mut id = String::new();
for event in &mut self.inner {
match event {
match &event {
Event::End(Tag::Header(..)) => break,
Event::Text(ref text) => id.extend(text.chars().filter_map(slugify)),
Event::Text(text) | Event::Code(text) => {
id.extend(text.chars().filter_map(slugify));
}
_ => {},
}
self.buf.push_back(event);
Expand Down Expand Up @@ -402,7 +404,6 @@ fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
| Tag::Item
| Tag::Emphasis
| Tag::Strong
| Tag::Code
| Tag::Link(..)
| Tag::BlockQuote => true,
_ => false,
Expand Down Expand Up @@ -790,9 +791,8 @@ pub fn plain_summary_line_full(md: &str, limit_length: bool) -> String {
let next_event = next_event.unwrap();
let (ret, is_in) = match next_event {
Event::Start(Tag::Paragraph) => (None, 1),
Event::Start(Tag::Code) => (Some("`".to_owned()), 1),
Event::End(Tag::Code) => (Some("`".to_owned()), -1),
Event::Start(Tag::Header(_)) => (None, 1),
Event::Code(code) => (Some(format!("`{}`", code)), 0),
Event::Text(ref s) if self.is_in > 0 => (Some(s.as_ref().to_owned()), 0),
Event::End(Tag::Paragraph) | Event::End(Tag::Header(_)) => (None, -1),
_ => (None, 0),
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libc = { version = "0.2.51", default-features = false, features = ['rustc-dep-of
compiler_builtins = { version = "0.1.14" }
profiler_builtins = { path = "../libprofiler_builtins", optional = true }
unwind = { path = "../libunwind" }
hashbrown = { version = "0.3.0", features = ['rustc-dep-of-std'] }
hashbrown = { version = "0.4.0", features = ['rustc-dep-of-std'] }
rustc-demangle = { version = "0.1.10", features = ['rustc-dep-of-std'] }
backtrace-sys = { version = "0.1.24", features = ["rustc-dep-of-std"], optional = true }

Expand Down
18 changes: 11 additions & 7 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,10 @@ impl<'a> Parser<'a> {
}
_ => {
Err(if self.prev_token_kind == PrevTokenKind::DocComment {
self.span_fatal_err(self.prev_span, Error::UselessDocComment)
} else {
self.expected_ident_found()
})
self.span_fatal_err(self.prev_span, Error::UselessDocComment)
} else {
self.expected_ident_found()
})
}
}
}
Expand Down Expand Up @@ -2039,8 +2039,8 @@ impl<'a> Parser<'a> {
path = self.parse_path(PathStyle::Type)?;
path_span = path_lo.to(self.prev_span);
} else {
path = ast::Path { segments: Vec::new(), span: syntax_pos::DUMMY_SP };
path_span = self.span.to(self.span);
path = ast::Path { segments: Vec::new(), span: path_span };
}

// See doc comment for `unmatched_angle_bracket_count`.
Expand Down Expand Up @@ -3357,7 +3357,11 @@ impl<'a> Parser<'a> {
// want to keep their span info to improve diagnostics in these cases in a later stage.
(true, Some(AssocOp::Multiply)) | // `{ 42 } *foo = bar;` or `{ 42 } * 3`
(true, Some(AssocOp::Subtract)) | // `{ 42 } -5`
(true, Some(AssocOp::Add)) => { // `{ 42 } + 42
(true, Some(AssocOp::LAnd)) | // `{ 42 } &&x` (#61475)
(true, Some(AssocOp::Add)) // `{ 42 } + 42
// If the next token is a keyword, then the tokens above *are* unambiguously incorrect:
// `if x { a } else { b } && if y { c } else { d }`
if !self.look_ahead(1, |t| t.is_reserved_ident()) => {
// These cases are ambiguous and can't be identified in the parser alone
let sp = self.sess.source_map().start_point(self.span);
self.sess.ambiguous_block_expr_parse.borrow_mut().insert(sp, lhs.span);
Expand Down Expand Up @@ -5848,7 +5852,7 @@ impl<'a> Parser<'a> {
let mut where_clause = WhereClause {
id: ast::DUMMY_NODE_ID,
predicates: Vec::new(),
span: syntax_pos::DUMMY_SP,
span: self.prev_span.to(self.prev_span),
};

if !self.eat_keyword(keywords::Where) {
Expand Down
Loading

0 comments on commit 07a9dae

Please sign in to comment.