Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
28db521
More implementations of Write for immutable refs
Sep 2, 2020
ec7f9b9
Deduplicates io::Write implementations
Sep 11, 2020
8f27e3c
Make some methods of `Pin` unstable const
CDirkx Sep 12, 2020
e5447a2
Fix #76432
simonvandel Sep 13, 2020
eede953
Only get ImplKind::Impl once
tesuji Sep 10, 2020
7e24136
Pass --target to lint docs
Mark-Simulacrum Sep 16, 2020
bd4e0af
Build rustdoc for cross-compiled targets
Mark-Simulacrum Sep 16, 2020
363aff0
Add test for x.py build cross-compilation
Mark-Simulacrum Sep 17, 2020
e3c6e46
Make some methods of `Pin<&mut T>` unstable const
CDirkx Sep 18, 2020
2a00dda
miri: correctly deal with `ConstKind::Bound`
lcnr Sep 10, 2020
6734230
do not ICE on `ty::Bound` in Layout::compute
lcnr Sep 11, 2020
65b3419
update stderr file
lcnr Sep 20, 2020
c690c82
use if let instead of single match arm expressions to compact code an…
matthiaskrgr Sep 18, 2020
88a29e6
Updates stability attributes to the current nightly version
Sep 21, 2020
0acb0ed
Update library/std/src/process.rs
FedericoPonzi Sep 21, 2020
60b102d
Don't recommend ManuallyDrop to customize drop order
matklad Aug 31, 2020
fe6fc55
Add a changelog for x.py
jyn514 Sep 12, 2020
b4b4a2f
Reduce boilerplate for BytePos and CharPos
Juici Sep 21, 2020
9a1f177
Remove cast to usize for BytePos and CharPos
Juici Sep 21, 2020
63195ec
Add explanation for E0756
GuillaumeGomez Sep 8, 2020
f5d71a9
Don't use `zip` to compare iterators during pretty-print hack
Aaron1011 Aug 30, 2020
40a5dc8
MIR pass to remove unneeded drops on types not needing drop
simonvandel Sep 13, 2020
e6942ae
Suggestion from review
simonvandel Sep 14, 2020
9b61fbc
Get LocalDefId from source instead of passing in
simonvandel Sep 19, 2020
d372455
The optimization should also apply for DropAndReplace
simonvandel Sep 19, 2020
1b2da2e
cleanup cfg after optimization
simonvandel Sep 19, 2020
dfb9f3a
rebless after rebase
simonvandel Sep 21, 2020
6be8212
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
Dylan-DPC Sep 22, 2020
e9aaa3b
Rollup merge of #76150 - matklad:droporder, r=withoutboats
Dylan-DPC Sep 22, 2020
b062780
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=…
Dylan-DPC Sep 22, 2020
b7a6aae
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
Dylan-DPC Sep 22, 2020
7a91e17
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
Dylan-DPC Sep 22, 2020
a65a244
Rollup merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum
Dylan-DPC Sep 22, 2020
4b4cfdd
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
Dylan-DPC Sep 22, 2020
8d641ce
Rollup merge of #76659 - simonvandel:76432, r=oli-obk
Dylan-DPC Sep 22, 2020
0e5bcba
Rollup merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk
Dylan-DPC Sep 22, 2020
5e46051
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
Dylan-DPC Sep 22, 2020
a282d1e
Rollup merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=al…
Dylan-DPC Sep 22, 2020
42b3303
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
Dylan-DPC Sep 22, 2020
b441d26
Rollup merge of #77022 - Juici:master, r=lcnr
Dylan-DPC Sep 22, 2020
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
miri: correctly deal with ConstKind::Bound
  • Loading branch information
lcnr committed Sep 20, 2020
commit 2a00dda90258576e3adf5ecae0437a8fe6fadbcf
6 changes: 2 additions & 4 deletions compiler/rustc_mir/src/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
};
// Early-return cases.
let val_val = match val.val {
ty::ConstKind::Param(_) => throw_inval!(TooGeneric),
ty::ConstKind::Param(_) | ty::ConstKind::Bound(..) => throw_inval!(TooGeneric),
ty::ConstKind::Error(_) => throw_inval!(TypeckError(ErrorReported)),
ty::ConstKind::Unevaluated(def, substs, promoted) => {
let instance = self.resolve(def.did, substs)?;
Expand All @@ -561,9 +561,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// happening.
return Ok(self.const_eval(GlobalId { instance, promoted }, val.ty)?);
}
ty::ConstKind::Infer(..)
| ty::ConstKind::Bound(..)
| ty::ConstKind::Placeholder(..) => {
ty::ConstKind::Infer(..) | ty::ConstKind::Placeholder(..) => {
span_bug!(self.cur_span(), "const_to_op: Unexpected ConstKind {:?}", val)
}
ty::ConstKind::Value(val_val) => val_val,
Expand Down
20 changes: 20 additions & 0 deletions src/test/ui/const-generics/issues/issue-73260.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// compile-flags: -Zsave-analysis

#![feature(const_generics)]
#![allow(incomplete_features)]
struct Arr<const N: usize>
where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~ ERROR constant expression
{
}

enum Assert<const CHECK: bool> {}

trait IsTrue {}

impl IsTrue for Assert<true> {}

fn main() {
let x: Arr<{usize::max_value()}> = Arr {};
//~^ ERROR mismatched types
//~| ERROR mismatched types
}
29 changes: 29 additions & 0 deletions src/test/ui/const-generics/issues/issue-73260.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-73260.rs:6:47
|
LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,
| ^^^^^^
|
= note: this may fail depending on what value the parameter takes

error[E0308]: mismatched types
--> $DIR/issue-73260.rs:17:12
|
LL | let x: Arr<{usize::max_value()}> = Arr {};
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true`
|
= note: expected type `false`
found type `true`

error[E0308]: mismatched types
--> $DIR/issue-73260.rs:17:40
|
LL | let x: Arr<{usize::max_value()}> = Arr {};
| ^^^ expected `false`, found `true`
|
= note: expected type `false`
found type `true`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
27 changes: 27 additions & 0 deletions src/test/ui/const-generics/issues/issue-74634.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#![feature(const_generics)]
#![allow(incomplete_features)]

trait If<const COND: bool> {}
impl If<true> for () {}

trait IsZero<const N: u8> {
type Answer;
}

struct True;
struct False;

impl<const N: u8> IsZero<N> for ()
where (): If<{N == 0}> { //~ERROR constant expression
type Answer = True;
}

trait Foobar<const N: u8> {}

impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = True> {}

impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = False> {}

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/const-generics/issues/issue-74634.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-74634.rs:15:11
|
LL | where (): If<{N == 0}> {
| ^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes

error: aborting due to previous error