Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #60416

Merged
merged 14 commits into from
Apr 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/traits/auto_trait.rs
Original file line number Diff line number Diff line change
@@ -712,7 +712,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
// Additionally, we check if we've seen this predicate before,
// to avoid rendering duplicate bounds to the user.
if self.is_param_no_infer(p.skip_binder().projection_ty.substs)
&& !p.ty().skip_binder().is_ty_infer()
&& !p.ty().skip_binder().has_infer_types()
&& is_new_pred {
debug!("evaluate_nested_obligations: adding projection predicate\
to computed_preds: {:?}", predicate);
20 changes: 0 additions & 20 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
@@ -1486,26 +1486,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.queries.on_disk_cache.serialize(self.global_tcx(), encoder)
}

/// This checks whether one is allowed to have pattern bindings
/// that bind-by-move on a match arm that has a guard, e.g.:
///
/// ```rust
/// match foo { A(inner) if { /* something */ } => ..., ... }
/// ```
///
/// It is separate from check_for_mutation_in_guard_via_ast_walk,
/// because that method has a narrower effect that can be toggled
/// off via a separate `-Z` flag, at least for the short term.
pub fn allow_bind_by_move_patterns_with_guards(self) -> bool {
self.features().bind_by_move_pattern_guards
}

/// If true, we should use a naive AST walk to determine if match
/// guard could perform bad mutations (or mutable-borrows).
pub fn check_for_mutation_in_guard_via_ast_walk(self) -> bool {
!self.allow_bind_by_move_patterns_with_guards()
}

/// If true, we should use the AST-based borrowck (we may *also* use
/// the MIR-based borrowck).
pub fn use_ast_borrowck(self) -> bool {
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
// Second, if there is a guard on each arm, make sure it isn't
// assigning or borrowing anything mutably.
if let Some(ref guard) = arm.guard {
if self.tcx.check_for_mutation_in_guard_via_ast_walk() {
if !self.tcx.features().bind_by_move_pattern_guards {
check_for_mutation_in_guard(self, &guard);
}
}
@@ -562,7 +562,7 @@ fn check_legality_of_move_bindings(
"cannot bind by-move with sub-bindings")
.span_label(p.span, "binds an already bound by-move value by moving it")
.emit();
} else if has_guard && !cx.tcx.allow_bind_by_move_patterns_with_guards() {
} else if has_guard && !cx.tcx.features().bind_by_move_pattern_guards {
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
"cannot bind by-move into a pattern guard");
err.span_label(p.span, "moves value into pattern guard");
1 change: 1 addition & 0 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
@@ -2450,6 +2450,7 @@ fn from_target_feature(
Some("adx_target_feature") => rust_features.adx_target_feature,
Some("movbe_target_feature") => rust_features.movbe_target_feature,
Some("rtm_target_feature") => rust_features.rtm_target_feature,
Some("f16c_target_feature") => rust_features.f16c_target_feature,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};
1 change: 1 addition & 0 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
@@ -2945,6 +2945,7 @@ impl Clean<Type> for hir::Ty {

impl<'tcx> Clean<Type> for Ty<'tcx> {
fn clean(&self, cx: &DocContext<'_>) -> Type {
debug!("cleaning type: {:?}", self);
match self.sty {
ty::Never => Never,
ty::Bool => Primitive(PrimitiveType::Bool),
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
@@ -938,7 +938,7 @@ themePicker.onblur = handleThemeButtonsBlur;
static_files::source_code_pro::REGULAR)?;
write(cx.dst.join("SourceCodePro-Semibold.woff"),
static_files::source_code_pro::SEMIBOLD)?;
write(cx.dst.join("SourceCodePro-LICENSE.md"),
write(cx.dst.join("SourceCodePro-LICENSE.txt"),
static_files::source_code_pro::LICENSE)?;
write(cx.dst.join("LICENSE-MIT.txt"),
static_files::LICENSE_MIT)?;
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
Binary file modified src/librustdoc/html/static/SourceCodePro-Regular.woff
Binary file not shown.
Binary file modified src/librustdoc/html/static/SourceCodePro-Semibold.woff
Binary file not shown.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ pub mod source_code_pro {
pub static SEMIBOLD: &'static [u8] = include_bytes!("static/SourceCodePro-Semibold.woff");

/// The file `SourceCodePro-LICENSE.txt`, the license text of the Source Code Pro font.
pub static LICENSE: &'static [u8] = include_bytes!("static/SourceCodePro-LICENSE.md");
pub static LICENSE: &'static [u8] = include_bytes!("static/SourceCodePro-LICENSE.txt");
}

/// Files related to the sidebar in rustdoc sources.
564 changes: 325 additions & 239 deletions src/libsyntax/feature_gate.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/tools/clippy
26 changes: 16 additions & 10 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
@@ -173,18 +173,25 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
let contents = t!(fs::read_to_string(base_src_path.join("libsyntax/feature_gate.rs")));

// We allow rustc-internal features to omit a tracking issue.
// These features must be marked with a `// rustc internal` in its own group.
let mut next_feature_is_rustc_internal = false;
// To make tidy accept omitting a tracking issue, group the list of features
// without one inside `// no tracking issue START` and `// no tracking issue END`.
let mut next_feature_omits_tracking_issue = false;

contents.lines().zip(1..)
.filter_map(|(line, line_number)| {
let line = line.trim();
if line.starts_with("// rustc internal") {
next_feature_is_rustc_internal = true;
return None;
} else if line.is_empty() {
next_feature_is_rustc_internal = false;
return None;

// Within START and END, the tracking issue can be omitted.
match line {
"// no tracking issue START" => {
next_feature_omits_tracking_issue = true;
return None;
}
"// no tracking issue END" => {
next_feature_omits_tracking_issue = false;
return None;
}
_ => {}
}

let mut parts = line.split(',');
@@ -198,7 +205,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
let since = parts.next().unwrap().trim().trim_matches('"');
let issue_str = parts.next().unwrap().trim();
let tracking_issue = if issue_str.starts_with("None") {
if level == Status::Unstable && !next_feature_is_rustc_internal {
if level == Status::Unstable && !next_feature_omits_tracking_issue {
*bad = true;
tidy_error!(
bad,
@@ -209,7 +216,6 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
}
None
} else {
next_feature_is_rustc_internal = false;
let s = issue_str.split('(').nth(1).unwrap().split(')').nth(0).unwrap();
Some(s.parse().unwrap())
};