Skip to content

Commit

Permalink
Auto merge of #64293 - Centril:rollup-blnhxwl, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

 - #64078 (compiletest: disable -Aunused for run-pass tests)
 - #64263 (Replace "feature gated" wording with "unstable".)
 - #64280 (Factor out pluralisation into syntax::errors)
 - #64288 (use 'get_toml' instead of regular expression)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Sep 8, 2019
2 parents 2b8116d + 51b110f commit a6624ed
Show file tree
Hide file tree
Showing 77 changed files with 177 additions and 101 deletions.
20 changes: 15 additions & 5 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ def get_toml(self, key, section=None):
'value2'
>>> rb.get_toml('key', 'c') is None
True
>>> rb.config_toml = 'key1 = true'
>>> rb.get_toml("key1")
'true'
"""

cur_section = None
Expand Down Expand Up @@ -571,6 +575,12 @@ def get_string(line):
>>> RustBuild.get_string(' "devel" ')
'devel'
>>> RustBuild.get_string(" 'devel' ")
'devel'
>>> RustBuild.get_string('devel') is None
True
>>> RustBuild.get_string(' "devel ')
''
"""
start = line.find('"')
if start != -1:
Expand Down Expand Up @@ -822,13 +832,13 @@ def bootstrap(help_triggered):
except (OSError, IOError):
pass

match = re.search(r'\nverbose = (\d+)', build.config_toml)
if match is not None:
build.verbose = max(build.verbose, int(match.group(1)))
config_verbose = build.get_toml('verbose', 'build')
if config_verbose is not None:
build.verbose = max(build.verbose, int(config_verbose))

build.use_vendored_sources = '\nvendor = true' in build.config_toml
build.use_vendored_sources = build.get_toml('vendor', 'build') == 'true'

build.use_locked_deps = '\nlocked-deps = true' in build.config_toml
build.use_locked_deps = build.get_toml('locked-deps', 'build') == 'true'

build.check_vendored_status()

Expand Down
7 changes: 1 addition & 6 deletions src/librustc/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::borrow::Cow;
use std::fmt;
use rustc_target::spec::abi;
use syntax::ast;
use syntax::errors::pluralise;
use errors::{Applicability, DiagnosticBuilder};
use syntax_pos::Span;

Expand Down Expand Up @@ -82,12 +83,6 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
}
};

macro_rules! pluralise {
($x:expr) => {
if $x != 1 { "s" } else { "" }
};
}

match *self {
CyclicTy(_) => write!(f, "cyclic type of infinite size"),
Mismatch => write!(f, "types differ"),
Expand Down
7 changes: 7 additions & 0 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,10 @@ impl Level {
}
}
}

#[macro_export]
macro_rules! pluralise {
($x:expr) => {
if $x != 1 { "s" } else { "" }
};
}
4 changes: 2 additions & 2 deletions src/librustc_metadata/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ impl Collector<'tcx> {
sym::link_cfg,
span.unwrap(),
GateIssue::Language,
"is feature gated");
"is unstable");
}
if lib.kind == cstore::NativeStaticNobundle &&
!self.tcx.features().static_nobundle {
feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
sym::static_nobundle,
span.unwrap_or_else(|| syntax_pos::DUMMY_SP),
GateIssue::Language,
"kind=\"static-nobundle\" is feature gated");
"kind=\"static-nobundle\" is unstable");
}
self.libs.push(lib);
}
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use rustc_target::spec::abi;
use crate::require_c_abi_if_c_variadic;
use smallvec::SmallVec;
use syntax::ast;
use syntax::errors::pluralise;
use syntax::feature_gate::{GateIssue, emit_feature_err};
use syntax::util::lev_distance::find_best_match_for_name;
use syntax::symbol::sym;
Expand Down Expand Up @@ -377,7 +378,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
quantifier,
bound,
kind,
if bound != 1 { "s" } else { "" },
pluralise!(bound),
))
};

Expand Down
9 changes: 5 additions & 4 deletions src/librustc_typeck/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc::util::common::ErrorReported;
use errors::{Applicability, DiagnosticId};

use syntax_pos::Span;
use syntax::errors::pluralise;

use super::{Inherited, FnCtxt, potentially_plural_count};

Expand Down Expand Up @@ -648,9 +649,9 @@ fn compare_number_of_generics<'tcx>(
declaration has {} {kind} parameter{}",
trait_.ident,
impl_count,
if impl_count != 1 { "s" } else { "" },
pluralise!(impl_count),
trait_count,
if trait_count != 1 { "s" } else { "" },
pluralise!(trait_count),
kind = kind,
),
DiagnosticId::Error("E0049".into()),
Expand All @@ -665,7 +666,7 @@ fn compare_number_of_generics<'tcx>(
"expected {} {} parameter{}",
trait_count,
kind,
if trait_count != 1 { "s" } else { "" },
pluralise!(trait_count),
));
}
for span in spans {
Expand All @@ -680,7 +681,7 @@ fn compare_number_of_generics<'tcx>(
"found {} {} parameter{}{}",
impl_count,
kind,
if impl_count != 1 { "s" } else { "" },
pluralise!(impl_count),
suffix.unwrap_or_else(|| String::new()),
));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(associated_type_bounds)]

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-apit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-dyn-apit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-dyn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_dyn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-inline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-where.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/fn-wrap-apit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// aux-build:fn-aux.rs

#![feature(associated_type_bounds)]
#![allow(dead_code)]

extern crate fn_aux;

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/associated-type-bounds/struct-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass

#![allow(unused)]
#![feature(associated_type_bounds)]

trait Tr1 { type As1; }
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/async-await/argument-patterns.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// edition:2018
// run-pass
// check-pass

#![allow(unused_variables)]
#![deny(unused_mut)]

type A = Vec<u32>;
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/async-await/async-await.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// run-pass

#![allow(unused)]

// edition:2018
// aux-build:arc_wake.rs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
// run-pass

#![deny(dead_code)]
#![allow(unused_variables)]
#![allow(unused_must_use)]
#![allow(path_statements)]

// Test that the drop order for locals in a fn and async fn matches up.
extern crate arc_wake;

use arc_wake::ArcWake;
use std::cell::RefCell;
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::Arc;
Expand Down Expand Up @@ -42,7 +44,7 @@ struct NeverReady;

impl Future for NeverReady {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
Poll::Pending
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// parameters (used or unused) are not dropped until the async fn is cancelled.
// This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs

#![allow(unused_variables)]

extern crate arc_wake;

use arc_wake::ArcWake;
Expand Down Expand Up @@ -43,7 +45,7 @@ struct NeverReady;

impl Future for NeverReady {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
Poll::Pending
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/async-await/issues/issue-54752-async-block.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unnecessary parentheses around assigned value
--> $DIR/issue-54752-async-block.rs:6:22
|
LL | fn main() { let _a = (async { }); }
| ^^^^^^^^^^^^ help: remove these parentheses
|
= note: `#[warn(unused_parens)]` on by default

2 changes: 1 addition & 1 deletion src/test/ui/async-await/issues/issue-59972.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// run-pass

// compile-flags: --edition=2018
// compile-flags: --edition=2018 -Aunused

pub enum Uninhabited { }

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/multiple-lifetimes/hrtb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// edition:2018
// run-pass
// check-pass

// Test that we can use async fns with multiple arbitrary lifetimes.

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/attributes/obsolete-attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Obsolete attributes fall back to feature gated custom attributes.
// Obsolete attributes fall back to unstable custom attributes.

#[ab_isize="stdcall"] extern {}
//~^ ERROR cannot find attribute macro `ab_isize` in this scope
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/attributes/unknown-attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Unknown attributes fall back to feature gated custom attributes.
// Unknown attributes fall back to unstable custom attributes.

#![feature(custom_inner_attributes)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-migrate-to-nll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// revisions: zflag edition
//[zflag]compile-flags: -Z borrowck=migrate
//[edition]edition:2018
//[zflag] run-pass
//[zflag] check-pass

pub struct Block<'a> {
current: &'a u8,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/issue-10876.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

enum Nat {
S(Box<Nat>),
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/two-phase-multiple-activations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub trait FakeRead {
}

impl FakeRead for Foo {
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> Result<usize> {
Ok(4)
}
}

fn main() {
let mut a = Foo {};
let mut v = Vec::new();
a.read_to_end(&mut v);
a.read_to_end(&mut v).unwrap();
}
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/apit-with-const-param.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/array-wrapper-struct-ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

#![allow(dead_code)]

struct ArrayStruct<T, const N: usize> {
data: [T; N],
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/const-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

#[allow(dead_code)]
#![allow(dead_code, unused_variables)]

struct ConstArray<T, const LEN: usize> {
array: [T; LEN],
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/const-generics/issue-61422.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand All @@ -8,7 +8,7 @@ use std::mem;
fn foo<const SIZE: usize>() {
let arr: [u8; SIZE] = unsafe {
#[allow(deprecated)]
let mut array: [u8; SIZE] = mem::uninitialized();
let array: [u8; SIZE] = mem::uninitialized();
array
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/unused-const-param.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/consts/const-eval/const_transmute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-pass

#![feature(const_fn_union)]
#![allow(dead_code)]

#[repr(C)]
union Transmute<T: Copy, U: Copy> {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-labeled-break.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// run-pass
// build-pass

// Using labeled break in a while loop has caused an illegal instruction being
// generated, and an ICE later.
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/consts/packed_pattern.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: unreachable pattern
--> $DIR/packed_pattern.rs:16:9
|
LL | FOO => unreachable!(),
| ^^^
|
= note: `#[warn(unreachable_patterns)]` on by default

Loading

0 comments on commit a6624ed

Please sign in to comment.