Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ba350ff
fix: re-enable self-assignment
notJoon Aug 10, 2025
de13718
test: Add rustdoc test for enum negative overflow
eval-exec Aug 10, 2025
20a134f
rustdoc: Use `discr`s `Display` impl to render the value with the cor…
eval-exec Aug 10, 2025
cd4676c
Turn _span into _trace as trace span name
Stypox Aug 11, 2025
6603fe1
Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)
scrabsha Aug 3, 2025
d523b9f
Support using #[unstable_feature_bound] on trait
tiif Aug 11, 2025
9a8facb
Update rustc dev guide
tiif Aug 11, 2025
bcf87e4
Update error message
tiif Aug 11, 2025
0ccbe8f
std: sys: pal: uefi: Overhaul Time
Ayush1325 Apr 14, 2025
35906ea
std: sys: pal: uefi: tests: Add systemtime tests
Ayush1325 May 24, 2025
79a134a
Document compiler and stdlib in stage1 in `pr-check-2` CI job
Kobzol Aug 11, 2025
c022ed9
don't emit rustdoc::broken_intra_doc_links for stuff like [!NOTE]
lolbinarycat Aug 4, 2025
189f264
Allow attr entries to declare list of alternatives for `List` and `Na…
estebank Aug 11, 2025
625143b
Add link to docs on malformed attributes
estebank Aug 11, 2025
6bb29af
Add link to invalid `repr` error
estebank Aug 11, 2025
413ca5d
fix tests
estebank Aug 11, 2025
50d8b80
Update books
rustbot Aug 11, 2025
32ee26c
Add more docs to templates for attrs with incorrect arguments
estebank Aug 11, 2025
adccb8d
Rework `NameValueStr`
estebank Aug 11, 2025
1dc37df
Simplify `add_apple_sdk`
madsmtm Aug 11, 2025
928dd11
fix clippy test
estebank Aug 11, 2025
1cc44bf
Pass Apple SDK root to compiler driver via SDKROOT env var
madsmtm Aug 11, 2025
f4a9110
Only warn when invoking xcrun
madsmtm Aug 11, 2025
1d13162
Always attempt to invoke xcrun to get the Apple SDK
madsmtm Aug 11, 2025
86853b3
Account for new `assert!` desugaring in `!condition` suggestion
estebank Aug 11, 2025
39c5d6d
Factor out InherentImplCannotUnsafe
camsteffen Jul 30, 2025
fa73390
Move trait impl modifier errors to parsing
camsteffen Jul 30, 2025
3aa0ac0
Tweak trait modifier errors
camsteffen Jul 30, 2025
5bc23ce
Extract ast TraitImplHeader
camsteffen Jul 22, 2025
bf266dc
Propagate TraitImplHeader to hir
camsteffen Jul 24, 2025
25fe461
std: thread: Return error if setting thread stack size fails
Gelbpunkt Jul 20, 2025
5fbbbad
Rollup merge of #131477 - madsmtm:sdkroot-via-env-var, r=nnethercote
fmease Aug 12, 2025
e372be7
Rollup merge of #139806 - Ayush1325:uefi-systemtime, r=joboet
fmease Aug 12, 2025
2b06b3e
Rollup merge of #144210 - Gelbpunkt:thread-stack-size-musl, r=jhpratt
fmease Aug 12, 2025
c55f24c
Rollup merge of #144386 - camsteffen:imploftrait, r=fmease
fmease Aug 12, 2025
6fcd4bf
Rollup merge of #144921 - lolbinarycat:rustdoc-intra-doc-gfm-141866, …
fmease Aug 12, 2025
2a39cf1
Rollup merge of #145155 - scrabsha:push-tkvwkolzooyq, r=jdonszelmann
fmease Aug 12, 2025
e92800a
Rollup merge of #145214 - notJoon:fix/enable-self-assignment, r=petro…
fmease Aug 12, 2025
7c2f7a7
Rollup merge of #145216 - eval-exec:fix-145125-enum-rustdoc, r=fmease
fmease Aug 12, 2025
afe2fba
Rollup merge of #145238 - estebank:attr-overhaul, r=jdonszelmann
fmease Aug 12, 2025
2caa3bb
Rollup merge of #145249 - Stypox:_span-to-_trace, r=joshtriplett
fmease Aug 12, 2025
556c571
Rollup merge of #145251 - tiif:support_trait, r=BoxyUwU
fmease Aug 12, 2025
716cfe8
Rollup merge of #145253 - Kobzol:pr-check-2-doc-stage-1, r=jieyouxu
fmease Aug 12, 2025
30bff95
Rollup merge of #145263 - rustbot:docs-update, r=ehuss
fmease Aug 12, 2025
84cce89
Rollup merge of #145273 - estebank:not-not, r=samueltardieu
fmease Aug 12, 2025
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
4 changes: 2 additions & 2 deletions compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ passes_rustc_std_internal_symbol =
.label = not a function or static

passes_rustc_unstable_feature_bound =
attribute should be applied to `impl` or free function outside of any `impl` or trait
.label = not an `impl` or free function
attribute should be applied to `impl`, trait or free function
.label = not an `impl`, trait or free function

passes_should_be_applied_to_fn =
attribute should be applied to a function definition
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
match target {
// FIXME(staged_api): There's no reason we can't support more targets here. We're just
// being conservative to begin with.
Target::Fn | Target::Impl { .. } => {}
Target::Fn | Target::Impl { .. } | Target::Trait => {}
Target::ExternCrate
| Target::Use
| Target::Static
Expand All @@ -2341,7 +2341,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| Target::Struct
| Target::Field
| Target::Union
| Target::Trait
| Target::TraitAlias
| Target::Expression
| Target::Statement
Expand Down
7 changes: 6 additions & 1 deletion src/doc/rustc-dev-guide/src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ of the standard library raises it to a warning with
`#![warn(deprecated_in_future)]`.

## unstable_feature_bound
The `#[unstable_feature_bound(foo)]` attribute can be used together with `#[unstable]` attribute to mark an `impl` of stable type and stable trait as unstable. In std/core, an item annotated with `#[unstable_feature_bound(foo)]` can only be used by another item that is also annotated with `#[unstable_feature_bound(foo)]`. Outside of std/core, using an item with `#[unstable_feature_bound(foo)]` requires the feature to be enabled with `#![feature(foo)]` attribute on the crate. Currently, only `impl`s and free functions can be annotated with `#[unstable_feature_bound]`.
The `#[unstable_feature_bound(foo)]` attribute can be used together with `#[unstable]` attribute to mark an `impl` of stable type and stable trait as unstable. In std/core, an item annotated with `#[unstable_feature_bound(foo)]` can only be used by another item that is also annotated with `#[unstable_feature_bound(foo)]`. Outside of std/core, using an item with `#[unstable_feature_bound(foo)]` requires the feature to be enabled with `#![feature(foo)]` attribute on the crate.

Currently, the items that can be annotated with `#[unstable_feature_bound]` are:
- `impl`
- free function
- trait

[blog]: https://www.ralfj.de/blog/2018/07/19/const.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: unstable feature `foo` is used without being enabled.
--> $DIR/unstable_feature_bound_on_trait.rs:28:5
|
LL | Foo::bar();
| ^^^^^^^^^^
|
= help: The feature can be enabled by marking the current item with `#[unstable_feature_bound(foo)]`
note: required by a bound in `Bar::bar`
--> $DIR/unstable_feature_bound_on_trait.rs:16:1
|
LL | #[unstable_feature_bound(foo)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Bar::bar`
...
LL | fn bar() {}
| --- required by a bound in this associated function

error: aborting due to 1 previous error

33 changes: 33 additions & 0 deletions tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//@ revisions: pass fail
//@[pass] check-pass

#![allow(internal_features)]
#![feature(staged_api)]
#![stable(feature = "a", since = "1.1.1" )]

/// Test the behaviour of marking a trait with #[unstable_feature_bound].
/// In this testcase, even though the trait method `bar` and the `struct Foo` are
/// both stable, #[unstable_feature_bound] is still needed at the call site of Foo::bar().
#[stable(feature = "a", since = "1.1.1" )]
struct Foo;

#[unstable(feature = "foo", issue = "none" )]
#[unstable_feature_bound(foo)]
trait Bar {
#[stable(feature = "a", since = "1.1.1" )]
fn bar() {}
}

#[unstable_feature_bound(foo)]
impl Bar for Foo {
}

#[cfg_attr(pass, unstable_feature_bound(foo))]
fn moo() {
Foo::bar();
//[fail]~^ ERROR: unstable feature `foo` is used without being enabled.
}


fn main() {}
4 changes: 2 additions & 2 deletions tests/ui/unstable-feature-bound/unstable_inherent_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
pub trait Trait {
#[unstable(feature = "feat", issue = "none" )]
#[unstable_feature_bound(foo)]
//~^ ERROR: attribute should be applied to `impl` or free function outside of any `impl` or trait
//~^ ERROR: attribute should be applied to `impl`, trait or free function
fn foo();
}

#[stable(feature = "a", since = "1.1.1" )]
impl Trait for u8 {
#[unstable_feature_bound(foo)]
//~^ ERROR: attribute should be applied to `impl` or free function outside of any `impl` or trait
//~^ ERROR: attribute should be applied to `impl`, trait or free function
fn foo() {}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: attribute should be applied to `impl` or free function outside of any `impl` or trait
error: attribute should be applied to `impl`, trait or free function
--> $DIR/unstable_inherent_method.rs:11:5
|
LL | #[unstable_feature_bound(foo)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn foo();
| --------- not an `impl` or free function
| --------- not an `impl`, trait or free function

error: attribute should be applied to `impl` or free function outside of any `impl` or trait
error: attribute should be applied to `impl`, trait or free function
--> $DIR/unstable_inherent_method.rs:18:5
|
LL | #[unstable_feature_bound(foo)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn foo() {}
| ----------- not an `impl` or free function
| ----------- not an `impl`, trait or free function

error: aborting due to 2 previous errors