| Age | Commit message (Collapse) | Author | Lines |
|
`as_local_node_id`, instead just compare against `Some(id)`.
Fixes #29161.
|
|
Change error reporting of conflicting loans to stop earlier after printing
an error for a given borrow, instead of proceeding to error on possibly every
issued loan. This keeps us down to O(n) errors (for n problem lines), instead
of O(n^2) errors in some cases.
Fixes #27485.
|
|
Fixes #21546.
|
|
this has the funky side-effect of also allowing constant evaluation of function calls to functions that are not `const fn` as long as `check_const` didn't mark that function `NOT_CONST`
It's still not possible to call a normal function from a `const fn`, but let statements' initialization value can get const evaluated (this caused the fallout in the overflowing tests)
we can now do this:
```rust
const fn add(x: usize, y: usize) -> usize { x + y }
const ARR: [i32; add(1, 2)] = [5, 6, 7];
```
also added a test for destructuring in const fn args
```rust
const fn i((a, b): (u32, u32)) -> u32 { a + b } //~ ERROR: E0022
```
This is a **[breaking change]**, since it turns some runtime panics into compile-time errors. This statement is true for ANY improvement to the const evaluator.
|
|
Fix #24114.
|
|
These commits revert https://github.com/rust-lang/rust/pull/28504 and add a regression test pointed out by @petrochenkov, it's not immediately clear with the regression that the accessibility check should be removed, so for now preserve the behavior on stable by default.
r? @nrc
|
|
r=nikomatsakis
This PR switches the implemented ordering from `unsafe const fn` (as was in the original RFC) to `const unsafe fn` (which is what the lang team decided on)
|
|
|
|
This reverts commit b3e1aca40f889a565bfa2607b82b80fe7cbcefea.
|
|
|
|
Closes #22781.
Closes #23891.
Closes #24956.
Closes #25145.
Closes #25693.
Closes #26095.
Closes #26459.
Closes #27320.
Closes #27895.
|
|
Closes #22781.
Closes #23891.
Closes #24956.
Closes #25145.
Closes #25693.
Closes #26095.
Closes #26459.
Closes #27320.
Closes #27895.
|
|
None
|
|
|
|
(fixes #26886)
|
|
This is a [breaking-change]:lang, but the broken code does not make
much sense.
Fixes #26056
|
|
Fixes #29184
This adds an error message for the use of the reserved `typeof` keyword, instead of reporting an ICE.
Also adds a `compile-fail` test.
I chose to add a `span_err` instead of removing to parser code, as to preserve the reservation of `typeof`.
|
|
This adds error E0516
fixing a type pointed out by @jonas-schievink
|
|
Currently it is possible to do the following:
- define a module named `Foo` and then a unit or tuple struct also named `Foo`
- define any struct named `Foo` and then a module named `Foo`
This commit introduces a warning for both of these cases.
|
|
Fixes #29181
|
|
|
|
This PR turns statically known erroneous code (e.g. numeric overflow) into a warning and continues normal code-generation to emit the same code that would have been generated without `check_const` detecting that the result can be computed at compile-time.
<del>It's not done yet, as I don't know how to properly emit a lint from trans. I can't seem to extract the real lint level of the item the erroneous expression is in.</del> It's an unconditional warning now.
r? @pnkfelix
cc @nikomatsakis
* [RFC 1229 text](https://github.com/rust-lang/rfcs/blob/master/text/1229-compile-time-asserts.md)
* RFC PR: rust-lang/rfcs#1229
* tracking issue: https://github.com/rust-lang/rust/issues/28238
|
|
this PR adds notes for missing `PartialEq` and `PartialOrd`. I've added a test case but it seems like `NOTE` is ignored by the test runner.
#28837
|
|
Fixes #29037.
Fixes #29106.
r? @pnkfelix
CC @Gankro
|
|
This change has two consequences:
1. It makes `Arc<T>` and `Rc<T>` covariant in `T`.
2. It causes the compiler to reject code that was unsound with respect
to dropck. See compile-fail/issue-29106.rs for an example of code that
no longer compiles. Because of this, this is a [breaking-change].
Fixes #29037.
Fixes #29106.
|
|
Stricter checking of stability attributes + enforcement of their invariants at compile time
(+ removed dead file librustc_front/attr.rs)
I intended to enforce use of `reason` for unstable items as well (it normally presents for new items), but it turned out too intrusive, many older unstable items don't have `reason`s.
r? @aturon
I'm studying how stability works and do some refactoring along the way, so it's probably not the last PR.
|
|
cc @nagisa
|
|
|
|
This is a [breaking change].
@brson could you do a Crater run with this PR please?
Lets not land till Crater says its OK.
This was discussed at https://internals.rust-lang.org/t/does-anyone-use-the-push-pop-unsafe-macros/2702
|
|
This is the original test implementation, which works according to the tests I wrote, but might need a review.
|
|
const eval errors outside of true constant enviroments are not reported anymore, but instead forwarded to a lint.
|
|
|
|
|
|
|
|
|
|
|
|
Stricter checking + enforcement of invariants at compile time
|
|
|
|
This is a [breaking change].
|
|
"Crate features" isn't a thing in Rust, but you do need to add this line
to your crate root.
Fixes #28944
|
|
"Crate features" isn't a thing in Rust, but you do need to add this line
to your crate root.
Fixes #28944
|
|
Previously, `/**/` was incorrectly regarded as a doc comment because it starts with `/**` and ends with `*/`. However, this caused an ICE because some code assumed that the length of a doc comment is at least 5. This commit adds an additional check to `is_block_doc_comment` that tests the length of the input.
Fixes #28844.
|
|
implement RFC 1238: nonparametric dropck.
cc #28498
cc @nikomatsakis
|
|
|
|
Previously, `/**/` was incorrectly regarded as a doc comment because it
starts with `/**` and ends with `*/`. However, this caused an ICE
because some code assumed that the length of a doc comment is at least
5. This commit adds an additional check to `is_block_doc_comment` that
tests the length of the input.
Fixes #28844.
|
|
cut-and-pasted into it.
|
|
r? @nikomatsakis
|
|
|
|
and some unrelated test cleanups
|
|
|