Auto merge of #64293 - Centril:rollup-blnhxwl, r=Centril
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
This commit is contained in:
commit
a6624ed980
77 changed files with 177 additions and 101 deletions
|
@ -523,6 +523,10 @@ class RustBuild(object):
|
|||
'value2'
|
||||
>>> rb.get_toml('key', 'c') is None
|
||||
True
|
||||
|
||||
>>> rb.config_toml = 'key1 = true'
|
||||
>>> rb.get_toml("key1")
|
||||
'true'
|
||||
"""
|
||||
|
||||
cur_section = None
|
||||
|
@ -571,6 +575,12 @@ class RustBuild(object):
|
|||
|
||||
>>> 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:
|
||||
|
@ -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()
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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"),
|
||||
|
|
|
@ -845,3 +845,10 @@ impl Level {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! pluralise {
|
||||
($x:expr) => {
|
||||
if $x != 1 { "s" } else { "" }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ 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 {
|
||||
|
@ -167,7 +167,7 @@ impl Collector<'tcx> {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -377,7 +378,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
quantifier,
|
||||
bound,
|
||||
kind,
|
||||
if bound != 1 { "s" } else { "" },
|
||||
pluralise!(bound),
|
||||
))
|
||||
};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
@ -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()),
|
||||
|
@ -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 {
|
||||
|
@ -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()),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-pass
|
||||
// aux-build:fn-aux.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
extern crate fn_aux;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-pass
|
||||
// aux-build:fn-dyn-aux.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
extern crate fn_dyn_aux;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-pass
|
||||
// aux-build:fn-aux.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
extern crate fn_aux;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-pass
|
||||
// aux-build:fn-aux.rs
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
extern crate fn_aux;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// aux-build:fn-aux.rs
|
||||
|
||||
#![feature(associated_type_bounds)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
extern crate fn_aux;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
trait Tr1 { type As1; }
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// edition:2018
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![allow(unused_variables)]
|
||||
#![deny(unused_mut)]
|
||||
|
||||
type A = Vec<u32>;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// run-pass
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
// edition:2018
|
||||
// aux-build:arc_wake.rs
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// 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;
|
||||
|
@ -10,7 +13,6 @@ 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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
// compile-flags: --edition=2018
|
||||
// compile-flags: --edition=2018 -Aunused
|
||||
|
||||
pub enum Uninhabited { }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// edition:2018
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
// Test that we can use async fns with multiple arbitrary lifetimes.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)]
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
enum Nat {
|
||||
S(Box<Nat>),
|
||||
|
|
|
@ -11,7 +11,7 @@ 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)
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ impl FakeRead for Foo {
|
|||
fn main() {
|
||||
let mut a = Foo {};
|
||||
let mut v = Vec::new();
|
||||
a.read_to_end(&mut v);
|
||||
a.read_to_end(&mut v).unwrap();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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],
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_fn_union)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[repr(C)]
|
||||
union Transmute<T: Copy, U: Copy> {
|
||||
|
|
|
@ -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.
|
||||
|
|
8
src/test/ui/consts/packed_pattern.stderr
Normal file
8
src/test/ui/consts/packed_pattern.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/packed_pattern.rs:16:9
|
||||
|
|
||||
LL | FOO => unreachable!(),
|
||||
| ^^^
|
||||
|
|
||||
= note: `#[warn(unreachable_patterns)]` on by default
|
||||
|
8
src/test/ui/consts/packed_pattern2.stderr
Normal file
8
src/test/ui/consts/packed_pattern2.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/packed_pattern2.rs:24:9
|
||||
|
|
||||
LL | FOO => unreachable!(),
|
||||
| ^^^
|
||||
|
|
||||
= note: `#[warn(unreachable_patterns)]` on by default
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![deny(deprecated_in_future)]
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![allow(unused)]
|
||||
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//~ ERROR kind="static-nobundle" is feature gated
|
||||
//~ ERROR kind="static-nobundle" is unstable
|
||||
// Test the behavior of rustc when non-existent library is statically linked
|
||||
|
||||
// compile-flags: -l static-nobundle=nonexistent
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0658]: kind="static-nobundle" is feature gated
|
||||
error[E0658]: kind="static-nobundle" is unstable
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/37403
|
||||
= help: add `#![feature(static_nobundle)]` to the crate attributes to enable
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
fn main() {
|
||||
// Assert `Iterator` methods are feature gated
|
||||
// Assert `Iterator` methods are unstable
|
||||
assert!([1, 2, 2, 9].iter().is_sorted());
|
||||
//~^ ERROR: use of unstable library feature 'is_sorted': new API
|
||||
assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
|
||||
//~^ ERROR: use of unstable library feature 'is_sorted': new API
|
||||
|
||||
// Assert `[T]` methods are feature gated
|
||||
// Assert `[T]` methods are unstable
|
||||
assert!([1, 2, 2, 9].is_sorted());
|
||||
//~^ ERROR: use of unstable library feature 'is_sorted': new API
|
||||
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#[link(name = "foo", cfg(foo))]
|
||||
//~^ ERROR: is feature gated
|
||||
//~^ ERROR: is unstable
|
||||
extern {}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0658]: is feature gated
|
||||
error[E0658]: is unstable
|
||||
--> $DIR/feature-gate-link_cfg.rs:1:1
|
||||
|
|
||||
LL | #[link(name = "foo", cfg(foo))]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#[link(name="foo", kind="static-nobundle")]
|
||||
//~^ ERROR: kind="static-nobundle" is feature gated
|
||||
//~^ ERROR: kind="static-nobundle" is unstable
|
||||
extern {}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0658]: kind="static-nobundle" is feature gated
|
||||
error[E0658]: kind="static-nobundle" is unstable
|
||||
--> $DIR/feature-gate-static-nobundle.rs:1:1
|
||||
|
|
||||
LL | #[link(name="foo", kind="static-nobundle")]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Type ascription is feature gated
|
||||
// Type ascription is unstable
|
||||
|
||||
fn main() {
|
||||
let a = 10: u8; //~ ERROR type ascription is experimental
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
// See [this comment on GitHub][c] for more details.
|
||||
//
|
||||
// run-pass
|
||||
// check-pass
|
||||
//
|
||||
// [c]: https://github.com/rust-lang/rust/issues/57639#issuecomment-455685861
|
||||
|
||||
|
|
8
src/test/ui/if-ret.stderr
Normal file
8
src/test/ui/if-ret.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
warning: unreachable block in `if` expression
|
||||
--> $DIR/if-ret.rs:6:24
|
||||
|
|
||||
LL | fn foo() { if (return) { } }
|
||||
| ^^^
|
||||
|
|
||||
= note: `#[warn(unreachable_code)]` on by default
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
// `foo` and hence is treated opaquely within the closure body. This
|
||||
// resulted in a failed subtype relationship.
|
||||
//
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
fn foo() -> impl Copy { || foo(); }
|
||||
fn bar() -> impl Copy { || bar(); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
|
@ -9,7 +9,7 @@ fn bar<F: Fn(&i32) + Clone>(f: F) -> F {
|
|||
}
|
||||
|
||||
fn foo() -> X {
|
||||
bar(|x| ())
|
||||
bar(|_| ())
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// edition:2018
|
||||
// run-pass
|
||||
// check-pass
|
||||
// revisions: migrate mir
|
||||
//[mir]compile-flags: -Z borrowck=mir
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![feature(member_constraints)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
trait MultiRegionTrait<'a, 'b> {}
|
||||
impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
pub struct Bar<T> {
|
||||
items: Vec<&'static str>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
pub struct Item {
|
||||
_inner: &'static str,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
struct S<T> {
|
||||
t : T,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
#![deny(unused_results)]
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Inner<I, V> {
|
||||
iterator: I,
|
||||
item: V,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Regression test for #48132. This was failing due to problems around
|
||||
// the projection caching and dropck type enumeration.
|
||||
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
pub struct Container<T: Iterator> {
|
||||
value: Option<T::Item>,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// aux-build:xcrate-issue-61711-b.rs
|
||||
// compile-flags:--extern xcrate_issue_61711_b
|
||||
|
||||
// run-pass
|
||||
// build-pass
|
||||
|
||||
fn f<F: Fn(xcrate_issue_61711_b::Struct)>(_: F) { }
|
||||
fn main() { }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![feature(lint_reasons)]
|
||||
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
// Empty (and reason-only) lint attributes are legal—although we may want to
|
||||
// lint them in the future (Issue #55112).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
struct Slice(&'static [&'static [u8]]);
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ fn digits(x: u8) -> u32 {
|
|||
OneDigit::FIRST..=OneDigit::LAST => 1,
|
||||
TwoDigits::FIRST..=TwoDigits::LAST => 2,
|
||||
ThreeDigits::FIRST..=ThreeDigits::LAST => 3,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Check that lifetime bounds get checked the right way around with NLL enabled.
|
||||
|
||||
//run-pass
|
||||
// check-pass
|
||||
|
||||
trait Visitor<'d> {
|
||||
type Value;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Check that mutable promoted length zero arrays don't check for conflicting
|
||||
// access
|
||||
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
pub fn main() {
|
||||
let mut x: Vec<&[i32; 0]> = Vec::new();
|
||||
for i in 0..10 {
|
||||
for _ in 0..10 {
|
||||
x.push(&[]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// The `Self::HASH_LEN` here expands to a "self-type" where `T` is not
|
||||
// known. This unbound inference variable was causing an ICE.
|
||||
//
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
pub struct Foo<T>(T);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// the inherent impl requires normalization to be equal to the
|
||||
// user-provided type.
|
||||
//
|
||||
// run-pass
|
||||
// check-pass
|
||||
|
||||
trait Mirror {
|
||||
type Me;
|
||||
|
@ -15,7 +15,7 @@ impl<T> Mirror for T {
|
|||
struct Foo<A, B>(A, B);
|
||||
|
||||
impl<A> Foo<A, <A as Mirror>::Me> {
|
||||
fn m(b: A) { }
|
||||
fn m(_: A) { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -23,11 +23,11 @@ macro_rules! attr_proc_mac {
|
|||
//~^ ERROR cannot find
|
||||
struct Foo;
|
||||
|
||||
// Interpreted as a feature gated custom attribute
|
||||
// Interpreted as an unstable custom attribute
|
||||
#[attr_proc_macra] //~ ERROR cannot find attribute macro `attr_proc_macra` in this scope
|
||||
struct Bar;
|
||||
|
||||
// Interpreted as a feature gated custom attribute
|
||||
// Interpreted as an unstable custom attribute
|
||||
#[FooWithLongNan] //~ ERROR cannot find attribute macro `FooWithLongNan` in this scope
|
||||
struct Asdf;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ use std::sync::mpsc::channel;
|
|||
fn main() {
|
||||
let (tx, rx) = channel();
|
||||
let x = Some(rx);
|
||||
tx.send(false);
|
||||
tx.send(false);
|
||||
tx.send(false).unwrap();
|
||||
tx.send(false).unwrap();
|
||||
match x {
|
||||
Some(z) if z.recv().unwrap() => { panic!() },
|
||||
Some(z) => { assert!(!z.recv().unwrap()); },
|
||||
|
|
|
@ -10,11 +10,11 @@ pub enum NonExhaustiveVariants {
|
|||
|
||||
fn main() {
|
||||
let variant_tuple = NonExhaustiveVariants::Tuple(340);
|
||||
let variant_struct = NonExhaustiveVariants::Struct { field: 340 };
|
||||
let _variant_struct = NonExhaustiveVariants::Struct { field: 340 };
|
||||
|
||||
match variant_tuple {
|
||||
NonExhaustiveVariants::Unit => "",
|
||||
NonExhaustiveVariants::Tuple(fe_tpl) => "",
|
||||
NonExhaustiveVariants::Struct { field } => ""
|
||||
NonExhaustiveVariants::Tuple(_fe_tpl) => "",
|
||||
NonExhaustiveVariants::Struct { field: _ } => ""
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#![allow(irrefutable_let_patterns)]
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
fn main() {
|
||||
let x: bool;
|
||||
// This should associate as: `(x = (true && false));`.
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
warning: unreachable block in `if` expression
|
||||
--> $DIR/protect-precedences.rs:13:41
|
||||
|
|
||||
LL | if let _ = return true && false {};
|
||||
| ^^
|
||||
|
|
||||
= note: `#[warn(unreachable_code)]` on by default
|
||||
|
|
@ -4,7 +4,7 @@ type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::
|
|||
#[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope
|
||||
struct S;
|
||||
|
||||
// Interpreted as a feature gated custom attribute
|
||||
// Interpreted as an unstable custom attribute
|
||||
#[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope
|
||||
fn check() {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// run-pass
|
||||
// check-pass
|
||||
|
||||
// This test checks that trait objects involving trait aliases are well-formed.
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#![allow(irrefutable_let_patterns)]
|
||||
|
||||
enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
|
||||
enum Enum<T> { TSVariant(T), SVariant { _v: T }, UVariant }
|
||||
type Alias<T> = Enum<T>;
|
||||
type AliasFixed = Enum<()>;
|
||||
|
||||
macro_rules! is_variant {
|
||||
(TSVariant, $expr:expr) => (is_variant!(@check TSVariant, (_), $expr));
|
||||
(SVariant, $expr:expr) => (is_variant!(@check SVariant, { v: _ }, $expr));
|
||||
(SVariant, $expr:expr) => (is_variant!(@check SVariant, { _v: _ }, $expr));
|
||||
(UVariant, $expr:expr) => (is_variant!(@check UVariant, {}, $expr));
|
||||
(@check $variant:ident, $matcher:tt, $expr:expr) => (
|
||||
assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false },
|
||||
|
@ -37,14 +37,14 @@ fn main() {
|
|||
|
||||
// Struct variant
|
||||
|
||||
is_variant!(SVariant, Enum::SVariant { v: () });
|
||||
is_variant!(SVariant, Enum::SVariant::<()> { v: () });
|
||||
is_variant!(SVariant, Enum::<()>::SVariant { v: () });
|
||||
is_variant!(SVariant, Enum::SVariant { _v: () });
|
||||
is_variant!(SVariant, Enum::SVariant::<()> { _v: () });
|
||||
is_variant!(SVariant, Enum::<()>::SVariant { _v: () });
|
||||
|
||||
is_variant!(SVariant, Alias::SVariant { v: () });
|
||||
is_variant!(SVariant, Alias::<()>::SVariant { v: () });
|
||||
is_variant!(SVariant, Alias::SVariant { _v: () });
|
||||
is_variant!(SVariant, Alias::<()>::SVariant { _v: () });
|
||||
|
||||
is_variant!(SVariant, AliasFixed::SVariant { v: () });
|
||||
is_variant!(SVariant, AliasFixed::SVariant { _v: () });
|
||||
|
||||
// Unit variant
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn macros() {
|
||||
macro_rules! foo{
|
||||
($p:pat, $e:expr, $b:block) => {{
|
||||
|
@ -12,16 +13,16 @@ fn macros() {
|
|||
}}
|
||||
}
|
||||
|
||||
foo!(a, 1, { //~ WARN irrefutable while-let
|
||||
foo!(_a, 1, { //~ WARN irrefutable while-let
|
||||
println!("irrefutable pattern");
|
||||
});
|
||||
bar!(a, 1, { //~ WARN irrefutable while-let
|
||||
bar!(_a, 1, { //~ WARN irrefutable while-let
|
||||
println!("irrefutable pattern");
|
||||
});
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
while let a = 1 { //~ WARN irrefutable while-let
|
||||
while let _a = 1 { //~ WARN irrefutable while-let
|
||||
println!("irrefutable pattern");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
warning: irrefutable while-let pattern
|
||||
--> $DIR/while-let.rs:6:13
|
||||
--> $DIR/while-let.rs:7:13
|
||||
|
|
||||
LL | while let $p = $e $b
|
||||
| ^^^^^
|
||||
...
|
||||
LL | / foo!(a, 1, {
|
||||
LL | / foo!(_a, 1, {
|
||||
LL | | println!("irrefutable pattern");
|
||||
LL | | });
|
||||
| |_______- in this macro invocation
|
||||
|
@ -12,20 +12,20 @@ LL | | });
|
|||
= note: `#[warn(irrefutable_let_patterns)]` on by default
|
||||
|
||||
warning: irrefutable while-let pattern
|
||||
--> $DIR/while-let.rs:6:13
|
||||
--> $DIR/while-let.rs:7:13
|
||||
|
|
||||
LL | while let $p = $e $b
|
||||
| ^^^^^
|
||||
...
|
||||
LL | / bar!(a, 1, {
|
||||
LL | / bar!(_a, 1, {
|
||||
LL | | println!("irrefutable pattern");
|
||||
LL | | });
|
||||
| |_______- in this macro invocation
|
||||
|
||||
warning: irrefutable while-let pattern
|
||||
--> $DIR/while-let.rs:24:5
|
||||
--> $DIR/while-let.rs:25:5
|
||||
|
|
||||
LL | / while let a = 1 {
|
||||
LL | / while let _a = 1 {
|
||||
LL | | println!("irrefutable pattern");
|
||||
LL | | break;
|
||||
LL | | }
|
||||
|
|
|
@ -628,6 +628,11 @@ impl TestProps {
|
|||
}
|
||||
self.pass_mode
|
||||
}
|
||||
|
||||
// does not consider CLI override for pass mode
|
||||
pub fn local_pass_mode(&self) -> Option<PassMode> {
|
||||
self.pass_mode
|
||||
}
|
||||
}
|
||||
|
||||
fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {
|
||||
|
|
|
@ -1557,7 +1557,11 @@ impl<'test> TestCx<'test> {
|
|||
// want to actually assert warnings about all this code. Instead
|
||||
// let's just ignore unused code warnings by defaults and tests
|
||||
// can turn it back on if needed.
|
||||
if !self.config.src_base.ends_with("rustdoc-ui") {
|
||||
if !self.config.src_base.ends_with("rustdoc-ui") &&
|
||||
// Note that we don't call pass_mode() here as we don't want
|
||||
// to set unused to allow if we've overriden the pass mode
|
||||
// via command line flags.
|
||||
self.props.local_pass_mode() != Some(PassMode::Run) {
|
||||
rustc.args(&["-A", "unused"]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue