Commit Graph

2120 Commits

Author SHA1 Message Date
Tomasz Miąsko
f9b8191282 Remove implementation of min_align_of intrinsic
Since 88839 `min_align_of` is lowered to AlignOf operator.
2021-09-14 13:58:35 +02:00
Tomasz Miąsko
e84996bd7f Avoid unnecessary formatting when trace log level is disabled 2021-09-14 13:51:22 +02:00
Waffle
6ec7255d7b Highlight the const function if error happened because of a bound on the impl block
Currently, for the following code, the compiler produces the errors like the
following error:
```rust
struct Type<T>

impl<T: Clone> Type<T> {
	fn const f() {}
}
```
```text
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
 --> ./test.rs:3:6
  |
3 | impl<T: Clone> Type<T> {
  |      ^
  |
  = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
  = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
```

This can be confusing (especially to newcomers) since the error mentions
"const fn parameters", but highlights only the impl.

This commits adds function highlighting, changing the error to the following:

```text
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
 --> ./test.rs:3:6
  |
3 | impl<T: Clone> Type<T> {
  |      ^
4 |     pub const fn f() {}
  |     ---------------- function declared as const here
  |
  = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
  = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
```
2021-09-13 16:36:14 +03:00
bors
96dee2825e Auto merge of #88839 - nbdd0121:alignof, r=nagisa
Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-12 23:49:24 +00:00
Gary Guo
1c3409f333 Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
Andreas Liljeqvist
dd34e0c966 Rename (un)signed to (un)signed_int 2021-09-09 10:41:19 +02:00
Andreas Liljeqvist
9129f4306f Move unsigned_max etc into Size again 2021-09-09 10:41:19 +02:00
Andreas Liljeqvist
459c9108e4 Remove clone 2021-09-09 10:41:19 +02:00
Andreas Liljeqvist
5b2f757dae Make abi::Abi Copy and remove a *lot* of refs
fix

fix

Remove more refs and clones

fix

more

fix
2021-09-09 10:41:19 +02:00
Andreas Liljeqvist
05cd48b008 Add methods for checking for full ranges to Scalar and WrappingRange
Move *_max methods back to util

change to inline instead of inline(always)

Remove valid_range_exclusive from scalar
Use WrappingRange instead

implement always_valid_for in a safer way

Fix accidental edit
2021-09-09 10:41:17 +02:00
Deadbeef
146abdd119
Add another test case + fmt 2021-09-09 05:21:33 +00:00
Deadbeef
49ac725d51
fix precise live drops 2021-09-09 05:21:33 +00:00
Deadbeef
122e91e330
do not require lang item 2021-09-09 05:21:32 +00:00
Deadbeef
1ca83c6451
Use trait select logic instead of query 2021-09-09 05:21:32 +00:00
Deadbeef
48a3ba9a33
fmt 2021-09-09 05:21:30 +00:00
Deadbeef
104e40fb74
Const dropping 2021-09-09 05:21:29 +00:00
Deadbeef
d9797d23d5
Remove unused query 2021-09-09 05:21:28 +00:00
Mark Rousskov
b4e7649d6d Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
Camille GILLOT
924dbc36c9 Rebase fallout. 2021-09-08 20:40:30 +02:00
Camille GILLOT
c5fc2609f0 Rename rustc_mir to rustc_const_eval. 2021-09-07 20:46:26 +02:00