Skip to content

Commit 1b4c921

Browse files
committed
Auto merge of #51426 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests Successful merges: - #51186 (Remove two redundant .nll.stderr files) - #51283 (Deny #[cfg] and #[cfg_attr] on generic parameters.) - #51368 (Fix the use of closures within #[panic_implementation]) - #51380 (Remove dependency on fmt_macros from typeck) - #51389 (rustdoc: Fix missing stability and src links for inlined external macros) - #51399 (NLL performance boost) - #51407 (Update RLS and Rustfmt) - #51417 (Revert #49719) - #51420 (Tries to address the recent network issues) Failed merges:
2 parents c131bdc + 34cd36e commit 1b4c921

File tree

24 files changed

+533
-174
lines changed

24 files changed

+533
-174
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ before_deploy:
301301
rm -rf obj/build/dist/doc &&
302302
cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
303303
fi
304-
- travis_retry gem update --system
305304
- ls -la deploy/$TRAVIS_COMMIT
306305

307306
deploy:

src/Cargo.lock

Lines changed: 164 additions & 39 deletions
Large diffs are not rendered by default.

src/ci/docker/run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ fi
118118
# goes ahead and sets it for all builders.
119119
args="$args --privileged"
120120

121+
if [ "$CI" != "" ]; then
122+
args="$args --dns 8.8.8.8 --dns 8.8.4.4 --dns 1.1.1.1 --dns 1.0.0.1"
123+
fi
124+
121125
exec docker \
122126
run \
123127
--volume "$root_dir:/checkout:ro" \

src/librustc_mir/borrow_check/nll/type_check/liveness.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
104104
location, live_local
105105
);
106106

107-
self.flow_inits.each_state_bit(|mpi_init| {
108-
debug!(
109-
"add_liveness_constraints: location={:?} initialized={:?}",
110-
location,
111-
&self.flow_inits.operator().move_data().move_paths[mpi_init]
112-
);
113-
});
107+
if log_enabled!(::log::Level::Debug) {
108+
self.flow_inits.each_state_bit(|mpi_init| {
109+
debug!(
110+
"add_liveness_constraints: location={:?} initialized={:?}",
111+
location,
112+
&self.flow_inits.operator().move_data().move_paths[mpi_init]
113+
);
114+
});
115+
}
114116

115117
let mpi = self.move_data.rev_lookup.find_local(live_local);
116118
if let Some(initialized_child) = self.flow_inits.has_any_child_of(mpi) {

src/librustc_typeck/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ test = false
1313
log = "0.4"
1414
syntax = { path = "../libsyntax" }
1515
arena = { path = "../libarena" }
16-
fmt_macros = { path = "../libfmt_macros" }
1716
rustc = { path = "../librustc" }
1817
rustc_data_structures = { path = "../librustc_data_structures" }
1918
rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
11311131

11321132
// Check that a function marked as `#[panic_implementation]` has signature `fn(&PanicInfo) -> !`
11331133
if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
1134-
if panic_impl_did == fn_hir_id.owner_def_id() {
1134+
if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) {
11351135
if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
11361136
if declared_ret_ty.sty != ty::TyNever {
11371137
fcx.tcx.sess.span_err(

src/librustdoc/visit_ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
244244
def_id,
245245
attrs: def.attrs.clone().into(),
246246
name: def.ident.name,
247-
whence: def.span,
247+
whence: self.cx.tcx.def_span(def_id),
248248
matchers,
249-
stab: self.stability(def.id),
250-
depr: self.deprecation(def.id),
249+
stab: self.cx.tcx.lookup_stability(def_id).cloned(),
250+
depr: self.cx.tcx.lookup_deprecation(def_id),
251251
imported_from: Some(imported_from),
252252
})
253253
}

src/libsyntax/attr.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use self::IntType::*;
1717
use ast;
1818
use ast::{AttrId, Attribute, Name, Ident, Path, PathSegment};
1919
use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
20-
use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind};
20+
use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind, GenericParam};
2121
use codemap::{BytePos, Spanned, respan, dummy_spanned};
2222
use syntax_pos::Span;
2323
use errors::{Applicability, Handler};
@@ -1444,6 +1444,22 @@ impl HasAttrs for Stmt {
14441444
}
14451445
}
14461446

1447+
impl HasAttrs for GenericParam {
1448+
fn attrs(&self) -> &[ast::Attribute] {
1449+
match self {
1450+
GenericParam::Lifetime(lifetime) => lifetime.attrs(),
1451+
GenericParam::Type(ty) => ty.attrs(),
1452+
}
1453+
}
1454+
1455+
fn map_attrs<F: FnOnce(Vec<Attribute>) -> Vec<Attribute>>(self, f: F) -> Self {
1456+
match self {
1457+
GenericParam::Lifetime(lifetime) => GenericParam::Lifetime(lifetime.map_attrs(f)),
1458+
GenericParam::Type(ty) => GenericParam::Type(ty.map_attrs(f)),
1459+
}
1460+
}
1461+
}
1462+
14471463
macro_rules! derive_has_attrs {
14481464
($($ty:path),*) => { $(
14491465
impl HasAttrs for $ty {
@@ -1463,5 +1479,5 @@ macro_rules! derive_has_attrs {
14631479

14641480
derive_has_attrs! {
14651481
Item, Expr, Local, ast::ForeignItem, ast::StructField, ast::ImplItem, ast::TraitItem, ast::Arm,
1466-
ast::Field, ast::FieldPat, ast::Variant_
1482+
ast::Field, ast::FieldPat, ast::Variant_, ast::LifetimeDef, ast::TyParam
14671483
}

src/libsyntax/config.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,22 @@ impl<'a> StripUnconfigured<'a> {
278278
pattern
279279
})
280280
}
281+
282+
// deny #[cfg] on generic parameters until we decide what to do with it.
283+
// see issue #51279.
284+
pub fn disallow_cfg_on_generic_param(&mut self, param: &ast::GenericParam) {
285+
for attr in param.attrs() {
286+
let offending_attr = if attr.check_name("cfg") {
287+
"cfg"
288+
} else if attr.check_name("cfg_attr") {
289+
"cfg_attr"
290+
} else {
291+
continue;
292+
};
293+
let msg = format!("#[{}] cannot be applied on a generic parameter", offending_attr);
294+
self.sess.span_diagnostic.span_err(attr.span, &msg);
295+
}
296+
}
281297
}
282298

283299
impl<'a> fold::Folder for StripUnconfigured<'a> {

src/libsyntax/ext/expand.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,11 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
14121412
}
14131413
}
14141414

1415+
fn fold_generic_param(&mut self, param: ast::GenericParam) -> ast::GenericParam {
1416+
self.cfg.disallow_cfg_on_generic_param(&param);
1417+
noop_fold_generic_param(param, self)
1418+
}
1419+
14151420
fn fold_attribute(&mut self, at: ast::Attribute) -> Option<ast::Attribute> {
14161421
// turn `#[doc(include="filename")]` attributes into `#[doc(include(file="filename",
14171422
// contents="file contents")]` attributes

0 commit comments

Comments
 (0)