mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	 01503d0c1e
			
		
	
	
		01503d0c1e
		
	
	
	
	
		
			
			Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`). A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered. The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
		
			
				
	
	
		
			159 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			159 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| error[E0423]: expected value, found struct `Empty1`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:15:14
 | |
|    |
 | |
| LL | struct Empty1 {}
 | |
|    | ---------------- `Empty1` defined here
 | |
| ...
 | |
| LL |     let e1 = Empty1;
 | |
|    |              ^^^^^^
 | |
|    |
 | |
|   ::: $DIR/auxiliary/empty-struct.rs:2:1
 | |
|    |
 | |
| LL | pub struct XEmpty2;
 | |
|    | ------------------ similarly named unit struct `XEmpty2` defined here
 | |
|    |
 | |
| help: use struct literal syntax instead
 | |
|    |
 | |
| LL |     let e1 = Empty1 {};
 | |
|    |                     ++
 | |
| help: a unit struct with a similar name exists
 | |
|    |
 | |
| LL -     let e1 = Empty1;
 | |
| LL +     let e1 = XEmpty2;
 | |
|    |
 | |
| 
 | |
| error[E0423]: expected value, found struct `XEmpty1`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:22:15
 | |
|    |
 | |
| LL |     let xe1 = XEmpty1;
 | |
|    |               ^^^^^^^
 | |
|    |
 | |
|   ::: $DIR/auxiliary/empty-struct.rs:1:1
 | |
|    |
 | |
| LL | pub struct XEmpty1 {}
 | |
|    | ------------------ `XEmpty1` defined here
 | |
| LL | pub struct XEmpty2;
 | |
|    | ------------------ similarly named unit struct `XEmpty2` defined here
 | |
|    |
 | |
| help: use struct literal syntax instead
 | |
|    |
 | |
| LL |     let xe1 = XEmpty1 {};
 | |
|    |                       ++
 | |
| help: a unit struct with a similar name exists
 | |
|    |
 | |
| LL -     let xe1 = XEmpty1;
 | |
| LL +     let xe1 = XEmpty2;
 | |
|    |
 | |
| 
 | |
| error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:16:14
 | |
|    |
 | |
| LL | struct Empty1 {}
 | |
|    | ---------------- `Empty1` defined here
 | |
| ...
 | |
| LL |     let e1 = Empty1();
 | |
|    |              ^^^^^^^^
 | |
|    |
 | |
|   ::: $DIR/auxiliary/empty-struct.rs:2:1
 | |
|    |
 | |
| LL | pub struct XEmpty2;
 | |
|    | ------------------ similarly named unit struct `XEmpty2` defined here
 | |
|    |
 | |
| help: use struct literal syntax instead
 | |
|    |
 | |
| LL -     let e1 = Empty1();
 | |
| LL +     let e1 = Empty1 {};
 | |
|    |
 | |
| help: a unit struct with a similar name exists
 | |
|    |
 | |
| LL -     let e1 = Empty1();
 | |
| LL +     let e1 = XEmpty2();
 | |
|    |
 | |
| 
 | |
| error[E0533]: expected value, found struct variant `E::Empty3`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:18:14
 | |
|    |
 | |
| LL |     let e3 = E::Empty3;
 | |
|    |              ^^^^^^^^^ not a value
 | |
|    |
 | |
| help: you might have meant to create a new value of the struct
 | |
|    |
 | |
| LL |     let e3 = E::Empty3 {};
 | |
|    |                        ++
 | |
| 
 | |
| error[E0533]: expected value, found struct variant `E::Empty3`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:19:14
 | |
|    |
 | |
| LL |     let e3 = E::Empty3();
 | |
|    |              ^^^^^^^^^ not a value
 | |
|    |
 | |
| help: you might have meant to create a new value of the struct
 | |
|    |
 | |
| LL -     let e3 = E::Empty3();
 | |
| LL +     let e3 = E::Empty3 {};
 | |
|    |
 | |
| 
 | |
| error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:23:15
 | |
|    |
 | |
| LL |     let xe1 = XEmpty1();
 | |
|    |               ^^^^^^^^^
 | |
|    |
 | |
|   ::: $DIR/auxiliary/empty-struct.rs:1:1
 | |
|    |
 | |
| LL | pub struct XEmpty1 {}
 | |
|    | ------------------ `XEmpty1` defined here
 | |
| LL | pub struct XEmpty2;
 | |
|    | ------------------ similarly named unit struct `XEmpty2` defined here
 | |
|    |
 | |
| help: use struct literal syntax instead
 | |
|    |
 | |
| LL -     let xe1 = XEmpty1();
 | |
| LL +     let xe1 = XEmpty1 {};
 | |
|    |
 | |
| help: a unit struct with a similar name exists
 | |
|    |
 | |
| LL -     let xe1 = XEmpty1();
 | |
| LL +     let xe1 = XEmpty2();
 | |
|    |
 | |
| 
 | |
| error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
 | |
|   --> $DIR/empty-struct-braces-expr.rs:25:19
 | |
|    |
 | |
| LL |     let xe3 = XE::Empty3;
 | |
|    |                   ^^^^^^ variant or associated item not found in `empty_struct::XE`
 | |
|    |
 | |
| help: there is a variant with a similar name
 | |
|    |
 | |
| LL |     let xe3 = XE::XEmpty3;
 | |
|    |                   +
 | |
| 
 | |
| error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
 | |
|   --> $DIR/empty-struct-braces-expr.rs:26:19
 | |
|    |
 | |
| LL |     let xe3 = XE::Empty3();
 | |
|    |                   ^^^^^^ variant or associated item not found in `empty_struct::XE`
 | |
|    |
 | |
| help: there is a variant with a similar name
 | |
|    |
 | |
| LL -     let xe3 = XE::Empty3();
 | |
| LL +     let xe3 = XE::XEmpty3 {};
 | |
|    |
 | |
| 
 | |
| error[E0599]: no variant named `Empty1` found for enum `empty_struct::XE`
 | |
|   --> $DIR/empty-struct-braces-expr.rs:28:9
 | |
|    |
 | |
| LL |     XE::Empty1 {};
 | |
|    |         ^^^^^^
 | |
|    |
 | |
| help: there is a variant with a similar name
 | |
|    |
 | |
| LL -     XE::Empty1 {};
 | |
| LL +     XE::XEmpty3 {};
 | |
|    |
 | |
| 
 | |
| error: aborting due to 9 previous errors
 | |
| 
 | |
| Some errors have detailed explanations: E0423, E0533, E0599.
 | |
| For more information about an error, try `rustc --explain E0423`.
 |