| Age | Commit message (Collapse) | Author | Lines |
|
Rollup of 6 pull requests
Successful merges:
- #100211 (Refuse to codegen an upstream static.)
- #100277 (Simplify format_args builtin macro implementation.)
- #100483 (Point to generic or arg if it's the self type of unsatisfied projection predicate)
- #100506 (change `InlineAsmCtxt` to not talk about `FnCtxt`)
- #100534 (Make code slightly more uniform)
- #100566 (Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Point to generic or arg if it's the self type of unsatisfied projection predicate
We do this for `TraitPredicate`s in `point_at_type_arg_instead_of_call_if_possible` and `point_at_arg_instead_of_call_if_possible`, so also do it for `ProjectionPredicate`.
Improves spans for a lot of unit tests.
|
|
|
|
Visit attributes in more places.
This adds 3 loosely related changes (I can split PRs if desired):
- Attribute checking on pattern struct fields.
- Attribute checking on struct expression fields.
- Lint level visiting on pattern struct fields, struct expression fields, and generic parameters.
There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
|
|
|
|
|
|
|
|
|
|
|
|
Add tests for the drop behavior of some control flow constructs
In #100513 it was shown that the drop behaviour of let_chains is not correct currently. Since drop behaviour is something pretty subtle, this adds explicit tests for the drop behavior of `if`, `if let` and `match` to make sure that it does not regress in the future.
The `println!`s were left in to make debugging easier in case something goes wrong, but they are not required for the test.
|
|
Recover from mutable variable declaration where `mut` is placed before `let`
Closes #100197
|
|
In #100513 it was shown that the drop behavior of let_chains is not correct
currently. Since drop behavior is something pretty subtle, this adds
explicit tests for the drop behavior of `if`, `if let` and `match` to
make sure that it does not regress in the future.
The `println!`s were left in to make debugging easier in case something
goes wrong, but they are not required for the test.
|
|
`assert_{inhabited,zero_valid,uninit_valid}` intrinsics are safe
Those intrinsics either panic or do nothing. They are safe.
|
|
Suggest removing `let` if `const let` or `let const` is used
Closes #99910
|
|
orphan check: rationalize our handling of constants
cc `@rust-lang/types` `@rust-lang/project-const-generics` on whether you agree with this reasoning.
r? types
|
|
Delay a span bug if we see ty/const generic params during writeback
Fixes #99566
|
|
|
|
|
|
r=lcnr
Argument type error improvements
Motivated by this interesting code snippet:
```rust
#[derive(Copy, Clone)]
struct Wrapper<T>(T);
fn foo(_: fn(i32), _: Wrapper<i32>) {}
fn f(_: u32) {}
fn main() {
let w = Wrapper::<isize>(1isize);
foo(f, w);
}
```
Which currently errors like:
```
error[E0308]: arguments to this function are incorrect
--> src/main.rs:10:5
|
10 | foo(f, w);
| ^^^ - - expected `i32`, found `isize`
| |
| expected `i32`, found `u32`
|
= note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}`
= note: expected struct `Wrapper<i32>`
found struct `Wrapper<isize>`
note: function defined here
--> src/main.rs:4:4
|
4 | fn foo(_: fn(i32), _: Wrapper<i32>) {}
| ^^^ ---------- ---------------
```
Specifically, that double `expected .. found ..` which is very difficult to correlate to the types in the arguments. Also, the fact that "expected `i32`, found `isize`" and the other argument mismatch label don't even really explain what's going on here.
After this PR:
```
error[E0308]: arguments to this function are incorrect
--> $DIR/two-mismatch-notes.rs:10:5
|
LL | foo(f, w);
| ^^^
|
note: expected fn pointer, found fn item
--> $DIR/two-mismatch-notes.rs:10:9
|
LL | foo(f, w);
| ^
= note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}`
note: expected struct `Wrapper`, found a different struct `Wrapper`
--> $DIR/two-mismatch-notes.rs:10:12
|
LL | foo(f, w);
| ^
= note: expected struct `Wrapper<i32>`
found struct `Wrapper<isize>`
note: function defined here
--> $DIR/two-mismatch-notes.rs:4:4
|
LL | fn foo(_: fn(i32), _: Wrapper<i32>) {}
| ^^^ ---------- ---------------
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
```
Yeah, it's a bit verbose, but much clearer IMO.
---
Open to discussions about how this could be further improved. Motivated by `@jyn514's` [tweet](https://mobile.twitter.com/joshuayn514/status/1558042020601634816) here.
|
|
TaKO8Ki:suggest-removing-semicolon-after-impl-trait-items, r=compiler-errors
Suggest removing a semicolon after impl/trait items
fixes #99822
|
|
Enum variant ctor inherits the stability of the enum variant
Fixes #100399
Fixes #100420
Context #71481 for why enum variants don't need stability
|
|
Suggest the path separator when a dot is used on a trait
Fixes #100365.
`@rustbot` label A-diagnostics
r? diagnostics
|
|
r=estebank
Only point out a single function parameter if we have a single arg incompatibility
Fixes #99635
|
|
to other malformed impls
|
|
r=compiler-errors
merge two test directories that mean the same thing
hopefully `hrtb` doesnt have a secret second meaning that i'm not aware of :laughing:
r? `@compiler-errors`
|
|
Give a helpful diagnostic when the next struct field has an attribute
Fixes #100461
|
|
adapt test for msan message change
LLVM commit https://github.com/llvm/llvm-project/commit/057cabd997aeaef136e1e14f2ee645bd5bb197dd removed the function from the msan error message. This adapts our test accordingly.
Found via our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db
|
|
Erase regions better in `promote_candidate`
Use `tcx.erase_regions` instead of manually walking through the substs.... this also makes the code slightly simpler :see_no_evil:
Fixes #100360
Fixes #89851
|
|
Fix HIR pretty printing of let else
Fixes #100373
Fixes #99318
Fixes #99319
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Those intrinsics either panic or do nothing. They are safe.
|
|
|
|
|
|
|
|
|
|
|
|
Add two let else regression tests
Adds a regression test for #94176, as it was fixed by #98574 but doesn't have a regression test. The PR also incorporates a commit from #94012 which added a test for an issue discovered in that PR.
Originally they have been part of #99291, but I've moved them out in the hopes of getting them merged more quickly, as that PR is already open since a month, and so that #99291 can focus on the drop order part of things.
Closes #94176
Closes #96961 -- dupe of #94176
|
|
Suggest const and static for global variable
Fixing #100394
|
|
Generalize trait object generic param check to aliases.
The current algorithm only checks that `Self` does not appear in defaults for traits. This is not sufficient for trait aliases.
This PR moves the check to trait object elaboration, which sees through trait aliases.
Fixes https://github.com/rust-lang/rust/issues/82927.
Fixes https://github.com/rust-lang/rust/issues/84789.
|
|
add -Zextra-const-ub-checks to enable more UB checking in const-eval
Cc https://github.com/rust-lang/rust/issues/99923
r? `@oli-obk`
|
|
Closes #95795
|
|
|
|
LLVM commit https://github.com/llvm/llvm-project/commit/057cabd997aeaef136e1e14f2ee645bd5bb197dd removed the function from the msan error message. This adapts our test accordingly.
Found via our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db
|
|
|