Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Rework the entire const trait system #96077

Closed
wants to merge 51 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cc5960c
Add new generic param
fee1-dead Apr 13, 2022
1933ba7
Add GenericArgDefKind::Constness and tweak generics_of
fee1-dead Apr 13, 2022
0f0f917
Small fixups
oli-obk May 31, 2022
7014e40
Update rustc_{infer,resolve,typeck,trait_selection}
fee1-dead Apr 15, 2022
1bafdc2
Fix more trivial errors
fee1-dead May 7, 2022
ab19ef3
Address trivial lints
oli-obk May 9, 2022
429f9e1
rustc_const_eval
oli-obk May 9, 2022
d9b6e50
runtime matches fall back to non-const PartialEq.
oli-obk May 9, 2022
821bb1f
Small fixups
oli-obk May 31, 2022
67e3eb3
Infer constness params from context if missing
oli-obk May 9, 2022
1b70638
Port some more crates
oli-obk May 9, 2022
11026ec
Update mir typeck
oli-obk May 9, 2022
6ce5109
typeck and borrowck compile
oli-obk May 9, 2022
7d3ee99
Get rustc_privacy to compile
oli-obk May 9, 2022
537b869
rustdoc
oli-obk May 9, 2022
69e6e63
clippy
oli-obk May 9, 2022
dd7ec37
Start poking ICEs until they melt
oli-obk May 9, 2022
77b4af3
Fix assertion ICE
fee1-dead May 10, 2022
17339ca
Add more information to substitution failure
oli-obk May 11, 2022
826f29d
Only add constness arg for const_trait traits
oli-obk May 11, 2022
0d5b724
Print GenericArg
fee1-dead May 11, 2022
e70e92e
Explicitly handle constness from parents
oli-obk May 11, 2022
7c5527d
Now that constness is optional, we default to not-const if it isn't t…
oli-obk May 11, 2022
0fe3432
Constness is optional now
oli-obk May 11, 2022
56a16f8
Remove constness arg from `mk_substs_trait`
oli-obk May 11, 2022
1727172
Remove the helper-methods for mk_substs_trait
oli-obk May 11, 2022
71bcd35
Stop appending constness to all substs
oli-obk May 11, 2022
c59a58c
Allow the constness argument anywhere in the generics list
oli-obk May 31, 2022
b8675a2
HACK: Remove all const trait impls and `~const` from libcore/libstd
oli-obk Jun 1, 2022
03d3d0d
Fix up some trivial test changes
oli-obk Jun 1, 2022
2b7ec4f
Require explicitly handling the tristate constness
oli-obk Jun 1, 2022
4c0f2d0
Actually substitute constness params
oli-obk Jun 1, 2022
d0db6fe
Some tracing for better debugging
oli-obk Jun 1, 2022
4a58caa
Fix typeck probing code to use constness from FnCtxt
fee1-dead Jun 3, 2022
57493e5
Introduce ConstnessArg::Infer and fix some tests
fee1-dead Jun 4, 2022
cbb2cf8
Handle matches added by rebase
fee1-dead Jun 4, 2022
ad467ae
More attempts to fix ui errors
fee1-dead Jun 6, 2022
84054f7
Merge ::Required and ::Param
fee1-dead Jun 6, 2022
cd2edf6
Add CosntnessArg::Const when needed
fee1-dead Jun 7, 2022
d4551d2
Fixed error with more TODOs
fee1-dead Jun 15, 2022
a319331
Don't require has_self when adding constness
fee1-dead Jun 17, 2022
d2322b2
Return unimplemented when feature is not enabled
fee1-dead Jun 19, 2022
cb8bde3
const impls have constness
fee1-dead Jun 19, 2022
6dfe452
var_for_def uses actual constness sometimes
fee1-dead Jun 19, 2022
a0cd8a2
Fix more ui tests
fee1-dead Jun 20, 2022
1ee0614
Equate candidates modulo constness
fee1-dead Jun 20, 2022
7316ca4
Revert "HACK: Remove all const trait impls and `~const` from libcore/…
fee1-dead Jun 20, 2022
25be7a4
attempt to fix std ice
fee1-dead Jun 21, 2022
4f50485
More attempts to fix ICE
fee1-dead Jun 26, 2022
4845b35
general fixes
fee1-dead Jul 13, 2022
b8bbee6
fixup
fee1-dead Jul 15, 2022
File filter

Filter by extension

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
Infer constness params from context if missing
oli-obk authored and fee1-dead committed Jul 15, 2022
commit 67e3eb37ae816a1e14b2153f89dbbb75d0307eaf
15 changes: 15 additions & 0 deletions compiler/rustc_typeck/src/astconv/mod.rs
Original file line number Diff line number Diff line change
@@ -567,6 +567,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
}
}
}
GenericParamDefKind::Constness => {
match self.astconv.item_def_id() {
// no information available
// TODO: fall back to `Not`?
None => ty::ConstnessArg::Param,
Some(context) => {
if tcx.hir().body_const_context(context.expect_local()).is_some() {
ty::ConstnessArg::Required
} else {
ty::ConstnessArg::Not
}
}
}
.into()
}
}
}
}