Commit Graph

1827 Commits

Author SHA1 Message Date
Maybe Waffle
a8f7e244b7 Refactor rustc lint API 2022-10-01 10:03:06 +00:00
Matthias Krüger
842a7d34f5
Rollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot
Don't lower assoc bindings just to deny them

Some clean-up: https://github.com/rust-lang/rust/pull/102338#discussion_r981590931
2022-09-30 23:38:26 +02:00
Boxy
c1a9cf42b4 make query take (LocalDefId, DefId) 2022-09-30 18:53:32 +01:00
Boxy
86a8a3beb4 make compare_const_impl a query and use it in instance.rs 2022-09-30 17:47:44 +01:00
Michael Goulet
85a726e754 Remove expr_parentheses_needed from ParseSess 2022-09-30 01:39:20 +00:00
bors
1bb8d276c9 Auto merge of #101887 - nnethercote:shrink-Res, r=spastorino
Shrink `hir::def::Res`

r? `@spastorino`
2022-09-29 22:45:24 +00:00
Michael Goulet
3722ad4c26 Don't lower assoc bindings just to deny them 2022-09-29 22:44:43 +00:00
Michael Howell
98075708dd
Rollup merge of #102476 - oli-obk:split_error_path, r=cjgillot
Split out the error reporting logic into a separate function

I was trying to read the function and got distracted by the huge block of code in the middle of it. Turns out it only reports diagnostics and all paths within it end in an error. The main function is now more readable imo.
2022-09-29 10:15:20 -07:00
Oli Scherer
aa3fbf8795 Split out the error reporting logic into a separate function 2022-09-29 14:29:36 +00:00
bors
65445a571c Auto merge of #102471 - Dylan-DPC:rollup-ij3okjt, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #102336 (Fix associated type bindings with anon const in GAT position)
 - #102342 (Add negation methods for signed non-zero integers.)
 - #102385 (Don't export `__heap_base` and `__data_end` on wasm32-wasi.)
 - #102435 (Improve example of Iterator::reduce)
 - #102436 (rustdoc: clean up "normalize.css 8" input override CSS)
 - #102452 (fix minor ungrammatical sentence)
 - #102455 (Use let-chaining in `WhileTrue::check_expr`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-29 13:27:28 +00:00
Dylan DPC
1be9ec5443
Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726
Fix associated type bindings with anon const in GAT position

The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs.

Fixes #102333
2022-09-29 18:13:19 +05:30
Oli Scherer
6367e69929 Split collect.rs 2022-09-29 09:31:46 +00:00
Nicholas Nethercote
f07d4efc45 Shrink hir::def::Res.
`Res::SelfTy` currently has two `Option`s. When the second one is `Some`
the first one is never consulted. So we can split it into two variants,
`Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res`
from 24 bytes to 12. This then shrinks `hir::Path` and
`hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-29 08:44:52 +10:00
bors
ce7f0f1aa0 Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser
Add `#[rustc_safe_intrinsic]`

This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.
2022-09-28 19:07:50 +00:00
bors
307dd938d7 Auto merge of #101454 - cjgillot:concat-binders, r=estebank
Do not overwrite lifetime binders for another HirId.

This PR makes higher-ranked bounds in where clauses a bit more principled.
We used to conflate `for<'a> T: Trait` with `(for<'a> T): Trait`.
This PR separates both binders.

This caused issued with fn types, which have their own binder, causing us to overwrite the predicates's binders with `fn`'s binders, ICEing.

Fixes https://github.com/rust-lang/rust/issues/98594
2022-09-28 14:42:55 +00:00
Arthur Cohen
37bf8f888c rustc_safe_intrinsic: Keep list of safe intrinsics within the compiler 2022-09-28 09:40:02 +02:00
Yuki Okushi
b263b7e64c
Rollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r=cjgillot
Deny associated type bindings within associated type bindings

Fixes #102335

This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by #100865, evidenced by the test I added for GATs:

```rust
trait T {
    type A: S<C<(), i32 = ()> = ()>;
    //~^ ERROR associated type bindings are not allowed here
}

trait Q {}

trait S {
    type C<T>: Q;
}

fn main() {}
```

^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.
2022-09-28 13:07:18 +09:00
mejrs
4ff83cee95 Deduplicate some logic 2022-09-28 02:36:58 +02:00
mejrs
f3ac328d58 Address feedback 2022-09-27 21:42:09 +02:00
mejrs
c4c9415132 Wrapper suggestions 2022-09-27 21:42:09 +02:00
Michael Goulet
92561f43f1 Support bindings with anon consts in generics 2022-09-27 17:42:15 +00:00
Michael Goulet
05267b5a50 Make type_of work correctly for const arg bindings 2022-09-27 17:42:14 +00:00
Michael Goulet
cca48285b8 Format type_of 2022-09-27 17:42:13 +00:00
Michael Goulet
ca2e0bb51a Deny associated type bindings within associated type bindings 2022-09-27 17:41:34 +00:00
Camille GILLOT
337a73da6e Do not overwrite binders for another HirId. 2022-09-27 18:58:37 +02:00
Arthur Cohen
0ab2c91a2d attributes: Add #[rustc_safe_intrinsic] builtin 2022-09-27 15:55:42 +02:00
lcnr
1fc86a63f4 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00