Skip to content

Rollup of 4 pull requests #63134

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

Closed
wants to merge 12 commits into from
Closed
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
148 changes: 65 additions & 83 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(bootstrap), allow(incomplete_features))]

#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(test))]
3 changes: 2 additions & 1 deletion src/libcore/any.rs
Original file line number Diff line number Diff line change
@@ -468,7 +468,8 @@ impl TypeId {
/// The current implementation uses the same infrastructure as compiler
/// diagnostics and debuginfo, but this is not guaranteed.
#[stable(feature = "type_name", since = "1.38.0")]
pub fn type_name<T: ?Sized>() -> &'static str {
#[rustc_const_unstable(feature = "const_type_name")]
pub const fn type_name<T: ?Sized>() -> &'static str {
#[cfg(bootstrap)]
unsafe {
intrinsics::type_name::<T>()
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@
#![warn(missing_debug_implementations)]
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(bootstrap), allow(incomplete_features))]

#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
37 changes: 34 additions & 3 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
@@ -33,13 +33,12 @@ use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
use rustc::util::nodemap::FxHashSet;

use syntax::tokenstream::{TokenTree, TokenStream};
use syntax::ast;
use syntax::ast::{self, Expr};
use syntax::ptr::P;
use syntax::ast::Expr;
use syntax::attr::{self, HasAttrs, AttributeTemplate};
use syntax::source_map::Spanned;
use syntax::edition::Edition;
use syntax::feature_gate::{AttributeGate, AttributeType};
use syntax::feature_gate::{self, AttributeGate, AttributeType};
use syntax::feature_gate::{Stability, deprecated_attributes};
use syntax_pos::{BytePos, Span, SyntaxContext};
use syntax::symbol::{Symbol, kw, sym};
@@ -1831,3 +1830,35 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
}
}
}

declare_lint! {
pub INCOMPLETE_FEATURES,
Warn,
"incomplete features that may function improperly in some or all cases"
}

declare_lint_pass!(
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `feature_gate.rs`.
IncompleteFeatures => [INCOMPLETE_FEATURES]
);

impl EarlyLintPass for IncompleteFeatures {
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
let features = cx.sess.features_untracked();
features.declared_lang_features
.iter().map(|(name, span, _)| (name, span))
.chain(features.declared_lib_features.iter().map(|(name, span)| (name, span)))
.filter(|(name, _)| feature_gate::INCOMPLETE_FEATURES.iter().any(|f| name == &f))
.for_each(|(name, &span)| {
cx.struct_span_lint(
INCOMPLETE_FEATURES,
span,
&format!(
"the feature `{}` is incomplete and may cause the compiler to crash",
name,
)
)
.emit();
});
}
}
1 change: 1 addition & 0 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ macro_rules! early_lint_passes {
DeprecatedAttr: DeprecatedAttr::new(),
WhileTrue: WhileTrue,
NonAsciiIdents: NonAsciiIdents,
IncompleteFeatures: IncompleteFeatures,
]);
)
}
17 changes: 4 additions & 13 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -569,10 +569,10 @@ declare_features! (
// -------------------------------------------------------------------------
);

// Some features are known to be incomplete and using them is likely to have
// unanticipated results, such as compiler crashes. We warn the user about these
// to alert them.
const INCOMPLETE_FEATURES: &[Symbol] = &[
/// Some features are known to be incomplete and using them is likely to have
/// unanticipated results, such as compiler crashes. We warn the user about these
/// to alert them.
pub const INCOMPLETE_FEATURES: &[Symbol] = &[
sym::impl_trait_in_bindings,
sym::generic_associated_types,
sym::const_generics,
@@ -2338,15 +2338,6 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
}

let name = mi.name_or_empty();
if INCOMPLETE_FEATURES.iter().any(|f| name == *f) {
span_handler.struct_span_warn(
mi.span(),
&format!(
"the feature `{}` is incomplete and may cause the compiler to crash",
name
)
).emit();
}

if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
if *edition <= crate_edition {
128 changes: 128 additions & 0 deletions src/test/ui/array-slice-vec/subslice-patterns-pass.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// This test comprehensively checks the passing static and dynamic semantics
// of subslice patterns `..`, `x @ ..`, `ref x @ ..`, and `ref mut @ ..`
// in slice patterns `[$($pat), $(,)?]` .

// run-pass

#![feature(slice_patterns)]

#![allow(unreachable_patterns)]

use std::convert::identity;

#[derive(PartialEq, Debug, Clone)]
struct N(u8);

macro_rules! n {
($($e:expr),* $(,)?) => {
[$(N($e)),*]
}
}

macro_rules! c {
($inp:expr, $typ:ty, $out:expr $(,)?) => {
assert_eq!($out, identity::<$typ>($inp));
}
}

macro_rules! m {
($e:expr, $p:pat => $b:expr) => {
match $e {
$p => $b,
_ => panic!(),
}
}
}

fn main() {
slices();
arrays();
}

fn slices() {
// Matching slices using `ref` patterns:
let mut v = vec![N(0), N(1), N(2), N(3), N(4)];
let mut vc = (0..=4).collect::<Vec<u8>>();

let [..] = v[..]; // Always matches.
m!(v[..], [N(0), ref sub @ .., N(4)] => c!(sub, &[N], n![1, 2, 3]));
m!(v[..], [N(0), ref sub @ ..] => c!(sub, &[N], n![1, 2, 3, 4]));
m!(v[..], [ref sub @ .., N(4)] => c!(sub, &[N], n![0, 1, 2, 3]));
m!(v[..], [ref sub @ .., _, _, _, _, _] => c!(sub, &[N], &n![] as &[N]));
m!(v[..], [_, _, _, _, _, ref sub @ ..] => c!(sub, &[N], &n![] as &[N]));
m!(vc[..], [x, .., y] => c!((x, y), (u8, u8), (0, 4)));

// Matching slices using `ref mut` patterns:
let [..] = v[..]; // Always matches.
m!(v[..], [N(0), ref mut sub @ .., N(4)] => c!(sub, &mut [N], n![1, 2, 3]));
m!(v[..], [N(0), ref mut sub @ ..] => c!(sub, &mut [N], n![1, 2, 3, 4]));
m!(v[..], [ref mut sub @ .., N(4)] => c!(sub, &mut [N], n![0, 1, 2, 3]));
m!(v[..], [ref mut sub @ .., _, _, _, _, _] => c!(sub, &mut [N], &mut n![] as &mut [N]));
m!(v[..], [_, _, _, _, _, ref mut sub @ ..] => c!(sub, &mut [N], &mut n![] as &mut [N]));
m!(vc[..], [x, .., y] => c!((x, y), (u8, u8), (0, 4)));

// Matching slices using default binding modes (&):
let [..] = &v[..]; // Always matches.
m!(&v[..], [N(0), sub @ .., N(4)] => c!(sub, &[N], n![1, 2, 3]));
m!(&v[..], [N(0), sub @ ..] => c!(sub, &[N], n![1, 2, 3, 4]));
m!(&v[..], [sub @ .., N(4)] => c!(sub, &[N], n![0, 1, 2, 3]));
m!(&v[..], [sub @ .., _, _, _, _, _] => c!(sub, &[N], &n![] as &[N]));
m!(&v[..], [_, _, _, _, _, sub @ ..] => c!(sub, &[N], &n![] as &[N]));
m!(&vc[..], [x, .., y] => c!((x, y), (&u8, &u8), (&0, &4)));

// Matching slices using default binding modes (&mut):
let [..] = &mut v[..]; // Always matches.
m!(&mut v[..], [N(0), sub @ .., N(4)] => c!(sub, &mut [N], n![1, 2, 3]));
m!(&mut v[..], [N(0), sub @ ..] => c!(sub, &mut [N], n![1, 2, 3, 4]));
m!(&mut v[..], [sub @ .., N(4)] => c!(sub, &mut [N], n![0, 1, 2, 3]));
m!(&mut v[..], [sub @ .., _, _, _, _, _] => c!(sub, &mut [N], &mut n![] as &mut [N]));
m!(&mut v[..], [_, _, _, _, _, sub @ ..] => c!(sub, &mut [N], &mut n![] as &mut [N]));
m!(&mut vc[..], [x, .., y] => c!((x, y), (&mut u8, &mut u8), (&mut 0, &mut 4)));
}

fn arrays() {
let mut v = n![0, 1, 2, 3, 4];
let vc = [0, 1, 2, 3, 4];

// Matching arrays by value:
m!(v.clone(), [N(0), sub @ .., N(4)] => c!(sub, [N; 3], n![1, 2, 3]));
m!(v.clone(), [N(0), sub @ ..] => c!(sub, [N; 4], n![1, 2, 3, 4]));
m!(v.clone(), [sub @ .., N(4)] => c!(sub, [N; 4], n![0, 1, 2, 3]));
m!(v.clone(), [sub @ .., _, _, _, _, _] => c!(sub, [N; 0], n![] as [N; 0]));
m!(v.clone(), [_, _, _, _, _, sub @ ..] => c!(sub, [N; 0], n![] as [N; 0]));
m!(v.clone(), [x, .., y] => c!((x, y), (N, N), (N(0), N(4))));
m!(v.clone(), [..] => ());

// Matching arrays by ref patterns:
m!(v, [N(0), ref sub @ .., N(4)] => c!(sub, &[N; 3], &n![1, 2, 3]));
m!(v, [N(0), ref sub @ ..] => c!(sub, &[N; 4], &n![1, 2, 3, 4]));
m!(v, [ref sub @ .., N(4)] => c!(sub, &[N; 4], &n![0, 1, 2, 3]));
m!(v, [ref sub @ .., _, _, _, _, _] => c!(sub, &[N; 0], &n![] as &[N; 0]));
m!(v, [_, _, _, _, _, ref sub @ ..] => c!(sub, &[N; 0], &n![] as &[N; 0]));
m!(vc, [x, .., y] => c!((x, y), (u8, u8), (0, 4)));

// Matching arrays by ref mut patterns:
m!(v, [N(0), ref mut sub @ .., N(4)] => c!(sub, &mut [N; 3], &mut n![1, 2, 3]));
m!(v, [N(0), ref mut sub @ ..] => c!(sub, &mut [N; 4], &mut n![1, 2, 3, 4]));
m!(v, [ref mut sub @ .., N(4)] => c!(sub, &mut [N; 4], &mut n![0, 1, 2, 3]));
m!(v, [ref mut sub @ .., _, _, _, _, _] => c!(sub, &mut [N; 0], &mut n![] as &mut [N; 0]));
m!(v, [_, _, _, _, _, ref mut sub @ ..] => c!(sub, &mut [N; 0], &mut n![] as &mut [N; 0]));

// Matching arrays by default binding modes (&):
m!(&v, [N(0), sub @ .., N(4)] => c!(sub, &[N; 3], &n![1, 2, 3]));
m!(&v, [N(0), sub @ ..] => c!(sub, &[N; 4], &n![1, 2, 3, 4]));
m!(&v, [sub @ .., N(4)] => c!(sub, &[N; 4], &n![0, 1, 2, 3]));
m!(&v, [sub @ .., _, _, _, _, _] => c!(sub, &[N; 0], &n![] as &[N; 0]));
m!(&v, [_, _, _, _, _, sub @ ..] => c!(sub, &[N; 0], &n![] as &[N; 0]));
m!(&v, [..] => ());
m!(&v, [x, .., y] => c!((x, y), (&N, &N), (&N(0), &N(4))));

// Matching arrays by default binding modes (&mut):
m!(&mut v, [N(0), sub @ .., N(4)] => c!(sub, &mut [N; 3], &mut n![1, 2, 3]));
m!(&mut v, [N(0), sub @ ..] => c!(sub, &mut [N; 4], &mut n![1, 2, 3, 4]));
m!(&mut v, [sub @ .., N(4)] => c!(sub, &mut [N; 4], &mut n![0, 1, 2, 3]));
m!(&mut v, [sub @ .., _, _, _, _, _] => c!(sub, &mut [N; 0], &mut n![] as &[N; 0]));
m!(&mut v, [_, _, _, _, _, sub @ ..] => c!(sub, &mut [N; 0], &mut n![] as &[N; 0]));
m!(&mut v, [..] => ());
m!(&mut v, [x, .., y] => c!((x, y), (&mut N, &mut N), (&mut N(0), &mut N(4))));
}
2 changes: 2 additions & 0 deletions src/test/ui/associated-type-bounds/duplicate.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:12:36
2 changes: 2 additions & 0 deletions src/test/ui/associated-type-bounds/dyn-lcsit.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/associated-type-bounds/lcsit.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/apit-with-const-param.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/array-wrapper-struct-ctor.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/broken-mir-1.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/broken-mir-2.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0277]: arrays only have std trait implementations for lengths 0..=32
--> $DIR/broken-mir-2.rs:7:36
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/cannot-infer-const-args.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0282]: type annotations needed
--> $DIR/cannot-infer-const-args.rs:9:5
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/concrete-const-as-fn-arg.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/concrete-const-impl-method.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/const-arg-in-fn.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/const-expression-parameter.stderr
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

14 changes: 8 additions & 6 deletions src/test/ui/const-generics/const-fn-with-const-param.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-fn-with-const-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error: const parameters are not permitted in `const fn`
--> $DIR/const-fn-with-const-param.rs:4:1
|
@@ -13,5 +7,13 @@ LL | | X
LL | | }
| |_^

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-fn-with-const-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/const-generic-array-wrapper.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

fn bar<const X: (), 'a>(_: &'a ()) {
//~^ ERROR lifetime parameters must be declared prior to const parameters
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-param-before-other-params.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error: lifetime parameters must be declared prior to const parameters
--> $DIR/const-param-before-other-params.rs:4:21
--> $DIR/const-param-before-other-params.rs:3:21
|
LL | fn bar<const X: (), 'a>(_: &'a ()) {
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`

error: type parameters must be declared prior to const parameters
--> $DIR/const-param-before-other-params.rs:8:21
--> $DIR/const-param-before-other-params.rs:7:21
|
LL | fn foo<const X: (), T>(_: &T) {
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
14 changes: 8 additions & 6 deletions src/test/ui/const-generics/const-param-from-outer-fn.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-param-from-outer-fn.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error[E0401]: can't use generic parameters from outer function
--> $DIR/const-param-from-outer-fn.rs:6:9
|
@@ -14,6 +8,14 @@ LL | fn bar() -> u32 {
LL | X
| ^ use of generic parameter from outer function

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-param-from-outer-fn.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0401`.
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/const-param-in-trait.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
error[E0671]: const parameters cannot depend on type parameters
--> $DIR/const-param-type-depends-on-type-param.rs:9:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ const parameter depends on type parameter

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-param-type-depends-on-type-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error[E0671]: const parameters cannot depend on type parameters
--> $DIR/const-param-type-depends-on-type-param.rs:9:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ const parameter depends on type parameter
= note: `#[warn(incomplete_features)]` on by default

error[E0392]: parameter `T` is never used
--> $DIR/const-param-type-depends-on-type-param.rs:9:22
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: const parameter `x` should have an upper case name
--> $DIR/const-parameter-uppercase-lint.rs:6:15
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/const-types.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/derive-debug-array-wrapper.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0277]: arrays only have std trait implementations for lengths 0..=32
--> $DIR/derive-debug-array-wrapper.rs:6:5
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/impl-const-generic-struct.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0107]: wrong number of const arguments: expected 2, found 1
--> $DIR/incorrect-number-of-const-args.rs:9:5
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-61336-1.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: array lengths can't depend on generic parameters
--> $DIR/issue-61336-1.rs:5:9
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-61336-2.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: array lengths can't depend on generic parameters
--> $DIR/issue-61336-2.rs:5:9
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-61336.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: array lengths can't depend on generic parameters
--> $DIR/issue-61336.rs:5:9
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-61422.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/mut-ref-const-param-array.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
error[E0573]: expected type, found const parameter `C`
--> $DIR/struct-with-invalid-const-param.rs:4:23
|
LL | struct S<const C: u8>(C);
| ^ help: a struct with a similar name exists: `S`

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/struct-with-invalid-const-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error[E0573]: expected type, found const parameter `C`
--> $DIR/struct-with-invalid-const-param.rs:4:23
|
LL | struct S<const C: u8>(C);
| ^ help: a struct with a similar name exists: `S`
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/unused-const-param.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

29 changes: 29 additions & 0 deletions src/test/ui/consts/const-fn-type-name-any.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// run-pass

#![feature(const_fn)]
#![feature(const_type_name)]
#![allow(dead_code)]

const fn type_name_wrapper<T>(_: &T) -> &'static str {
std::any::type_name::<T>()
}

struct Struct<TA, TB, TC> {
a: TA,
b: TB,
c: TC,
}

type StructInstantiation = Struct<i8, f64, bool>;

const CONST_STRUCT: StructInstantiation = StructInstantiation { a: 12, b: 13.7, c: false };

const CONST_STRUCT_NAME: &'static str = type_name_wrapper(&CONST_STRUCT);

fn main() {
let non_const_struct = StructInstantiation { a: 87, b: 65.99, c: true };

let non_const_struct_name = type_name_wrapper(&non_const_struct);

assert_eq!(CONST_STRUCT_NAME, non_const_struct_name);
}
2 changes: 2 additions & 0 deletions src/test/ui/error-codes/E0730.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0730]: cannot pattern-match on an array without a fixed length
--> $DIR/E0730.rs:6:9
2 changes: 2 additions & 0 deletions src/test/ui/existential_types/existential_type_const.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/hygiene/generic_params.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(decl_macro, rustc_attrs, const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/hygiene/issue-61574-const-parameters.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/impl-trait-in-bindings.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui/impl-trait/bindings-opaque.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope
--> $DIR/bindings-opaque.rs:11:17
14 changes: 8 additions & 6 deletions src/test/ui/impl-trait/bindings.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
--> $DIR/bindings.rs:1:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^

error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/bindings.rs:5:29
|
@@ -28,6 +22,14 @@ error[E0435]: attempt to use a non-constant value in a constant
LL | const foo: impl Clone = x;
| ^ non-constant value

warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
--> $DIR/bindings.rs:1:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0435`.
2 changes: 2 additions & 0 deletions src/test/ui/impl-trait/bound-normalization-fail.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as impl_trait::Trait>::Assoc`
--> $DIR/bound-normalization-fail.rs:30:32
2 changes: 2 additions & 0 deletions src/test/ui/impl-trait/bound-normalization-pass.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the co
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

12 changes: 7 additions & 5 deletions src/test/ui/issues/issue-59508-1.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
error: lifetime parameters must be declared prior to type parameters
--> $DIR/issue-59508-1.rs:12:25
|
LL | pub fn do_things<T, 'a, 'b: 'a>() {
| ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>`

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/issue-59508-1.rs:2:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error: lifetime parameters must be declared prior to type parameters
--> $DIR/issue-59508-1.rs:12:25
|
LL | pub fn do_things<T, 'a, 'b: 'a>() {
| ----^^--^^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b: 'a, T>`
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

26 changes: 14 additions & 12 deletions src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
Original file line number Diff line number Diff line change
@@ -4,18 +4,6 @@ error: expected one of `,` or `>`, found `&&`
LL | true && let 1 = 1
| ^^ expected one of `,` or `>` here

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/disallowed-positions.rs:20:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

warning: the feature `let_chains` is incomplete and may cause the compiler to crash
--> $DIR/disallowed-positions.rs:22:12
|
LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
| ^^^^^^^^^^

error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:32:9
|
@@ -511,6 +499,20 @@ LL | true && let 1 = 1
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions

warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/disallowed-positions.rs:20:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

warning: the feature `let_chains` is incomplete and may cause the compiler to crash
--> $DIR/disallowed-positions.rs:22:12
|
LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
| ^^^^^^^^^^

error[E0308]: mismatched types
--> $DIR/disallowed-positions.rs:32:8
|
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: type arguments are not allowed for this type
--> $DIR/collections.rs:56:90
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/construct_with_other_type.rs:17:46
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37
2 changes: 2 additions & 0 deletions src/test/ui/rfc1598-generic-associated-types/iterable.stderr
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:11:47
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:17:27
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: type arguments are not allowed for this type
--> $DIR/pointer_family.rs:37:21
2 changes: 2 additions & 0 deletions src/test/ui/rfc1598-generic-associated-types/shadowing.stderr
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ warning: the feature `generic_associated_types` is incomplete and may cause the
|
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:18:41
2 changes: 1 addition & 1 deletion src/tools/rls
Submodule rls updated from 124483 to 70347b
2 changes: 1 addition & 1 deletion src/tools/rustfmt