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 11 pull requests #68587

Merged
merged 23 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6590339
Clean up E0205 explanation
GuillaumeGomez Jan 20, 2020
94fcda0
clean up E0214 explanation
GuillaumeGomez Jan 22, 2020
3850d96
clean up error codes explanation
GuillaumeGomez Jan 23, 2020
0f5ed4d
Clean up E0207 explanation
GuillaumeGomez Jan 21, 2020
9ad1a8c
Don't call `tcx.fn_sig` on closures
Aaron1011 Jan 27, 2020
833ffd7
Update src/librustc_error_codes/error_codes/E0220.md
GuillaumeGomez Jan 27, 2020
b0174ec
Fix LLVM assertion failure in MSP430 interrupt generation.
cr1901 Jan 27, 2020
de7f16d
check_match: extract common logic
Centril Jan 23, 2020
4b0fe2a
Clean up E0262 explanation
GuillaumeGomez Jan 27, 2020
2a38eb3
Disable the testcase for Vxworks.
Jan 6, 2020
3124603
Add support for icebreakers-cleanup-crew commands
spastorino Jan 27, 2020
2c07a62
stabilize the debug_map_key_value feature
KodrAus Jan 14, 2020
5c42ffe
Rollup merge of #68200 - KodrAus:stabilize/debug_map_key_value, r=ale…
JohnTitor Jan 28, 2020
2bfa058
Rollup merge of #68383 - GuillaumeGomez:clean-up-e0205, r=Dylan-DPC
JohnTitor Jan 28, 2020
dc33cd3
Rollup merge of #68412 - GuillaumeGomez:clean-up-e0207, r=Dylan-DPC
JohnTitor Jan 28, 2020
39407c9
Rollup merge of #68454 - GuillaumeGomez:clean-up-e0214, r=Dylan-DPC
JohnTitor Jan 28, 2020
8ed5865
Rollup merge of #68482 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
JohnTitor Jan 28, 2020
c38e97c
Rollup merge of #68563 - Aaron1011:fix/fn-sig-closure, r=varkor
JohnTitor Jan 28, 2020
1e47ca5
Rollup merge of #68570 - cr1901:msp430-fix-1-2020, r=alexcrichton
JohnTitor Jan 28, 2020
8bc0e48
Rollup merge of #68571 - Centril:check_in_cx, r=oli-obk
JohnTitor Jan 28, 2020
ee79cf2
Rollup merge of #68573 - GuillaumeGomez:clean-up-e0262, r=Dylan-DPC
JohnTitor Jan 28, 2020
41110ed
Rollup merge of #68575 - Wind-River:master_2020, r=alexcrichton
JohnTitor Jan 28, 2020
aac5788
Rollup merge of #68581 - spastorino:support-ice-breaker-cleanup-crew,…
JohnTitor Jan 28, 2020
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

This file was deleted.

6 changes: 2 additions & 4 deletions src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// # Examples
///
/// ```
/// # #![feature(debug_map_key_value)]
/// use std::fmt;
///
/// struct Foo(Vec<(String, i32)>);
Expand All @@ -796,7 +795,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
/// );
/// ```
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
assert!(
Expand Down Expand Up @@ -843,7 +842,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// # Examples
///
/// ```
/// # #![feature(debug_map_key_value)]
/// use std::fmt;
///
/// struct Foo(Vec<(String, i32)>);
Expand All @@ -861,7 +859,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
/// );
/// ```
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
assert!(self.has_key, "attempted to format a map value before its key");
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(cell_update)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
#![feature(debug_map_key_value)]
#![feature(debug_non_exhaustive)]
#![feature(dec2flt)]
#![feature(exact_size_is_empty)]
Expand Down
16 changes: 11 additions & 5 deletions src/librustc_error_codes/error_codes/E0206.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
You can only implement `Copy` for a struct or enum. Both of the following
examples will fail, because neither `[u8; 256]` nor `&'static mut Bar`
(mutable reference to `Bar`) is a struct or enum:
The `Copy` trait was implemented on a type which is neither a struct nor an
enum.

Erroneous code example:

```compile_fail,E0206
type Foo = [u8; 256];
impl Copy for Foo { } // error
impl Copy for Foo { } // error!

#[derive(Copy, Clone)]
struct Bar;
impl Copy for &'static mut Bar { } // error

impl Copy for &'static mut Bar { } // error!
```

You can only implement `Copy` for a struct or an enum. Both of the previous
examples will fail, because neither `[u8; 256]` nor `&'static mut Bar`
(mutable reference to `Bar`) is a struct or enum.
30 changes: 17 additions & 13 deletions src/librustc_error_codes/error_codes/E0207.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
A type or lifetime parameter that is specified for `impl` is not constrained.

Erroneous code example:

```compile_fail,E0207
struct Foo;

impl<T: Default> Foo {
// error: the type parameter `T` is not constrained by the impl trait, self
// type, or predicates [E0207]
fn get(&self) -> T {
<T as Default>::default()
}
}
```

Any type parameter or lifetime parameter of an `impl` must meet at least one of
the following criteria:

Expand All @@ -10,19 +26,7 @@ the following criteria:
### Error example 1

Suppose we have a struct `Foo` and we would like to define some methods for it.
The following definition leads to a compiler error:

```compile_fail,E0207
struct Foo;

impl<T: Default> Foo {
// error: the type parameter `T` is not constrained by the impl trait, self
// type, or predicates [E0207]
fn get(&self) -> T {
<T as Default>::default()
}
}
```
The previous code example has a definition which leads to a compiler error:

The problem is that the parameter `T` does not appear in the implementing type
(`Foo`) of the impl. In this case, we can fix the error by moving the type
Expand Down
13 changes: 9 additions & 4 deletions src/librustc_error_codes/error_codes/E0214.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
A generic type was described using parentheses rather than angle brackets.
For example:

Erroneous code example:

```compile_fail,E0214
fn main() {
let v: Vec(&str) = vec!["foo"];
}
let v: Vec(&str) = vec!["foo"];
```

This is not currently supported: `v` should be defined as `Vec<&str>`.
Parentheses are currently only used with generic types when defining parameters
for `Fn`-family traits.

The previous code example fixed:

```
let v: Vec<&str> = vec!["foo"];
```
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0220.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
You used an associated type which isn't defined in the trait.
The associated type used was not defined in the trait.

Erroneous code example:

```compile_fail,E0220
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0221.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
An attempt was made to retrieve an associated type, but the type was ambiguous.
For example:

Erroneous code example:

```compile_fail,E0221
trait T1 {}
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0222.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
An attempt was made to constrain an associated type.
For example:

Erroneous code example:

```compile_fail,E0222
pub trait Vehicle {
Expand Down
10 changes: 7 additions & 3 deletions src/librustc_error_codes/error_codes/E0262.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Declaring certain lifetime names in parameters is disallowed. For example,
because the `'static` lifetime is a special built-in lifetime name denoting
the lifetime of the entire program, this is an error:
An invalid name was used for a lifetime parameter.

Erroneous code example:

```compile_fail,E0262
// error, invalid lifetime parameter name `'static`
fn foo<'static>(x: &'static str) { }
```

Declaring certain lifetime names in parameters is disallowed. For example,
because the `'static` lifetime is a special built-in lifetime name denoting
the lifetime of the entire program, this is an error:
4 changes: 4 additions & 0 deletions src/librustc_mir/const_eval/fn_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ pub fn provide(providers: &mut Providers<'_>) {
/// Const evaluability whitelist is here to check evaluability at the
/// top level beforehand.
fn is_const_intrinsic(tcx: TyCtxt<'_>, def_id: DefId) -> Option<bool> {
if tcx.is_closure(def_id) {
return None;
}

match tcx.fn_sig(def_id).abi() {
Abi::RustIntrinsic | Abi::PlatformIntrinsic => {
Some(tcx.lookup_const_stability(def_id).is_some())
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/hair/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
module: DefId,
f: impl for<'b> FnOnce(MatchCheckCtxt<'b, 'tcx>) -> R,
f: impl FnOnce(MatchCheckCtxt<'_, 'tcx>) -> R,
) -> R {
let pattern_arena = TypedArena::default();

Expand Down
11 changes: 7 additions & 4 deletions src/librustc_mir_build/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
(pattern, pattern_ty)
}

fn check_in_cx(&self, hir_id: HirId, f: impl FnOnce(MatchCheckCtxt<'_, 'tcx>)) {
let module = self.tcx.hir().get_module_parent(hir_id);
MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |cx| f(cx));
}

fn check_match(
&mut self,
scrut: &hir::Expr<'_>,
Expand All @@ -151,8 +156,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
self.check_patterns(arm.guard.is_some(), &arm.pat);
}

let module = self.tcx.hir().get_module_parent(scrut.hir_id);
MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| {
self.check_in_cx(scrut.hir_id, |ref mut cx| {
let mut have_errors = false;

let inlined_arms: Vec<_> = arms
Expand Down Expand Up @@ -180,8 +184,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
}

fn check_irrefutable(&self, pat: &'tcx Pat<'tcx>, origin: &str, sp: Option<Span>) {
let module = self.tcx.hir().get_module_parent(pat.hir_id);
MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| {
self.check_in_cx(pat.hir_id, |ref mut cx| {
let (pattern, pattern_ty) = self.lower_pattern(cx, pat, &mut false);
let pats: Matrix<'_, '_> = vec![PatStack::from_pattern(pattern)].into_iter().collect();

Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/consts/issue-68542-closure-in-array-len.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Regression test for issue #68542
// Tests that we don't ICE when a closure appears
// in the length part of an array.

struct Bug {
a: [(); (|| { 0 })()] //~ ERROR calls in constants are limited to
//~^ ERROR evaluation of constant value failed
}

fn main() {}
16 changes: 16 additions & 0 deletions src/test/ui/consts/issue-68542-closure-in-array-len.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
LL | a: [(); (|| { 0 })()]
| ^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
LL | a: [(); (|| { 0 })()]
| ^^^^^^^^^^^^ calling non-const function `Bug::a::{{constant}}#0::{{closure}}#0`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0015, E0080.
For more information about an error, try `rustc --explain E0015`.
1 change: 1 addition & 0 deletions src/test/ui/env-funky-keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ignore-cloudabi no execve
// ignore-emscripten no execve
// ignore-sgx no execve
// ignore-vxworks no execve
// no-prefer-dynamic

#![feature(rustc_private)]
Expand Down
11 changes: 11 additions & 0 deletions triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ Thanks! <3
[instructions]: https://rust-lang.github.io/rustc-guide/ice-breaker/llvm.html
"""
label = "ICEBreaker-LLVM"

[ping.icebreakers-cleanup-crew]
message = """\
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
"Cleanup ICE-breaking candidate". In case it's useful, here are some
[instructions] for tackling these sorts of bugs. Maybe take a look?
Thanks! <3

[instructions]: https://rust-lang.github.io/rustc-guide/ice-breaker/cleanup-crew.html
"""
label = "ICEBreaker-Cleanup-Crew"