Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3c235d5

Browse files
committedMay 20, 2019
Auto merge of rust-lang#60974 - pietroalbini:stable-next, r=pietroalbini
[stable] Rust 1.35.0 stable release This also cherry-picks this beta backport: * rust-lang#60710: Use `delay_span_bug` for error cases when checking `AnonConst` parent r? @ghost cc @Mark-Simulacrum @rust-lang/release
2 parents 02b0ca3 + d53e435 commit 3c235d5

6 files changed

+88
-4
lines changed
 

‎src/ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fi
4343
#
4444
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
4545
# either automatically or manually.
46-
export RUST_RELEASE_CHANNEL=beta
46+
export RUST_RELEASE_CHANNEL=stable
4747
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
4848
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
4949
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"

‎src/librustc_typeck/collect.rs

+21-3
Original file line numberDiff line numberDiff line change
@@ -1403,15 +1403,27 @@ pub fn checked_type_of<'a, 'tcx>(
14031403
if !fail {
14041404
return None;
14051405
}
1406-
bug!("unexpected const parent path def {:?}", x);
1406+
tcx.sess.delay_span_bug(
1407+
DUMMY_SP,
1408+
&format!(
1409+
"unexpected const parent path def {:?}", x
1410+
),
1411+
);
1412+
tcx.types.err
14071413
}
14081414
}
14091415
}
14101416
x => {
14111417
if !fail {
14121418
return None;
14131419
}
1414-
bug!("unexpected const parent path {:?}", x);
1420+
tcx.sess.delay_span_bug(
1421+
DUMMY_SP,
1422+
&format!(
1423+
"unexpected const parent path {:?}", x
1424+
),
1425+
);
1426+
tcx.types.err
14151427
}
14161428
}
14171429
}
@@ -1420,7 +1432,13 @@ pub fn checked_type_of<'a, 'tcx>(
14201432
if !fail {
14211433
return None;
14221434
}
1423-
bug!("unexpected const parent in type_of_def_id(): {:?}", x);
1435+
tcx.sess.delay_span_bug(
1436+
DUMMY_SP,
1437+
&format!(
1438+
"unexpected const parent in type_of_def_id(): {:?}", x
1439+
),
1440+
);
1441+
tcx.types.err
14241442
}
14251443
}
14261444
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// The test is failing on 1.35.0 stable but that's not important since the ICE happens only with
2+
// the feature gate enabled, thus it doesn't affect stable.
3+
// https://github.com/rust-lang/rust/pull/60710#issuecomment-493662676
4+
//
5+
// ignore-test
6+
7+
#![feature(const_generics)]
8+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
9+
10+
// We should probably be able to infer the types here. However, this test is checking that we don't
11+
// get an ICE in this case. It may be modified later to not be an error.
12+
13+
struct Foo<const NUM_BYTES: usize>(pub [u8; NUM_BYTES]);
14+
15+
fn main() {
16+
let _ = Foo::<3>([1, 2, 3]); //~ ERROR type annotations needed
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/cannot-infer-type-for-const-param.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error[E0282]: type annotations needed
8+
--> $DIR/cannot-infer-type-for-const-param.rs:10:19
9+
|
10+
LL | let _ = Foo::<3>([1, 2, 3]);
11+
| ^ cannot infer type for `{integer}`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0282`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use std::convert::TryInto;
2+
3+
struct S;
4+
5+
fn main() {
6+
let _: u32 = 5i32.try_into::<32>().unwrap(); //~ ERROR wrong number of const arguments
7+
S.f::<0>(); //~ ERROR no method named `f`
8+
S::<0>; //~ ERROR wrong number of const arguments
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0107]: wrong number of const arguments: expected 0, found 1
2+
--> $DIR/invalid-const-arg-for-type-param.rs:6:34
3+
|
4+
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
5+
| ^^ unexpected const argument
6+
7+
error[E0599]: no method named `f` found for type `S` in the current scope
8+
--> $DIR/invalid-const-arg-for-type-param.rs:7:7
9+
|
10+
LL | struct S;
11+
| --------- method `f` not found for this
12+
...
13+
LL | S.f::<0>();
14+
| ^
15+
16+
error[E0107]: wrong number of const arguments: expected 0, found 1
17+
--> $DIR/invalid-const-arg-for-type-param.rs:8:9
18+
|
19+
LL | S::<0>;
20+
| ^ unexpected const argument
21+
22+
error: aborting due to 3 previous errors
23+
24+
Some errors occurred: E0107, E0599.
25+
For more information about an error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)
Failed to load comments.