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 d158897

Browse files
committedSep 28, 2017
Auto merge of #44908 - nikomatsakis:beta-20170928, r=alexcrichton
Beta 20170928 Backports of: - Allow unused extern crate again #44825 - macros: fix bug in collecting trait and impl items with derives. #44757 - `--cap-lints allow` switches off `can_emit_warnings` #44627 - Update the libc submodule #44116 - limit and clear cache obligations opportunistically #44269 - clear out projection subobligations after they are processed #43999
2 parents 3c3cd3f + 41d7051 commit d158897

File tree

17 files changed

+354
-47
lines changed

17 files changed

+354
-47
lines changed
 

‎src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub const CFG_RELEASE_NUM: &str = "1.21.0";
2929
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
3030
// Be sure to make this starts with a dot to conform to semver pre-release
3131
// versions (section 9)
32-
pub const CFG_PRERELEASE_VERSION: &str = ".3";
32+
pub const CFG_PRERELEASE_VERSION: &str = ".4";
3333

3434
pub struct GitInfo {
3535
inner: Option<Info>,

‎src/liblibc

Submodule liblibc updated 83 files

‎src/librustc/infer/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11601160
value.fold_with(&mut r)
11611161
}
11621162

1163+
/// Returns true if `T` contains unresolved type variables. In the
1164+
/// process of visiting `T`, this will resolve (where possible)
1165+
/// type variables in `T`, but it never constructs the final,
1166+
/// resolved type, so it's more efficient than
1167+
/// `resolve_type_vars_if_possible()`.
1168+
pub fn any_unresolved_type_vars<T>(&self, value: &T) -> bool
1169+
where T: TypeFoldable<'tcx>
1170+
{
1171+
let mut r = resolve::UnresolvedTypeFinder::new(self);
1172+
value.visit_with(&mut r)
1173+
}
1174+
11631175
pub fn resolve_type_and_region_vars_if_possible<T>(&self, value: &T) -> T
11641176
where T: TypeFoldable<'tcx>
11651177
{

‎src/librustc/infer/resolve.rs

+38-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use super::{InferCtxt, FixupError, FixupResult};
1212
use ty::{self, Ty, TyCtxt, TypeFoldable};
13-
use ty::fold::TypeFolder;
13+
use ty::fold::{TypeFolder, TypeVisitor};
1414

1515
///////////////////////////////////////////////////////////////////////////
1616
// OPPORTUNISTIC TYPE RESOLVER
@@ -80,6 +80,43 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolv
8080
}
8181
}
8282

83+
///////////////////////////////////////////////////////////////////////////
84+
// UNRESOLVED TYPE FINDER
85+
86+
/// The unresolved type **finder** walks your type and searches for
87+
/// type variables that don't yet have a value. They get pushed into a
88+
/// vector. It does not construct the fully resolved type (which might
89+
/// involve some hashing and so forth).
90+
pub struct UnresolvedTypeFinder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
91+
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
92+
}
93+
94+
impl<'a, 'gcx, 'tcx> UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
95+
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
96+
UnresolvedTypeFinder { infcx }
97+
}
98+
}
99+
100+
impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
101+
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
102+
let t = self.infcx.shallow_resolve(t);
103+
if t.has_infer_types() {
104+
if let ty::TyInfer(_) = t.sty {
105+
// Since we called `shallow_resolve` above, this must
106+
// be an (as yet...) unresolved inference variable.
107+
true
108+
} else {
109+
// Otherwise, visit its contents.
110+
t.super_visit_with(self)
111+
}
112+
} else {
113+
// Micro-optimize: no inference types at all Can't have unresolved type
114+
// variables, no need to visit the contents.
115+
false
116+
}
117+
}
118+
}
119+
83120
///////////////////////////////////////////////////////////////////////////
84121
// FULL TYPE RESOLUTION
85122

‎src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ declare_lint! {
3030

3131
declare_lint! {
3232
pub UNUSED_EXTERN_CRATES,
33-
Warn,
33+
Allow,
3434
"extern crates that are never used"
3535
}
3636

‎src/librustc/session/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,16 @@ pub fn build_session_with_codemap(sopts: config::Options,
642642
// FIXME: This is not general enough to make the warning lint completely override
643643
// normal diagnostic warnings, since the warning lint can also be denied and changed
644644
// later via the source code.
645-
let can_print_warnings = sopts.lint_opts
645+
let warnings_allow = sopts.lint_opts
646646
.iter()
647647
.filter(|&&(ref key, _)| *key == "warnings")
648-
.map(|&(_, ref level)| *level != lint::Allow)
648+
.map(|&(_, ref level)| *level == lint::Allow)
649649
.last()
650-
.unwrap_or(true);
650+
.unwrap_or(false);
651+
let cap_lints_allow = sopts.lint_cap.map_or(false, |cap| cap == lint::Allow);
652+
653+
let can_print_warnings = !(warnings_allow || cap_lints_allow);
654+
651655
let treat_err_as_bug = sopts.debugging_opts.treat_err_as_bug;
652656

653657
let emitter: Box<Emitter> = match (sopts.error_format, emitter_dest) {

‎src/librustc/traits/fulfill.rs

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
251251
});
252252
debug!("select: outcome={:?}", outcome);
253253

254+
// FIXME: if we kept the original cache key, we could mark projection
255+
// obligations as complete for the projection cache here.
256+
254257
errors.extend(
255258
outcome.errors.into_iter()
256259
.map(|e| to_fulfillment_error(e)));

0 commit comments

Comments
 (0)
Please sign in to comment.